Re: System idle time under Linux

2010-09-30 Thread Ifrit
Hugo Léveillé heeft het volgende neergekrabbeld:

> 
> Thanks, will take a closer look on that
> 
> But to get me started, how would you get, via python, the info from that

From a unix command prompt use the cat command to view their contents. 
You'll notice that they plain text files with very informative content:

 # cat /proc/stat
cpu  3799492 103198 3546212 82899838 1183162 137849 118698 0 0
cpu0 1071799 22089 1141874 20155255 262512 2714 1704 0 0
cpu1 926425 27349 694583 21016324 302881 2488 4253 0 0
cpu2 938331 29131 736412 2111 202243 123636 104475 0 0
cpu3 862937 24629 973343 20614926 415526 9011 8266 0 0
intr 153564472 28 10 0 0 0 0 0 7 1 3018879 0 0 173 0 0 0 62 55962320 0 0 0 0 
0 9620148 749 0 0 0 0 0 0 0 0 0 0 3136950 4742352 320982 1 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0
ctxt 478141455
btime 1285609820
processes 45111
procs_running 1
procs_blocked 0
softirq 195073836 0 34148873 30536 22265404 4426357 0 55946604 22390786 
370319 55494957

-- 
Ifrit
http://nl.wikipedia.org/wiki/Ifriet
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: System idle time under Linux

2010-09-30 Thread Ifrit
Ifrit heeft het volgende neergekrabbeld:

> Hugo Léveillé heeft het volgende neergekrabbeld:
> 
>> 
>> Thanks, will take a closer look on that
>> 
>> But to get me started, how would you get, via python, the info from that
> 
> From a unix command prompt use the cat command to view their contents.
> You'll notice that they plain text files with very informative content:
> 
>  # cat /proc/stat

And the man proc command gives info on the format of the content:

/proc/stat

  kernel/system statistics.  Varies with architecture.  Common 
entries include:

  cpu  3357 0 4313 1362393
 The  amount of time, measured in units of USER_HZ 
(1/100ths of a second on most architectures,
 use sysconf(_SC_CLK_TCK) to obtain the right value), 
that the system spent in user mode,  user
 mode  with  low priority (nice), system mode, and the 
idle task, respectively.  The last value
 should be USER_HZ times the second entry in the uptime 
pseudo-file.

 In Linux 2.6 this line includes three additional 
columns: iowait - time  waiting  for  I/O  to
 complete  (since  2.5.41); irq - time servicing 
interrupts (since 2.6.0-test4); softirq - time
 servicing softirqs (since 2.6.0-test4).

 Since Linux 2.6.11, there is an eighth column, steal - 
stolen time, which is the time spent in
 other operating systems when running in a virtualized 
environment

 Since  Linux 2.6.24, there is a ninth column, guest, 
which is the time spent running a virtual
 CPU for guest operating systems under the control of 
the Linux kernel.

  page 5741 1808
 The number of pages the system paged in and the number 
that were paged out (from disk).

  swap 1 0
 The number of swap pages that have been brought in and 
out.

  intr 1462898
 This line shows counts of interrupts serviced since 
boot time, for each of the possible system
 interrupts.   The first column is the total of all 
interrupts serviced; each subsequent column
 is the total for a particular interrupt.

  disk_io: (2,0):(31,30,5764,1,2) (3,0):...
 (major,disk_idx):(noinfo, read_io_ops, blks_read, 
write_io_ops, blks_written)
 (Linux 2.4 only)

  ctxt 115315
 The number of context switches that the system 
underwent.

  btime 769041601
 boot time, in seconds since the Epoch (January 1, 
1970).

  processes 86031
 Number of forks since boot.

  procs_running 6
 Number of processes in runnable state.  (Linux 2.5.45 
onwards.)

  procs_blocked 2
 Number of processes blocked waiting for I/O to 
complete.  (Linux 2.5.45 onwards.)

-- 
Ifrit
http://nl.wikipedia.org/wiki/Ifriet
-- 
http://mail.python.org/mailman/listinfo/python-list