Post

Replies

Boosts

Views

Activity

Reply to What does the number key means in log-power-timestamp.session
Maybe have relation with these categories: Audio: Used to play audio in your app Networking: Used for networking Processing: Used by the CPU and GPU Display: Used to show the application UI Bluetooth: Used for Bluetooth Location: Used for location tracking within your app Camera: Used by the camera within your app Torch: Used for the flashlight NFC: Used for NFC within your app Other: A combination of the power in the above categories thatʼs too small to show in the list and any other power use
Feb ’23
Reply to Wakeups limit exceeded
I try to reproduce a crash cause by wakeups limit exceed, sample code below:     for (int i = 0; i < 500; i++) {         NSThread *thread = [[NSThread alloc] initWithBlock:^{             [[NSThread currentThread] setName:[NSString stringWithFormat:@"%d", i]];             NSRunLoop *runLoop = [NSRunLoop currentRunLoop];             [runLoop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];             CADisplayLink *link4 = [CADisplayLink displayLinkWithTarget:self selector:@selector(threadCadisplayLink)];             //            link4.frameInterval = 60;             [link4 addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];             [runLoop run];         }];         [thread start];     } - (void)threadCadisplayLink {     NSInteger index = arc4random()%100;     NSObject *obj = [NSObject new];     dispatch_async(dispatch_get_global_queue(0, 0), ^{         self.info[@(index)] = obj;     }); } I get wake up times every second:     static NSInteger old_interrupt_wakeup;     static NSInteger old_timer_wakeup;     static NSInteger old_idle_wakeup;     [NSTimer scheduledTimerWithTimeInterval:1 repeats:true block:^(NSTimer * _Nonnull timer) {         NSInteger interrupt_wakeup;         NSInteger timer_wakeup;         NSInteger idle_wakeup;         rm_system_wakeup(&interrupt_wakeup, &timer_wakeup, &idle_wakeup);         NSLog(@"interrupt_wakeup: %ld timer_wakeup:%ld idle_wakeup: %ld", interrupt_wakeup - old_interrupt_wakeup, timer_wakeup - old_timer_wakeup, idle_wakeup - old_idle_wakeup);         old_interrupt_wakeup = interrupt_wakeup;         old_timer_wakeup = timer_wakeup;         old_idle_wakeup = idle_wakeup;     }]; rm_system_wakeup is same as @Daniel-Duan said I get interrupt_wakeup about 300000 every second, but fail to get Demo app crash. 2023-01-17 13:48:42.576934+0800 Demo[44926:1519725] interrupt_wakeup: 29684 timer_wakeup:5 idle_wakeup: 0 2023-01-17 13:48:43.577225+0800 Demo[44926:1519725] interrupt_wakeup: 30008 timer_wakeup:5 idle_wakeup: 10780509616 2023-01-17 13:48:44.577003+0800 Demo[44926:1519725] interrupt_wakeup: 30006 timer_wakeup:4 idle_wakeup: 0 2023-01-17 13:48:45.577459+0800 Demo[44926:1519725] interrupt_wakeup: 29505 timer_wakeup:3 idle_wakeup: 0 2023-01-17 13:48:46.577329+0800 Demo[44926:1519725] interrupt_wakeup: 30004 timer_wakeup:2 idle_wakeup: 0 Another question is what the difference between Crash with WAKEUPS subtype and wakeup event with a wakeups_resource-***.ips file, is wakeups_resource-***.ips means a crash happened?
Jan ’23
Reply to iOS16 [MXMetricManager deliverMetricPayload:] Crash
I finally find my way to solve this problem, first share my analysis of this problem: when deliver Metric payloads to all subscribers we called -[MXMetricManager addSubscriber:], this cause the NSConcreteHashTable that save subscribers get mutated while being enumerated. It seems that the NSConcreteHashTable add subscribers or deliver Metric payloads in it's own thread, so just dispatch to main queue to call -[MXMetricManager addSubscriber:] not work. This is easy to reproduce, just keep add new subscriber(not equal to existed subscriber) in you code and simulate metric payload with Xcode. Finally I try to hook -[MXMetricManager addSubscriber:] and -[MXMetricManager removeSubscriber:] to a custom Class, this class hold a NSPointerArray of all subscribers, and dispatch to each subscribers when -didReceiveMetricPayloads: and -didReceiveDiagnosticPayloads: getting called.
Oct ’22