10-07-2012
[Linux] How much time a process waited for CPU?
Hi,
Is it possible in Linux to find out how much time a process waited for CPU?
In Solaris we can see it in prstat.
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi,
i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies
2. UNIX for Advanced & Expert Users
Hi,
I have problem like everyday i have to check which process consuming more cpu time. I have done it manually using top command..
Is there any script which will tell the exact process name which will consuming more time. I am using hpux. (1 Reply)
Discussion started by: rajesh08
1 Replies
3. Shell Programming and Scripting
I thought a program's elapsed time, some program language call it real time, should be the time of a program from start to finish. And it should be equal or longer than CPU time. This is true for the most of the cases. However, I do see some of my programs CPU time is longer than Elapsed time. ... (1 Reply)
Discussion started by: visio2000
1 Replies
4. UNIX Desktop Questions & Answers
Hi i am a newbie thanks in advance
i have a process which keeps on running but doesn't use any CPU time and doesn't do the functionality which it is suppose to do .
If i kill the process and start the process again then the process kicks in and starts using CPU time and continues to do its... (3 Replies)
Discussion started by: nick1982
3 Replies
5. Solaris
We are using JAVA program and strange thing is it takes 100% CPU when not in use.
The program function is to stream a file on output port (one direction). It checks one directory and when there is a file in it, starts.
While it is streaming the CPU usage is normal, about 20%.
But, if... (9 Replies)
Discussion started by: orange47
9 Replies
6. Shell Programming and Scripting
Hi ,
I am trying to :wall: my head while scripting ..I am really new to this stuff , never did it before :( .
how to find cpu's system high time and user time high in a script??
thanks , help would be appreciated !
:) (9 Replies)
Discussion started by: sushwey
9 Replies
7. UNIX Desktop Questions & Answers
Hi,
I'm new to Linux.
I have a windows server that run many processes on it.
In some cases the processes doesn't exit properly or just stop working and the process needs to be killed.
I was wondering how i can automatically (couple of times a day) check which process doesn't use any CPU... (3 Replies)
Discussion started by: ramikom
3 Replies
8. Emergency UNIX and Linux Support
Can someone please help me with a script that will help in identifying the CPU & memory usage by a process name, rather than a process id.This is to primarily analyze the consumption of resources, for performance tweaking.
G (4 Replies)
Discussion started by: ggayathri
4 Replies
9. Shell Programming and Scripting
I am looking for a way to log and graphically display cpu and RAM usage of linux processes over time. Since I couldn't find a simple tool to so (I tried zabbix and munin but installation failed) I started writing a shell script to do so
The script file parses the output of top command through... (2 Replies)
Discussion started by: andy_dufresne
2 Replies
10. Shell Programming and Scripting
I wish to get the process start time on AiX and Linux using the same command / script.
I'm able to get the process start time in Linux using the below command:
cat /proc/<pid>/stat | grep Modify
The same does not work for AiX 6.1 systems.
Can you please let me know the command to get... (4 Replies)
Discussion started by: mohtashims
4 Replies
TIMES(2) Linux Programmer's Manual TIMES(2)
NAME
times - get process times
SYNOPSIS
#include <sys/times.h>
clock_t times(struct tms *buf);
DESCRIPTION
The times() function stores the current process times in the struct tms that buf points to. The struct tms is as defined in <sys/times.h>:
struct tms {
clock_t tms_utime; /* user time */
clock_t tms_stime; /* system time */
clock_t tms_cutime; /* user time of children */
clock_t tms_cstime; /* system time of children */
};
The tms_utime field contains the CPU time spent executing instructions of the calling process. The tms_stime field contains the CPU time
spent in the system while executing tasks on behalf of the calling process. The tms_cutime field contains the sum of the tms_utime and
tms_cutime values for all waited-for terminated children. The tms_cstime field contains the sum of the tms_stime and tms_cstime values for
all waited-for terminated children.
Times for terminated children (and their descendants) is added in at the moment wait(2) or waitpid(2) returns their process ID. In particu-
lar, times of grandchildren that the children did not wait for are never seen.
All times reported are in clock ticks.
RETURN VALUE
The function times returns the number of clock ticks that have elapsed since an arbitrary point in the past. For Linux this point is the
moment the system was booted. This return value may overflow the possible range of type clock_t. On error, (clock_t) -1 is returned, and
errno is set appropriately.
NOTES
The number of clock ticks per second can be obtained using
sysconf(_SC_CLK_TCK);
In POSIX-1996 the symbol CLK_TCK (defined in <time.h>) is mentioned as obsolescent. It is obsolete now.
On Linux, if the disposition of SIGCHLD is set to SIG_IGN then the times of terminated children are automatically included in the
tms_cstime and tms_cutime fields, although POSIX 1003.1-2001 says that this should only happen if the calling process wait()s on its chil-
dren.
Note that clock(3) returns values of type clock_t that are not measured in clock ticks but in CLOCKS_PER_SEC.
CONFORMING TO
SVr4, SVID, POSIX, X/OPEN, BSD 4.3
HISTORICAL NOTES
SVr1-3 returns long and the struct members are of type time_t although they store clock ticks, not seconds since the epoch. V7 used long
for the struct members, because it had no type time_t yet.
On older systems the number of clock ticks per second is given by the variable HZ.
SEE ALSO
time(1), getrusage(2), wait(2), clock(3), sysconf(3)
Linux 2002-06-14 TIMES(2)