[APP][2.1+] CPU Spy v0.4.0 beta - view time in state info [dec-7-2011]

Search This thread

storm717

Retired Recognized Developer
Sep 10, 2007
65
104
Austin, TX
I've created a simple app to display the time the CPU spends in each frequency state and the current kernel build. May be useful to some... especially people running OC'ed kernels.

Also useful to confirm which kernel you're currently running.

** DOWNLOAD **
Android Market Link

Error complaining about states file not found? See this post.

*** Thanks to Rainerd for the patch to help with the negative state percentages.

Change log

v0.4.0 beta
-Display total state time
-Massive code cleanup
-Fix duration overflow bug
-Removed read-as-root attempt when unable to access states file due to instability
-Slightly improved tablet support

v0.3.2 beta
-Pulled in fix from Rainerd to help with percentage mixups after reboot

v0.3.1 beta
-Small fix that may help with freezing issues with some custom ROMS

v0.3.0 beta
-Attempts to read time_in_state file as root in case reading is blocked by a custom ROM

v0.2.2 beta
-States are now sorted from highest to lowest frequency

v0.2.1 beta
-added "Deep Sleep" to states list for time when CPU is off

v0.2.0 beta
-Added "reset timers" option to set all state timers to 0 sec
-Added "restore timers" to show time-in-state since boot
-Small UI adjustments
-Timers now show hours

v0.1.0
-Initial market release

source: https://github.com/bvalosek/cpuspy
previous versions (source only): https://github.com/bvalosek/cpuspy/tags
 

Attachments

  • ss2.jpg
    ss2.jpg
    27.3 KB · Views: 7,510
  • ss3.jpg
    ss3.jpg
    46.7 KB · Views: 8,782
Last edited:

lactardjosh

Senior Member
Dec 25, 2010
554
298
Works great on my rooted stock KB1 with CogKernel 4.

Since I'm running stock KB1, the full kernel name doesn't show up under About Phone and I've been looking for an easy way to confirm which kernel I've got installed at the moment, especially when I'm jumping from kernel to kernel. This works well.

If you made a (transparent) widget that showed the kernel name, I'd be all over it.
 

Hondo209

Senior Member
Dec 20, 2010
264
16
THE209
This is nice, now you can see what MHz use less of the cpu and you can undervolt more on those specific speeds.
 

iXNyNe

Senior Member
Dec 26, 2010
1,133
473
37
nemchik.com
just out of curiosity this displays total time in state since bootup correct? not like since last unplugged or since last magic trick

*edit
btw bravo, gave ya 5 stars in market
 

diablo009

Senior Member
Apr 20, 2009
5,558
1,350
Atlanta GA
[Request]

Very useful. Thanks mate.

Working on dilligaf's 7.x with dilli pickle kernel, glitterball's kernel and xcaliburinhand's 2.3.5 kernel.

Request:

Could u please add a "reset" feature, if possible, so it would be easier to get the time spent on each state when playing with maximum CPU speeds. Like I might set my max speed to 1000 from 1280 n want to check the time spent at 1000. Right now only a reboot is resetting the data.

Or, like my gut feeling says, is this app reading for this data from anywhere forcing a reboot if the data has to be reset.
 

rajendra82

Senior Member
Jul 17, 2010
1,451
531
Atlanta, GA
Very useful. Thanks mate.

Working on dilligaf's 7.x with dilli pickle kernel, glitterball's kernel and xcaliburinhand's 2.3.5 kernel.

Request:

Could u please add a "reset" feature, if possible, so it would be easier to get the time spent on each state when playing with maximum CPU speeds. Like I might set my max speed to 1000 from 1280 n want to check the time spent at 1000. Right now only a reboot is resetting the data.

Or, like my gut feeling says, is this app reading for this data from anywhere forcing a reboot if the data has to be reset.

It's reading the data from:

/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state

Which only gets set to zero at each reboot.
 
Last edited:

zacharias.maladroit

Recognized Developer
It's reading the data from:

/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state

Which only gets set to zero at each reboot.

what I had expected

thanks for the info ! :)


