http://www.cyberciti.biz/faq/linux-unix-summarize-detailed-system-resource-usage-with-time
How do I determine the system resource usage during of execution of a particular command on a Linux, OS X Unix, BSD and Unix-like operating system?
You need to use /usr/bin/time (hereinafter referred to as "time") command to find the system resource usage during of execution of a particular command. The following information can be obtained from the "time" command:
Sample outputs:
Let us run date command on OS X or FreeBSD Unix based system to find out the resources utilized by the date command during execution:
Sample outputs:
How do I determine the system resource usage during of execution of a particular command on a Linux, OS X Unix, BSD and Unix-like operating system?
You need to use /usr/bin/time (hereinafter referred to as "time") command to find the system resource usage during of execution of a particular command. The following information can be obtained from the "time" command:
- User time
- System time
- Percent of CPU this command got
- Elapsed time
- Average shared text size
- Average unshared data size
- Average stack size
- Average total size
- Maximum resident set size
- Average resident set size
- Major (requiring I/O) page faults
- Minor (reclaiming a frame) page faults
- Voluntary context switches
- Involuntary context switches
- Swaps
- File system inputs
- File system outputs
- Socket messages sent
- Socket messages received
- Signals delivered
- Page size (bytes)
- Exit status
/* taken from OSX/FreeBSD unix */ struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ long ru_maxrss; /* max resident set size */ long ru_ixrss; /* integral shared text memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages sent */ long ru_msgrcv; /* messages received */ long ru_nsignals; /* signals received */ long ru_nvcsw; /* voluntary context switches */ long ru_nivcsw; /* involuntary context switches */ };
Syntax
The syntax is as follows on Linux:/usr/bin/time -v command /usr/bin/time -v command arg1 arg2The syntax is as follows on FreeBSD or OS X unix:
/usr/bin/time -l command /usr/bin/time -l command arg1 arg2
Examples
Let us run host command on Linux to find out the resources utilized by the host command during execution:$ /usr/bin/time -v host www.cyberciti.biz
Sample outputs:
Let us run date command on OS X or FreeBSD Unix based system to find out the resources utilized by the date command during execution:
$ /usr/bin/time -l date
Sample outputs:
A note about "/usr/bin/time" and time command
- time is a shell command.
- /usr/bin/time is an external command and provides additional information such as the resources utilized by a particular command.
No comments:
Post a Comment