Re: comparing algorithm perf.
- From: HASM <not_really@xxxxxxxxxxx>
- Date: Fri, 14 Mar 2008 10:21:56 -0700
Thierry MARTIN <thierry-martin@xxxxxxxxxxx> writes:
I see two problems with "time (1)" solution:
1. You can only monitor a "full program", and I don't want initialisations
stuff to be taken into acount in my comparison. I want to compare two
equivalent loops that are part of two distinct programs.
Both algos may take different time to initialise, I don't care about it.
Loop around the section you want to time with calls to times(2) before and
after the loop. You may need to reinitialize the data that particular code
section uses.
#include <sys/times.h>
....
struct tms start, end;
....
times (&start);
<loop here over your code>
times (&end);
then
(end.tms_utime - start.tms_utime) / (double) loop_count
will give you user time, per iteration
(end.tms_stime - start.tms_stime) / (double) loop_count
will give you system time, on your behalf.
And cutime and cstime will do the same for all children processes.
-- HASM
.
- Follow-Ups:
- Re: comparing algorithm perf.
- From: Thierry MARTIN
- Re: comparing algorithm perf.
- References:
- comparing algorithm perf.
- From: Thierry MARTIN
- Re: comparing algorithm perf.
- From: Bernhard Agthe
- Re: comparing algorithm perf.
- From: Thierry MARTIN
- comparing algorithm perf.
- Prev by Date: Re: sending large buffers to wine applications
- Next by Date: Re: comparing algorithm perf.
- Previous by thread: Re: comparing algorithm perf.
- Next by thread: Re: comparing algorithm perf.
- Index(es):
Relevant Pages
|