so it basically does the same for Android & a really nice GUI

like the console-app cpufreq-info on linux

thanks a lot for coding that app, storm717 ! :)

for me it probably will show 100 MHz for most of the time (due to powersave set in screen-off state) - it's however nice to know what frequency the CPU will spend most of its time in while it's on (the 2nd and 3rd most-used frequency) & dedicating some more UV-stability testing towards that frequency


others that don't use the powersave governor will surely find it even more useful
 
Last edited:

Liv33viL

Senior Member
Feb 19, 2011
175
71
Handy Tool

Definitely a handy tool to have.

Quick, easy info without with command line for those who really want to know what's going on under the hood quickly and easily.

I did a fly by here this morning and it looks as though word is getting out about this.

Good show..

Peace-
 

lospulpo

Senior Member
Sep 23, 2010
99
7
LOL at those people saying "Works with setup in my sig!"... like you don't change that setup in your sig 5 times a month... You're gonna confuse all of the people that find this thread next week/month/year/decade/century.


Thanks for the cool app tho. Really do 'preciate it bra, should help UV'ing this sucker.
 

storm717

Retired Recognized Developer
Sep 10, 2007
65
104
Austin, TX
Glad you guys like it!

Updated to v0.2.0 in the Market -- added the reset timers features a few of yall requested. "reset timers" does what you'd think and "restore timers" returns them to show the time in each state since boot.
 
Last edited:

Jemack

Senior Member
Dec 10, 2010
364
93
Baton Rouge
Glad you guys like it!

Updated to v0.2.0 in the Market -- added the reset timers features a few of yall requested. "reset timers" does what you'd think and "restore timers" returns them to show the time in each state since boot.
Now that is what I call above and beyond.....thank you. Leaving app now and going to web site just to hit your button.
 

rajendra82

Senior Member
Jul 17, 2010
1,451
531
Atlanta, GA
The time readouts in 0.2.0 are getting wrong after I keep the phone running for a long time. Here is the output from the file:

File:
1600 0
1500 0
1400 17001
1300 0
1200 8537
1120 0
1000 27348
900 0
800 434348
600 212601
400 149584
200 152861
100 561535

By the time I took this reading my phone has been up about 13 hours. The sum of all the values is 1563815, which seems to indicate that the values in each state are in terms of 1/33.33 seconds. This appears to be different than when the phone runs for a short time, when the values in the file seem to be in terms of 1/100 of a second. At some point the system must be making a switch to how it records, unless I am interpreting the numbers wrong, and the older times are getting discarded, and the sum has nothing to do with up time. CPU Spy still thinks that the values are in 1/100 of a second, and gives time in 1400 state as 0:2:50, and total of all states as 4:20:38. This can be avoided if the sum of the states values is checked against up time to come up with what the current unit of measurement is.
 
Last edited:

storm717

Retired Recognized Developer
Sep 10, 2007
65
104
Austin, TX
The time readouts in 0.2.0 are getting wrong after I keep the phone running for a long time. Here is the output from the file:

File:
1600 0
1500 0
1400 17001
1300 0
1200 8537
1120 0
1000 27348
900 0
800 434348
600 212601
400 149584
200 152861
100 561535

By the time I took this reading my phone has been up about 13 hours. The sum of all the values is 1563815, which seems to indicate that the values in each state are in terms of 1/33.33 seconds. This appears to be different than when the phone runs for a short time, when the values in the file seem to be in terms of 1/100 of a second. At some point the system must be making a switch to how it records, unless I am interpreting the numbers wrong, and the older times are getting discarded, and the sum has nothing to do with up time. CPU Spy still thinks that the values are in 1/100 of a second, and gives time in 1400 state as 0:2:50, and total of all states as 4:20:38. This can be avoided if the sum of the states values is checked against up time to come up with what the current unit of measurement is.

