Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cputime(2) [plan9 man page]

CPUTIME(2)							System Calls Manual							CPUTIME(2)

NAME
cputime, times - cpu time in this process and children SYNOPSIS
#include <u.h> #include <libc.h> int times(long t[4]) double cputime(void) DESCRIPTION
If t is non-null, times fills it in with the number of milliseconds spent in user code, system calls, child processes in user code, and child processes in system calls. Cputime returns the sum of those same times, converted to seconds. Times returns the real time, in mil- liseconds used by the process so far. These functions read /dev/cputime, opening that file when time is first called. SOURCE
/sys/src/libc/9sys SEE ALSO
cons(3) CPUTIME(2)

Check Out this Related Man Page

times(2)							   System Calls 							  times(2)

NAME
times - get process and child process times SYNOPSIS
#include <sys/times.h> #include <limits.h> clock_t times(struct tms *buffer); DESCRIPTION
The times() function fills the tms structure pointed to by buffer with time-accounting information. The tms structure, defined in <sys/times.h>, contains the following members: clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; All times are reported in clock ticks. The specific value for a clock tick is defined by the variable CLK_TCK, found in the header <lim- its.h>. The times of a terminated child process are included in the tms_cutime and tms_cstime members of the parent when wait(3C) or waitpid(3C) returns the process ID of this terminated child. If a child process has not waited for its children, their times will not be included in its times. The tms_utime member is the CPU time used while executing instructions in the user space of the calling process. The tms_stime member is the CPU time used by the system on behalf of the calling process. The tms_cutime member is the sum of the tms_utime and the tms_cutime of the child processes. The tms_cstime member is the sum of the tms_stime and the tms_cstime of the child processes. RETURN VALUES
Upon successful completion, times() returns the elapsed real time, in clock ticks, since an arbitrary point in the past (for example, sys- tem start-up time). This point does not change from one invocation of times() within the process to another. The return value may overflow the possible range of type clock_t. If times() fails, (clock_t)-1 is returned and errno is set to indicate the error. ERRORS
The times() function will fail if: EFAULT The buffer argument points to an illegal address. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
time(1), timex(1), exec(2), fork(2), time(2), waitid(2), wait(3C), waitpid(3C), attributes(5), standards(5) SunOS 5.11 14 May 1997 times(2)
Man Page

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo two command output in the same line

Hi, I try to write script and echo two command at the same line . echo "A" echo "B" How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ??? A B not A B Any sugggestion ??? (4 Replies)
Discussion started by: chuikingman
4 Replies

2. Shell Programming and Scripting

Measure thread execution (in C, unix)

Hi, I have a simulation program which creates two threads and I would like to know if I can measure the time of each individual thread. Threads communicate (I use pthread to manage them) and I want to measure communication time. I found a solution with clock_gettime and CLOCK_THREAD_CPUTIME_ID... (32 Replies)
Discussion started by: Tinkh
32 Replies

3. Shell Programming and Scripting

Checking CPU utilization by db2sysc process

Hi, I am trying to write a script which will fire alert mail to dba ( db2dba) when there process will utilize CPU more than 90%. But I am unable to do so. I am using following command to calucate CPU utilization be db2sysc process : ps -eo pcpu,pid,comm | grep -i db2sysc | awk '{ SUM+=$1;... (6 Replies)
Discussion started by: niteshtheone
6 Replies

4. Programming

calloc fails: 'Cannot allocate memory'

Hi , experts. I work on Linux station (RedHat 5.7), regular user, but have root password. %> uname -a Linux ran1log06 2.6.18-238.1.1.el5 #1 SMP Tue Jan 4 13:32:19 EST 2011 x86_64 x86_64 x86_64 GNU/Linux %> cat /etc/issue Red Hat Enterprise Linux Client release 5.7 (Tikanga) Kernel \r on... (5 Replies)
Discussion started by: baruchgu
5 Replies

5. UNIX for Dummies Questions & Answers

Calculate %Cpu

Hi. For an homework, I have to simulate some part of the PS function. By reading the doc I've been able to find most of it but I don't how I can get the %cpu for each PID. I've read on Internet that I have to do: (utime(t)-utim(t-1))/(cputime(t)-cputime(t-1)) where cputime is the sum of... (2 Replies)
Discussion started by: elnabo
2 Replies

6. Solaris

Oracle DB install failure

Hi all, I'm quite new to Solaris and I've been searching around everywhere to try and find the root of my Oracle DB install problem. It quits immediately when it runs isainfo when it gets a return of 3md64. To me this looks like there is a typo where ever isainfo pulls it's info from, but I... (13 Replies)
Discussion started by: asilv
13 Replies

7. UNIX for Advanced & Expert Users

Timeout procedure for using to much memory or cpu

How hard is it to create some kind of timeout procedure for using to much memory or cpu on a linux/unix server? What would you have to do to do this? (8 Replies)
Discussion started by: cokedude
8 Replies

8. Solaris

The old golden Question - Cpu load vs utilization

Hi all, Load = run queue, process utilizing cpu or waiting for cpu Cpu utilization = % of time that the cpu is busy. Naturally, I am thinking that if I have 1 cpu and my load=1 all the time, my CPU is 100% busy. Now I have 2 CPU thread running and doing prstat -Z, this is what I... (3 Replies)
Discussion started by: javanoob
3 Replies

9. Shell Programming and Scripting

Help with a script that involves processes

Hi everyone! I need to create a bash script that allows me to copy in a file named report_<date>_<time>.csv the list of active processes. <date> and <time> are the date and the time of the system when you create the file .csv How can I create that? I have no idea how to do it :confused: ... (6 Replies)
Discussion started by: Novia96
6 Replies

10. Shell Programming and Scripting

How to restart shell script when cpu is 0.0%?

Hello, My operating system is ubuntu 16.04. I need to kill or restart a shell script when cpu usage of related process is equal to 0.0% for X seconds. Appearing name on top page is vlc While surfing on forums, I found below script but not sure how to edit: Also don't know the function of -gt... (7 Replies)
Discussion started by: baris35
7 Replies