Unix Programming - process accounting

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2006 > process accounting





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author process accounting
varma.iitb@gmail.com

2006-02-23, 2:54 am

I have a small doubt regarding process times. I am reading process
information from /proc file system. There are utime, stime, cutime and
cstime. To get the total process time do i have to add utime, stime
(utime+stime) or i have to add all 4 (utime+stime+cutime+cstime).

Suppose process A spawns a new process B, assume both are running now,
if I read times of both processes. Is process B time included in
process A or not.

And,

I switched on process accounting using acct system call. Now process A
is started and after some time it spawns process B, now both are
running. after some time both processes exited. So process records
corresponding to A & B will be written to accounting file. When I read
utime, stime of A & B , will B times are included in A or not.

Thanks

loic-dev@gmx.net

2006-02-26, 10:16 am

Hello,

> I have a small doubt regarding process times. I am reading process
> information from /proc file system. There are utime, stime, cutime and
> cstime. To get the total process time do i have to add utime, stime
> (utime+stime) or i have to add all 4 (utime+stime+cutime+cstime).


utime = time spent so far in user space by the process
stime = time spent so far in kernel space by the process
cutime = time spent in user space by the terminated child processes
cstime = time spent in kernel space by the terminated child processes.

The answer to your questions follow from the above definitions.

Cheers,
Loic.

varma.iitb@gmail.com

2006-02-26, 10:16 am


loic-dev@gmx.net wrote:
> Hello,
>
>
> utime = time spent so far in user space by the process
> stime = time spent so far in kernel space by the process
> cutime = time spent in user space by the terminated child processes
> cstime = time spent in kernel space by the terminated child processes.
> The answer to your questions follow from the above definitions.


Thanks. I have a doubt. Actually when I read process times from /proc
filesystem as well as using "acct" system call, I am getting process
times in jiffies. Is jiffies is the smaller unit of measurement in
linux, it's not right?.
I have written a program with times function at start and end of the
program. I started process accounting on using acct. and I executed my
program, it displays process times in clock_t (big numbers). And I
turned process accounting off. I read accounting file. The process
times are (utime and stime) zero jiffies. But here we are losing the
actual time.

I have seen kernel source. It actually converting clock_t to jiffies.
How can I get clock_t value.


>
> Cheers,
> Loic.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com