0

How can I get CPU user time and system time for each cpu on AIX. I know I can get this value from cat /proc/stat on a linux machine, and from pstat_getprocessor() on an HP-UX machine. Is there a way to get this same metric on an AIX machine.

$ cat /proc/stat
...   
cpu  23697394 7969 2744135 4505191649 2958605 190 17883 0 0
cpu0 12511394 4575 1520243 2251753159 1480624 137 10580 0 0
cpu1 11186000 3394 1223891 2253438490 1477980 53 7302 0 0
...
jlliagre
  • 29,783
  • 6
  • 61
  • 72
Yogesh
  • 2,198
  • 1
  • 19
  • 28

1 Answers1

0

mpstat is providing these metrics, either parse its output or figure out how/where does it find them.

jlliagre
  • 29,783
  • 6
  • 61
  • 72
  • I thought mpstat would just give me percent but not individual time metrics in cycles/milliseconds/seconds. right? – Yogesh Aug 23 '13 at 18:21
  • You can easily convert percents of given period of time to milliseconds, seconds or cycles, don't you ? – jlliagre Aug 23 '13 at 20:02
  • That is true, only if I know what is time period. I don't want to get the total user cycles, system cycles from the time system was brought up. MPSTAT without any duration/time interval. If I can get this value then I will be able to get the desired result. – Yogesh Aug 23 '13 at 21:52
  • You know the time period, that's the `interval` argument in seconds. – jlliagre Aug 23 '13 at 22:08
  • My last comment was ill formed. I meant I wanted to know the total user cycles and system cycles form the time system was brought up. If I don't pass any argument to MPSTAT that is what I get but in percentage. I understand that I can convert percent to absolute value. However to do that conversion I need the total time system has been up. – Yogesh Aug 23 '13 at 23:08
  • I got my answer using libperfstat library. I was able to get CPU clock ticks and count. This is what I was looking for. – Yogesh Aug 29 '13 at 01:33
  • Then next time, make more clear in your question what you are really looking for. You question states "CPU user time and System time on AIX" for each CPU and I answered to it. I don't get why you specifically focus on clock ticks and count while they are just artifacts, what eventually matters is the percentage spent in each state. – jlliagre Aug 29 '13 at 06:19
  • I am going to accept this answer because may be I was unclear when I said I needed time (not percentage). – Yogesh Aug 29 '13 at 18:25