You are not logged in.

#1 2012-01-19 18:12:42

kdar
Member
From: Sweet home Alabama!
Registered: 2009-06-27
Posts: 356

What can be used for performance measurements of a single command?

What can I use to do performance measurement of a single command execution in terminal?

At the moment I am aware of something as "perf stat"
For example: perf stat gzip File.pdf

But is there anything else useful for this?

Last edited by kdar (2012-01-19 18:15:14)

Offline

#2 2012-01-19 18:24:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,326

Re: What can be used for performance measurements of a single command?

What performance?

execution time:  time ls -l  will tell you how long the ls process took.
system calls: strace ls-l will tell you about all the library calls ls used.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2012-01-19 18:32:11

kdar
Member
From: Sweet home Alabama!
Registered: 2009-06-27
Posts: 356

Re: What can be used for performance measurements of a single command?

Well, anything really. For example memory usage.

strace could be useful, I didn't know about it before, thanks.

For example I would like to know how much memory is used by something like : gzip file.pdf

Last edited by kdar (2012-01-19 20:40:38)

Offline

#4 2012-01-26 20:25:14

theunknown
Member
Registered: 2012-01-04
Posts: 2

Re: What can be used for performance measurements of a single command?

time can also show the memory usage and some other things using format strings.
Example: time -f "%M" gzip file.pdf (Shows maximum resident set size of the process during its lifetime, in Kbytes.)
All of them are described in the man page.

Offline

#5 2012-01-26 20:52:02

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: What can be used for performance measurements of a single command?

theunknown wrote:

time can also show the memory usage and some other things using format strings.
Example: time -f "%M" gzip file.pdf (Shows maximum resident set size of the process during its lifetime, in Kbytes.)
All of them are described in the man page.

Apparently all that only applies to the standalone version of time which is not installed by default:

$ time -f "%M" <whatever>
bash: -f: command not found

real	0m0.001s
user	0m0.000s
sys	0m0.000s

$ which time
which: no time in ...

$ pkgfile -s time
extra/irssi
extra/time
community/calc
community/epic4
community/plan9port

$ pkgfile -l time
...
time /usr/bin/time
...

Last edited by alphaniner (2012-01-26 20:55:44)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB