简体   繁体   中英

XCode memory profiling in `Debug navigator` panel says `CPU usage` above 100%

I am new to XCode & iOS development. I am trying memory profile my app in terms of how good or bad it is over a certain period of run like 1-2 hours. XCode provides very useful statistics in its Debug Navigator panel while my app is running. I see following 5 numbers in the Debug Navigator

CPU
Memory
Energy Impact
Disk
Network
FPS

My app is a pretty heavy in terms of functionality. The number for Memory stayed around 80 MB even after 1 hour of run . This is good news for me I believe. But, CPU usage kept hovering from 105% to 120%. However what concerns me is that the CPU usage stayed always above 100%. Is this abnormal? Should I be worried for CPU usage being constantly above the 100% mark?

The stat for Energy Impact says Very high . Not sure how I can solve this but my app uses the network a lot. So, that might have risen that number. But any suggestion on lowering this Energy Impact stat would be helpful as well.

Note: I have 3 worker threads running in my app in addition to the main thread. Does this add to the increase in CPU usage ?

You can lower the energy impact by not keeping the CPU busy all the time. 100% or more of CPU usage means the phone will never go into an idle state, burning through the battery quite quickly. What are you doing that needs 100% of CPU usage? In my experience, even network heavy apps barely need more than a few percent of CPU usage, unless they are doing something very computationally expensive or when they are polling for something to happen. If it's the first, expensive computations, you can consider the architecture of your app and rethink if all this processing needs to take place on the device or if you can pre-process on the back-end feeding the app. If you're busy-polling something, that's just bad design and you should redesign that part of the app to be event driven.

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