1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 #include "AudioStreamGateway.h" 19 #include "oboe/Oboe.h" 20 #include "common/OboeDebug.h" 21 #include <sched.h> 22 #include <cstring> 23 #include "OboeTesterStreamCallback.h" 24 25 // Print if scheduler changes. printScheduler()26void OboeTesterStreamCallback::printScheduler() { 27 #if OBOE_ENABLE_LOGGING 28 int scheduler = sched_getscheduler(gettid()); 29 if (scheduler != mPreviousScheduler) { 30 int schedulerType = scheduler & 0xFFFF; // mask off high flags 31 LOGD("callback CPU scheduler = 0x%08x = %s", 32 scheduler, 33 ((schedulerType == SCHED_FIFO) ? "SCHED_FIFO" : 34 ((schedulerType == SCHED_OTHER) ? "SCHED_OTHER" : 35 ((schedulerType == SCHED_RR) ? "SCHED_RR" : "UNKNOWN"))) 36 ); 37 mPreviousScheduler = scheduler; 38 } 39 #endif 40 }