3

I am running a command on my OS which outputs thousands of lines, sometimes delaying in the middle for a couple of seconds, before restarting. Is there a way to find the time elapsed, in ms, between these lines of outputs?

A time stamp would work but I would prefer to output the time differences to a file.

3

If you have homebrew, install moreutils to get the ts command, which can add incremental timestamps to input:

$ (echo foo; sleep 0.1; echo bar; sleep 0.2; echo foo) | ts -i '%.s'
0.000013 foo
0.077336 bar
0.210087 foo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.