linux command

karunesh reddy
Occasional Contributor

linux command

red hat linux 7.2
1. how do i check total cpu time spent executing in user mode ,system mode and has been idle.
2. how do i know how many disk read/write request have been made?
Paul R. Dittrich
Esteemed Contributor

Re: linux command

1. "top" or "sar"

2. "sar -b"

benoit Bruckert
Honored Contributor

Re: linux command

You have got also vmstat

Une application mal pansée aboutit à une usine à gaze (GHG)
Raynald Boucher
Super Advisor

Re: linux command

I think you can use "pstat" but I personnally don't know how to use it properrly.

See `man pstat`.

Take care!
Ralph Grothe
Honored Contributor

Re: linux command


this again, as all the other info you requested in your other threads, is retrievable from /proc/stat

I won't do the parsing here as I trust you can do it yourself (use Perl, awk, sed, cut etc)

1) cpu times

grep for "cpu":

# grep cpu /proc/stat
cpu 150081 641 30293 34879317
cpu0 150081 641 30293 34879317

The numbers are 1/100th secs for cpu time spent in
user mode, low priority user mode, sys mode, idle time

2) disk I/O

grep for "disk_io":

# grep disk_io /proc/stat
disk_io: (8,0):(394375,242327,7461810,152048,7081216) (11,0):(5781,5781,1301464,

A full explanation can be found in "man proc".
The pair of numbers before the colons are the (major,minor) of the block devices.
# ll /dev/sda /dev/scd0
brw-rw---- 1 root disk 11, 0 Apr 11 16:25 /dev/scd0
brw-rw---- 1 root disk 8, 0 Apr 11 16:25 /dev/sda

As you can see the above dump refers to my 1st SCSI HD (8,0) and my CD writer (11,0)

The numbers following the colon are :
(total I/Os, read I/Os, blocks read, write I/Os, blocks written)

Madness, thy name is system administration