简体   繁体   中英

Xcode 5 Debug - “Unnamed” Thread in CPU Report / Usage

XCode 5 present CPU usage report, including processing break up of each running thread. That's good and helpful to some extent.

But, can we give these threads programmatically some names so that it's easy to identify them? These threads are spawned by OS when my app schedule few NSTimers, NSOperation, NSURLConnection etc but I can't exactly map or identify threads shown in CPU report with their respective operations.

As you can see in the screenshot below, most of these threads are "Unnamed" making it difficult to identify the associated operations.

在此输入图像描述

Also, in general, what is the best way to comprehend this CPU report? Any suggestions please.

I'm using this tiny class to mark threads I need to identify in CPU monitor: https://github.com/deszip/APThreadMarker

Just call:

[APThreadMarker markCurrentThreadWithName:@"thread 1"];

inside start method of your NSOperation subclass and thread created for this NSOperation will have provided name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM