I suspect that you’ll find perf timechart very useful. By default it records CPU and process state, and draws a chart showing how that state changes over time:
This shows the CPU occupation at the top, and processes underneath — blue means “running”, yellow means the process is waiting for a CPU, red means the process is blocked on I/O, gray means the ...
Not sure exactly.. but looks like you might need strace ...
Here, say if I have a process with process id 1055 then doing something like this :
neo $ sudo strace -w -c -p1055
strace: Process 1055 attached
^Cstrace: Process 1055 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ---...
I'm not entirely sure if this is what you are asking but this is similar to /usr/bin/time and only measures the wall clock:
echo "$(($end - $start)) nanoseconds elapsed"
Save it to wallclock and run it for example with
$ ./wallclock sleep 1
1006622540 nanoseconds elapsed