LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to test a run-time of a C program (https://www.linuxquestions.org/questions/programming-9/how-to-test-a-run-time-of-a-c-program-490216/)

frankie_DJ 10-07-2006 12:38 AM

How to test a run-time of a C program
 
Hi everyone,

I have two little programs I wrote in C. They both do the same thing but the code is different. How would I go about testing which runs faster?

IBall 10-07-2006 01:26 AM

Try the "time" program. This is probably only useful if your program does not require user input though.

Code:

time ./a.out
and compare the times for each run.
--Ian

primo 10-07-2006 04:03 AM

There's time(1) and the shell builtins "time" and "times". Use "help time" and "help times" to see their descriptions.


All times are GMT -5. The time now is 05:19 PM.