What I am looking for is something along the lines of /usr/bin/time
, however, this usually does not have enough precision.
I am running a C program (that I can edit and recompile) and I need to monitor User/System/Real time, processor usage, peak memory, etc.
However, the normal runtime is beyond the precision of the time
command. time
gives you millisecond precision, however, nanosecond precision is preferred. Tenth of a milisecond may work, but I digress.
What I have now is a simple bash script that records the start time in nanoseconds, runs the program, and then records the end time in nanoseconds and then reports the difference. This is great for Real (wall clock) time, but not so good for execution time because this is a multiuser machine.
Notes: I am restricted to Bash as a shell; the machine is running CentOS 6.4; I am open to solutions in C that don't require the installation of any new software.
times
function. Then I can just use/usr/bin/time
for the memory stats. Not ideal, but definitely the best I have to work with so far. Not having sudo can really tie your hands :/