1839583 Members
2294 Online
110151 Solutions
New Discussion

docs on proc table

 
K.C. Chan
Trusted Contributor

docs on proc table

all,
here's a snippet of /proc//stat:
945 (ndiswrapwq) S 5 0 0 0 -1 41024 0 0 0 0 0 394 0 0 10 -5 1 0 1184 0 0 4294967295 0 0 0 0 0 0 2147483647 65536 0 3222508453 0 0 17 0 0 0

Could some shed some light on what each col means (map to). I could make out some of it but not all. fist col is pid, second is command, 3rd col is status of process. The rest I am not sure. I am interested in time process start, how much cpu rutime, etc...

Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
3 REPLIES 3
Gopi Sekar
Honored Contributor

Re: docs on proc table


check 'man 5 proc', it has detailed information on stat and other files in /proc/ folder

Hope this helps,
Gopi
Never Never Never Giveup
Matti_Kurkela
Honored Contributor

Re: docs on proc table

You might want to check out Linux kernel source code, linux-2.6.13.2/fs/proc/array.c, function do_task_stat().

The list of fields (in a huge sprintf() call) is defined as:

task->pid,
tcomm,
state,
ppid,
pgid,
sid,
tty_nr,
tty_pgrp,
task->flags,
min_flt,
cmin_flt,
maj_flt,
cmaj_flt,
cputime_to_clock_t(utime),
cputime_to_clock_t(stime),
cputime_to_clock_t(cutime),
cputime_to_clock_t(cstime),
priority,
nice,
num_threads,
jiffies_to_clock_t(it_real_value),
start_time,
vsize,
mm ? get_mm_counter(mm, rss) : 0, /* you might want to shift this left 3 */
rsslim,
mm ? mm->start_code : 0,
mm ? mm->end_code : 0,
mm ? mm->start_stack : 0,
esp,
eip,
/* The signal information here is obsolete.
* It must be decimal for Linux 2.0 compatibility.
* Use /proc/#/status for real-time signals.
*/
task->pending.signal.sig[0] & 0x7fffffffUL,
task->blocked.sig[0] & 0x7fffffffUL,
sigign .sig[0] & 0x7fffffffUL,
sigcatch .sig[0] & 0x7fffffffUL,
wchan,
0UL,
0UL,
task->exit_signal,
task_cpu(task),
task->rt_priority,
task->policy);

If you're making your own program to decipher /proc entries, you should definitely check out libproc (a part of the procps package, source code at http://rlove.org/procps/). If there is something you can use, you might achieve compatibility across major kernel versions with just keeping libproc up to date, if I'm not mistaken.
MK
K.C. Chan
Trusted Contributor

Re: docs on proc table

k, i got that infor. But not what is jiffie; according to the man page it is 1/100th of a second. Should I divide the stime by 1/100th of a second to get the result in second? Thanks.
Reputation of a thousand years can be determined by the conduct of an hour