BugshotKit icon indicating copy to clipboard operation
BugshotKit copied to clipboard

100% CPU Usage

Open alexito4 opened this issue 10 years ago • 2 comments

Hi! I recently fund that when I'm developing in the iOS Simulator my mac use one core at 100% and, consequently, the fans work and full speed and the temperature rises a lot. At first I was thinking that maybe is some bug with a new version of the simulator. But I tried to use instruments to search for some bug in my code and I found that BugshotKit is causing this. Specifically -[BugshotKit updateFromASL] method.

Instruments

I suppose that this method is the one that checks for logs. This happen every time I output a log in my code. But the main problem is that a single line of Log makes this method consume 100% of cpu time for 5 seconds or more.

Is this a normal behavior (because we are trying to read the logs) or is this a real issue?

Thanks! ;)

alexito4 avatar Mar 05 '14 10:03 alexito4

Is this under very heavy logging activity? Roughly how many messages are logged at this point in execution? Tens? Hundreds? Thousands? More?

There's no good efficient way to track new ASL messages on iOS. updateFromASL needs to request all entries from the log API (which I think is limited to the most recent 256) and match them against its internal copy to detect and add new ones.

For responsiveness in picking up new lines, it's triggered by a dispatch_source on stderr. But to avoid dominating the CPU under heavy logging, the consoleRefreshThrottler is meant to rate-limit it. Maybe that's not working right.

marcoarment avatar Mar 05 '14 16:03 marcoarment

After some time in execution, yes, maybe there are a lot of logs (from core data debugging), but not thousands. But just after starting the app this also happens. It's very strange. For now I disabled BugshotKit while I'm developing.

Thanks for answering ;)

alexito4 avatar Mar 05 '14 18:03 alexito4