Skip to contentSkip to conversation

about /proc/*/stat

DISCUSSION martin f krafft 2 participants 3 messages Nov 17, 2004

lore
Share & tools
lore
#0 lore raw

If I look at /proc/meminfo, I see each number prefixed with a short identifying name. Looking at /proc/*/stat, however, I have to count fields to get to the field I want. I realise that it's probably not possible to change the format of this file (since it's read by ps(1), among others), but I wonder if you have any tools that parse it, similar to /proc/meminfo -- i.e. primarily for debugging?

If not, I have a shell script that works well and which I would then publicise. I just don't want to push yet another software doing The Same Thing out there...

Signature · 8 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: [email protected]
 
"no, 'eureka' is greek for 'this bath is too hot.'"
                                                            -- dr. who
#1 lore raw
Quoted 6 lines

If I look at /proc/meminfo, I see each number prefixed with a short identifying name. Looking at /proc/*/stat, however, I have to count fields to get to the field I want. I realise that it's probably not possible to change the format of this file (since it's read by ps(1), among others), but I wonder if you have any tools that parse it, similar to /proc/meminfo -- i.e. primarily for debugging?

fscanf(fp, "%d %d %d ... ", &status, &anotherthing,....)

Jan Engelhardt

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
#2 lore raw
In reply to martin f krafft

also sprach martin f krafft <[email protected]> [2004.11.17.1028 +0100]:

Quoted 3 lines

If not, I have a shell script that works well and which I would then publicise. I just don't want to push yet another software doing The Same Thing out there...

FWIW: http://madduck.net/~madduck/scratch/pstat

Signature · 13 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: [email protected]
 
"he gave me his card
 he said, 'call me if they die'
 i shook his hand and said goodbye
 ran out to the street
 when a bowling ball came down the road
 and knocked me off my feet"
                                                        -- bob dylan