Reputation: 20076
I want to find just how long my program takes to run from start to finish in order to compare it with a past version.
How would I go about finding the time it takes for both of these versions? I'm running ubuntu 12.04LTS
Upvotes: 0
Views: 165
Reputation: 157967
Use the time
command:
time yourprogram
By default it will output something similar to this:
real 0m0.020s
user 0m0.004s
sys 0m0.000s
real
means the total time your program runs. user
means the time your program spent in user land code and sys
is the time your program spent in kernel calls.
Upvotes: 3
Reputation: 84
Linux comes with the 'time' program.
$time ./myapp
real 0m0.002s
user 0m0.000s
sys 0m0.000s
Upvotes: 1
Reputation: 3335
Run time myprogram
The time command will display all the details you need to know.
Example:
rh63-build(greg)~>time ls >/dev/null
real 0m0.003s
user 0m0.001s
sys 0m0.002s
Here is more about the time
command: http://linux.die.net/man/1/time
Upvotes: 1