Try /usr/bin/time foo
to get that for the command "foo". You can also use the various built-in "time" commands from various shells; I like to use the standardized /usr/bin/time
instead, so I always get the same output.
You can also keep track of this from within a running program. For example in python, the os.times() function returns it (see the documentation). There are ways to do this in other languages too, and I'm too lazy this evening to look them up. Google is your friend.