Posts

Post not yet marked as solved
9 Replies
As @eskimo say, wakeup is because of 'interrupt', but: MUST be asyn interrupt, include IQR, FIR. Soft interrupt or pageout is not 'wakeup'. Timer counter is the most common case. A task's wakeup is include all of its threads. So timer in different threads will increase your wakeup, otherwise maybe not. There are cases I found: NSTimer, CADisplayLink dispatch_after semaphores contains wait_time or lock contains wait_time There is also an debug case for me: When you include OpenGLES or Metal, xcode will inject 2 threads watching draw call command. You can disable this feature in scheme, https://developer.apple.com/documentation/metal/frame_capture_debugging_tools/enabling_frame_capture. After that, all goes ok. This is the code of getting wakeup count in your app, not only in the instrument. May help you: c #include mach/task.h #include mach/mach.h BOOL GetSystemWakeup(NSInteger *interrupt_wakeup, NSInteger *timer_wakeup) {   struct task_power_info info = {0};   mach_msg_type_number_t count = TASK_POWER_INFO_COUNT;   kern_return_t ret = task_info(current_task(), TASK_POWER_INFO, (task_info_t)&info, &count);   if (ret == KERN_SUCCESS) {     if (interrupt_wakeup) {       *interrupt_wakeup = info.task_interrupt_wakeups;     }     if (timer_wakeup) {       *timer_wakeup = info.task_timer_wakeups_bin_1 + info.task_timer_wakeups_bin_2;     }     return true;   }   else {     if (interrupt_wakeup) {       *interrupt_wakeup = 0;     }     if (timer_wakeup) {       *timer_wakeup = 0;     }     return false;   } }