Click here to Skip to main content
15,889,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get the time taken to execute the program ,
Using Clock() I tried but its giving in second , which is 0 for small program .
So anyone knows how to get time in millisecond or micro second ?

Then I want to run the same program in multi core system and again wanna measure the time.....

I am using ubuntu...

Thanks .
Posted
Updated 18-Jan-11 1:25am
v2

you can use the time command on Unix based systems or subsystems:
time echo "Hello world"

to time how long it takes to run echo "Hello world"
It has millisecond precision, and shows how much time was spent in the program, waiting on the system and the total execution time
 
Share this answer
 
See clock_gettime[^] man page.
:)
 
Share this answer
 
Microsecond and Millisecond .NET Timer[^] article will give you an idea.
 
Share this answer
 
Comments
Dylan Morley 18-Jan-11 7:32am    
Doesn't want .Net though...
CPallini 18-Jan-11 7:50am    
Did you see the C, Linux tags?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900