I would like to run a process from
bash in Cygwin so that I have some short summary after execution like peak memory usage or average CPU usage, like
time but with more information.
Are there any options?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can do this by running the command inside GNU
time. By default, time shows you the
user(CPU-seconds used in user mode), and
sys(CPU-seconds used in kernel mode) data items. However, you can also ask it to measure other things, such as RAM and disk usage:
/usr/bin/time -f "File system outputs: %O\nMaximum RSS size: %M\nCPU percentage used: %P" <command>
<command>is replaced by the command you wish to run. The output will be something like:
File system outputs: 18992 Maximum RSS size: 40056 CPU percentage used: 367%
where "CPU percentage used" is a percentage and shows here that 3.6 cores were used, "Maximum RSS size" is as close as it gets to "maximum memory used" and is expressed in kilobytes, and "File system outputs" is expressed in number of operations (i.e., it does not say how much data is written). The
dfcommands you gave should help there.
Note: you need to use
/usr/bin/timerather than just
time, as many shells have that as a builtin, which doesn't necessarily support the
For more information, see
Same goes for Cygwin: there is a bash built-in which can be substituted by GNU time.