UNIX time command implementation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX time command implementation
# 1  
Old 11-14-2013
UNIX time command implementation

I want to know about the time command flow of execution.

I have a doubt in the time calculation for the command execution.

Whether the real time is sum of (time taken to open the unix window + execute the command given infront of the "time" command + close the unix window)
or Just the time taken for executing the same command in the same window.

Moderator's Comments:
Mod Comment Please do not request an email response. No one else will ever be able to search on any answers


Please help Me in this regard.

Regards
Sateesh Solapur

Last edited by jim mcnamara; 11-14-2013 at 08:00 AM..
# 2  
Old 11-14-2013
The implementation of time may be OS depdendent. But the basic operation is similar on all platforms.

1. Create the command + arguments as a child process
2. wait until the child process completes
3. Call getrusage() for all of the children and display the time consumed - systems are not required to call getrusage(). They may use a feature like the /proc filesystem.

The wall time is how long it took the child (plus its children if any) to complete.
The "sys" component is the sum of kernel time for children.
The "user" component is the sum of user mode execution time for children.

Wall time does not usually add up to sys + user for longer running processes. Why? I/O disk waits, cpu waits, and multiple threads/children all subtract or add to wall time relative to sys + user.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command timed out implementation

I have a running service which runs in background. It execute shell commands by function system(cmd) I need to report fail when command execution takes more than 60 seconds. Parent doesn't need to wait for 60 seconds of time if the cmd execution completed already. runCommand() { pid_t... (3 Replies)
Discussion started by: techmonk
3 Replies

2. Shell Programming and Scripting

First Time need help on UNIX Command

Hello All I have request below. Please Help Below is the input. mrkInternetMedicalSpecialtyAlt=<order>0</order> <code>PED</code> Need Output as below mrkInternetMedicalSpecialtyAlt=<order>0</order><code>PED</code> Value "PED" is not always same. Please use correct CODE tags... (6 Replies)
Discussion started by: srilu
6 Replies

3. UNIX for Dummies Questions & Answers

Finding implementation code in UNIX for FAT16/32

So we know that Unix is free source software. And we know that Unix have support for FAT 16 and FAT 32. Does anyone know where can I found that implementation in code ? Thank you. (2 Replies)
Discussion started by: medolina
2 Replies

4. Linux

Shell implementation - Command not found

Hi, I am trying to execute a program with pipes to run a few basic commands by forking children. When I try to run commands in the child process without pipe, I am unable to run the command as execv fails. However for commands that are given with pipes execute successfully. for example:... (1 Reply)
Discussion started by: mmurali2
1 Replies

5. Shell Programming and Scripting

Changing the format of the unix time command

Hello. I use time in order to calculate the execution time of a program. The output format is: real 0m0.059s user 0m0.028s sys 0m0.004s Is there a simple and elegant way to add user and sys together, and convert to milliseconds? Thanks a lot! (4 Replies)
Discussion started by: dynelight
4 Replies

6. UNIX for Dummies Questions & Answers

Hash Table like implementation in unix

Hi all, I just downloaded this example from the net. I was looking around for a hash table like implementation in unix when I came across this. ARRAY=( "cow:moo" "dinosaur:roar" "bird:chirp" "bash:rock" ) for animal in ${ARRAY} ; do KEY=${animal%%:*} ... (8 Replies)
Discussion started by: anindyabecs
8 Replies

7. UNIX for Advanced & Expert Users

To find the time of excution of a particular unix command

Hi experts, It would be grateful if you can guide me on the following, 1.How to find the time of excution of a particular unix command. 2. How to find the terminal (IP Address) from where that particular unix command was excuted. 3. How to find the user who executed that particular unix... (1 Reply)
Discussion started by: apsprabhu
1 Replies

8. UNIX for Advanced & Expert Users

implementation of copy command in parallel

hey i have to implement copy command in parallel in c language. i dont know how to create a new directory in destination. if anything u know related to this help me (1 Reply)
Discussion started by: rajsekhar28
1 Replies

9. UNIX for Advanced & Expert Users

Implementation of ls - i command

It is possible for me to obtain the Inode of the path name using ls -i <pathname> command Can anyone tell me how its implemented... (3 Replies)
Discussion started by: ganapathy.psgit
3 Replies

10. UNIX for Advanced & Expert Users

implementation of pim and mospf protocole in unix

hello is there any implementation of msopf and pim protocoles in unix? :confused: (1 Reply)
Discussion started by: jalil smail
1 Replies
Login or Register to Ask a Question