I'll look into this tonight, but I think this is the correct behavior. The CPU goes into a deep sleep mode after a while and effectively shuts off waiting for external input or something interesting to happen. If this is the case I may add a "deep sleep" row to clarify.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 93
    I've created a simple app to display the time the CPU spends in each frequency state and the current kernel build. May be useful to some... especially people running OC'ed kernels.

    Also useful to confirm which kernel you're currently running.

    ** DOWNLOAD **
    Android Market Link

    Error complaining about states file not found? See this post.

    *** Thanks to Rainerd for the patch to help with the negative state percentages.

    Change log

    v0.4.0 beta
    -Display total state time
    -Massive code cleanup
    -Fix duration overflow bug
    -Removed read-as-root attempt when unable to access states file due to instability
    -Slightly improved tablet support

    v0.3.2 beta
    -Pulled in fix from Rainerd to help with percentage mixups after reboot

    v0.3.1 beta
    -Small fix that may help with freezing issues with some custom ROMS

    v0.3.0 beta
    -Attempts to read time_in_state file as root in case reading is blocked by a custom ROM

    v0.2.2 beta
    -States are now sorted from highest to lowest frequency

    v0.2.1 beta
    -added "Deep Sleep" to states list for time when CPU is off

    v0.2.0 beta
    -Added "reset timers" option to set all state timers to 0 sec
    -Added "restore timers" to show time-in-state since boot
    -Small UI adjustments
    -Timers now show hours

    v0.1.0
    -Initial market release

    source: https://github.com/bvalosek/cpuspy
    previous versions (source only): https://github.com/bvalosek/cpuspy/tags
    11
    In these days I've added a few things. Let me know what you think about them.
    As usual apk and screenshots in the attachments.

    Changelog
    • added connection usage stats, both "total" and "since reset" ones
    • it's possibile to hide this stats by clicking in the relative black header bar ( for example where it says "Total Statistics" )
    • added 3 more option in the settings menu:
      - Disable Cable Events: if checked (un)plugging the cable doesn't affect the timer
      - Disable Connection Events: if checked the app doesn't store the connection usage
      - Delete Conn Vars: if clicked connection usage stats will be erased
    • removed the "On/Off Listen Batt Events" option menu

    edit:
    Changelog
    • when phone shutdown/restart timer and connection datas are deleted
    • added confirmation alertbox to the "Delete Connection Datas" preference
    6
    Changelog
    • drop-down arrow on the expandable line headers
    • corrected the "information" strings
    • inserted the version app number in the top of the screen (0.5.00)
    • bugfix about wifi connection timer usage (at least I hope so)

    4. I know the unused states are being reported but is it possible to also show this information in the bar graphs by creating a new "Other" bar graph perhaps?
    maybe I'm missing something. what should this "other" bar graph represent ? I mean, those freqs are unused so their values are equal to zero.

    What exactly is the mobile and wifi usage reporting? How is this relating to battery?
    Those are the time the phone has been connected to wifi or mobile. I think it's releted to battery drain. If I switch off all the connection my phone goes to deep sleep and it last forver, kind of ;). I can't say the same for the phone connected to internet. So I was curious to know which is the difference between the to condition and I thought it'd be usefull to have this info in the app. However you can disable the connection listener and hide the relative stats if you don't like them ;)
    6
    Hai fatto troppo bene ;)

    But could you place the "Other" stats on top of the list?

    Maybe hideable like the network stats?

    Its getting to much information somehow ;)

    Tante Grazie!

    Here you go! :) Maybe too fast? :D :D

    Changelog 0.5.02

    • "All states <1%" can be hidden/shown by clicking the header "Time In State"
    • "All states <1%" can be shown on top or bottom of the bar graph through the setting in the preference.
    • removed submenu of "Less than 1% usage states (i.e. ecc)" because redundant.
    • added link to this thread in the Information View
    4
    new release

    Changelog 0.5.01
    • added "All states <1%" row in the bar graph view indacating the total time of those freqs under the 1% of total usage. It's visible only when states<1% are hided.
    • added minimum cpu infos:
      - "Freq range" shows the min-max freqs values your kenerl support;
      - "Scaling range" shows the min-max freqs your governor is using;
      - "Governor"... well you know, it shows the running governor :D
    • fixed bug of overload connection timer values (at least I hope so)
    • fixed strange reaction to cable events