• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

CPU usage - how measured

tamir297

Lurker
Hi,

How is CPU usage, that is displayed in kitkat, calculated when CPU is lower the maximal speed ?

For example, if my CPU can work in 1MHZ, but my application uses 0.5 MHZ for 1 sec, will the CPU usage be 1 sec or 0.5 sec ?
 
Hey tamir297, welcome to our AndroidForums!

At the risk of posting before those that know math much better than I do (:p), I'll just chime-in with my brief thoughts:

Quick answer: I believe it would be 0.5 seconds (i.e., your app kept the CPU busy for half of the one second interval).

~ ~ ~

Whenever I've typically cited CPU usage, it's usually in terms of the percent of utilization over a given time period.

In your example, I would say that your CPU was 50% busy over that one second. If you knew the max. CPU speed (1 MHz in this case), you'd be able to figure-out that you you averaged 0.5 MHz over that one second of time.

Your app didn't (and probably couldn't) use all 100% of the CPU's capacity (1 MHz) because it was probably in a sleep state or waiting for an I/O operation to complete, etc.

Hope that helps!

:)

edit: Oh, I forgot to mention that I still have a Z80A chip that ran at 4 MHz that I was going to use to "upgrade" the original Z80 chip (2.5 MHz) in my Kaypro II from back in the early 1980s. I never installed it, though :p.
 
In your example, I would say that your CPU was 50% busy over that one second.

I'm not sure this is true; in the given situation the CPU is actually 100% busy unless the clock speed is increased.

It's pertinent that Google reports the CPU use in seconds, an absolute unit. Had they meant to reflect changes in clock speed they could have displayed the usage in (say) CPU cycles - but they didn't, so my best guess considered judgement is the opposite of yours on the matter - a second is a second is a second :-)
 
i'm pretty sure scary alien is correct, i think it works the same way as for windows computers, and on windows PCs, when your CPU is running on 75% during an hour, CPU time will be 45 minutes. i've checked on my smartphone, and it looks to be working the same way
 
Back
Top Bottom