English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

hey, does anyone know how to time a program

say i have a program

and i run it

how do I measure the amount of time it took to run

thanks

2007-03-08 11:55:57 · 4 answers · asked by dragongml 3 in Computers & Internet Programming & Design

4 answers

Print or log the time it starts.
Print or log the time it ends.

Look at the output and subtract.

You can get fancy and have the software do the math for you, or you can get lazy and paste it into excel and let excel do the math.

2007-03-08 12:00:10 · answer #1 · answered by Meg W 5 · 0 0

If you are on a unix-operating system, use the time utility.

Look up the manual entry with "man time".

For example, to time how long it takes to execute the date command:

[503] danm: time date
Thu Mar 8 20:29:32 MST 2007

real 0m0.006s
user 0m0.001s
sys 0m0.005s

2007-03-08 22:31:28 · answer #2 · answered by Dan M 1 · 0 0

there is a function that returns the date and time from windows, that could be used,if you are coding, you can look up the number of instructions each line takes, and add it up(in windows, with a shared environment, that is the only true way to benchmark a single program, as windows can interupt and throw off the bench anytime.)

2007-03-08 20:13:12 · answer #3 · answered by shamus_jack 3 · 0 0

Get a stop watch and if you are running windows open the task manager and press start when the resources on your computer start being used till when it shows that it doesn't.

2007-03-08 20:04:21 · answer #4 · answered by Nick 2 · 0 0

fedest.com, questions and answers