Sponsored Content
Top Forums Shell Programming and Scripting time command usage in sh script Post 302109901 by cfajohnson on Thursday 8th of March 2007 10:29:38 PM
Old 03-08-2007
Quote:
Originally Posted by kris_search
how do i get the following type of information when we have a time command in sh script.

0.01user 0.00system 1:32.98elapsed 0%CPU (0avgtext+0avgdata 5360maxresident)k
0inputs+0outputs (342major+0minor)pagefaults 0swaps

I always see the following for the time command
real 0m0.000s
user 0m0.000s
sys 0m0.000s


Pls help me solving this mystery output.
The first version comes from an external time command (e.g., /usr/bin/time); the second is from your shell's built-in time command.
 

10 More Discussions You Might Find Interesting

1. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

2. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

3. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

4. Shell Programming and Scripting

usage of AWK command under perl script

i have two files as shown below t1.txt: argument1 argu2 argu37 t2.txt: 22 33 44 i want o/p as argument1 22 argu2 33 argu37 44 i am trying to merge two file under perl script using following system("paste t1.txt t2.txt | awk... (3 Replies)
Discussion started by: roopa
3 Replies

5. UNIX for Advanced & Expert Users

Find memory usage along with time

Hi Guys, I have a script. It calls an executable inside (programmed in C). I will have to find the execution time of that script and amount of memory consumed by that process as well. #!/bin/sh echo "Script starting" echo "executable staring" executable parm1 parm2 parm3 echo... (4 Replies)
Discussion started by: PikK45
4 Replies

6. AIX

Wait time shows high CPU usage

Hi, I can't seem to make sense of this. My wait time is showing really high but vmstat's and topas are showing normal usage. ps aux USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 9961810 5680.7 0.0 448 384 - A Dec 16 6703072:12 wait ... (2 Replies)
Discussion started by: techy1
2 Replies

7. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies

8. Shell Programming and Scripting

Storage usage over time

Hi every one, im kind new in scripting. i need to write a script that will collect my storage usage (df -k) like every hour and save the max amout and min amout into csv file so over time lest say one month we have the min/max values. Is it possible with awk command ? Any ideas are welcome.:) (4 Replies)
Discussion started by: venus699
4 Replies

9. Linux

Ps command on cpu usage and time

Hi All, Am very new to Linux and unix ...need below help . need to list of process consuming more than 40% cpu and which are older than 10 days of a particular user .... Thanks V (4 Replies)
Discussion started by: venky456
4 Replies

10. Shell Programming and Scripting

Help with speeding up my working script to take less time - how to use more CPU usage for a script

Hello experts, we have input files with 700K lines each (one generated for every hour). and we need to convert them as below and move them to another directory once. Sample INPUT:- # cat test1 1559205600000,8474,NormalizedPortInfo,PctDiscards,0.0,Interface,BG-CTA-AX1.test.com,Vl111... (7 Replies)
Discussion started by: prvnrk
7 Replies
time(1) 							   User Commands							   time(1)

NAME
time - time a simple command SYNOPSIS
time [-p] utility [argument...] DESCRIPTION
The time utility invokes utility operand with argument, and writes a message to standard error that lists timing statistics for utility. The message includes the following information: o The elapsed (real) time between invocation of utility and its termination. o The User CPU time, equivalent to the sum of the tms_utime and tms_cutime fields returned by the times(2) function for the process in which utility is executed. o The System CPU time, equivalent to the sum of the tms_stime and tms_cstime fields returned by the times() function for the process in which utility is executed. When time is used as part of a pipeline, the times reported are unspecified, except when it is the sole command within a grouping command in that pipeline. For example, the commands on the left are unspecified; those on the right report on utilities a and c, respectively: time a | b | c { time a } | b | c a | b | time c a | b | (time c) OPTIONS
The following option is supported: -p Writes the timing output to standard error in the following format: real %f user %f sys %f < real seconds>, <user seconds>, <system seconds> OPERANDS
The following operands are supported: utility The name of the utility that is to be invoked. argument Any string to be supplied as an argument when invoking utility. USAGE
The time utility returns exit status 127 if an error occurs so that applications can distinguish "failure to find a utility" from "invoked utility exited with an error indication." The value 127 was chosen because it is not commonly used for other meanings. Most utilities use small values for "normal error conditions" and the values above 128 can be confused with termination due to receipt of a signal. The value 126 was chosen in a similar manner to indicate that the utility could be found, but not invoked. EXAMPLES
Example 1: Using the time command It is frequently desirable to apply time to pipelines or lists of commands. This can be done by placing pipelines and command lists in a single file. This single file can then be invoked as a utility, and the time applies to everything in the file. Alternatively, the following command can be used to apply time to a complex command: example% time sh -c 'complex-command-line' Example 2: Using time in the csh shell The following two examples show the differences between the csh version of time and the version in /usr/bin/time. These examples assume that csh is the shell in use. example% time find / -name csh.1 -print /usr/share/man/man1/csh.1 95.0u 692.0s 1:17:52 16% 0+0k 0+0io 0pf+0w See csh(1) for an explanation of the format of time output. example% /usr/bin/time find / -name csh.1 -print /usr/share/man/man1/csh.1 real 1:23:31.5 user 1:33.2 sys 11:28.2 ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of time: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, LC_NUMERIC, NLSPATH, and PATH. EXIT STATUS
If utility is invoked, the exit status of time will be the exit status of utility. Otherwise, the time utility will exit with one of the following values: 1-125 An error occurred in the time utility. 126 utility was found but could not be invoked. 127 utility could not be found. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), shell_builtins(1), timex(1), times(2), attributes(5), environ( 5), standards(5) NOTES
When the time command is run on a multiprocessor machine, the total of the values printed for user and sys can exceed real. This is because on a multiprocessor machine it is possible to divide the task between the various processors. When the command being timed is interrupted, the timing values displayed may not always be accurate. BUGS
Elapsed time is accurate to the second, while the CPU times are measured to the 100th second. Thus the sum of the CPU times can be up to a second larger than the elapsed time. SunOS 5.10 1 Feb 1995 time(1)
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy