From: be-news06@lina.inka.de (Bernd Eckenfels)
To: linux-kernel@vger.kernel.org
Subject: Re: How to find the CPU usage of a process
Date: Sat, 18 Feb 2006 19:44:47 +0100 [thread overview]
Message-ID: <E1FAX4Z-0000zv-00@calista.inka.de> (raw)
In-Reply-To: <20060218174209.4376.qmail@web32607.mail.mud.yahoo.com>
Irfan Habib <irfanhab@yahoo.com> wrote:
> I wanted to ask how can I find the cpu usage of a
> process, as opposed to runtime, with cpu usage I mean
> actually how many time slices were awarded to a
> specific process
It is accounted in seconds in usermode and kernelmode (io processing), not
in slicess.
You can use the result wof wait3(2) if you are the parent:
/usr/bin/time -v sleep 3
Command being timed: "sleep 3"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 175
Voluntary context switches: 2
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
You could maybe also use BSD Job Accounting.
At runtime, the /proc interface is for you. See libproc for the data you can
query. /usr/include/proc/readroc.h:
utime, // stat user-mode CPU time accumulated by proces
stime, // stat kernel-mode CPU time accumulated by process
Gruss
Bernd
next prev parent reply other threads:[~2006-02-18 18:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-18 17:42 Irfan Habib
2006-02-18 18:44 ` Bernd Eckenfels [this message]
2006-02-18 18:55 ` Ulrich Drepper
2006-02-18 19:27 ` Bernd Eckenfels
2006-02-18 20:15 ` Ulrich Drepper
2006-02-18 17:42 Irfan Habib
2006-02-19 19:06 ` Chris Wedgwood
2006-02-20 0:42 ` Irfan Habib
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1FAX4Z-0000zv-00@calista.inka.de \
--to=be-news06@lina.inka.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®