Re: clock time in milliseconds into a c program

2005-01-21 Thread Marco Trentini
On Wed, Jan 19, 2005 at 08:12:13PM -0600, Ryan Sommers wrote: > Marco Trentini wrote: > >Hi, I need to clock the function execution time into a C > >program. I know /usr/include/time.h library but I need to > >clock the time in milliseconds. > > > >Any suggestions, links? > > > > Are you looking f

Re: clock time in milliseconds into a c program

2005-01-21 Thread art yerkes
Remember to calibrate RDTSC against the RTC first if you're using it in production. It's quite accurate but some mobile CPUs count in coarser units than you'd predict from master clock rate. -- Here's a simple experiment. Stand on a train track between two locomotives which are pushing on you wit

Re: clock time in milliseconds into a c program

2005-01-21 Thread Alin-Adrian Anton
Claudiu Dragalina-Paraipan wrote: Or you can use PERFMON. Check manual page for perfmon. It gives you access to internal counters of CPU. Of course this is a subjective measurement, since, AFAIK, the counters are not kept separately for every process, but for entire system, including kernel. Maybe

Re: clock time in milliseconds into a c program

2005-01-21 Thread Alin-Adrian Anton
Erich Dollansky wrote: Hi, Alin-Adrian Anton wrote: For this snippet (which deals with a B+tree) i got results of the form 0.3445866564 microseconds, which means 344.5867 miliseconds.. etc.. You mixed the units up 1 second is 1 000 ms which is 1 000 000 µs which is 1 000 000 000 ns. Yes I noticed

Re: clock time in milliseconds into a c program

2005-01-21 Thread Claudiu Dragalina-Paraipan
Or you can use PERFMON. Check manual page for perfmon. It gives you access to internal counters of CPU. Of course this is a subjective measurement, since, AFAIK, the counters are not kept separately for every process, but for entire system, including kernel. Maybe repeating the same measurement fo

Re: clock time in milliseconds into a c program

2005-01-20 Thread Joseph Koshy
> I don't think there is a streight way to speed-up the default > unix time resolution, which is, as far as i know, in > microseconds. On i386 (and possibly amd64) platforms you can use the RDTSC instruction to get a direct measure of processor cycles elapsed. -- FreeBSD Volunteer, http://peop

Re: clock time in milliseconds into a c program

2005-01-20 Thread Erich Dollansky
Hi, Alin-Adrian Anton wrote: For this snippet (which deals with a B+tree) i got results of the form 0.3445866564 microseconds, which means 344.5867 miliseconds.. etc.. You mixed the units up 1 second is 1 000 ms which is 1 000 000 µs which is 1 000 000 000 ns. Erich __

Re: clock time in milliseconds into a c program

2005-01-20 Thread Alin-Adrian Anton
Marco Trentini wrote: Hi, I need to clock the function execution time into a C program. I know /usr/include/time.h library but I need to clock the time in milliseconds. Any suggestions, links? ---snip--- #include struct timeval tv1,tv2; struct timezone tz1,tz2; gettimeofday(&tv1,&tz1); for (i=0;i<

Re: clock time in milliseconds into a c program

2005-01-19 Thread Ryan Sommers
Marco Trentini wrote: Hi, I need to clock the function execution time into a C program. I know /usr/include/time.h library but I need to clock the time in milliseconds. Any suggestions, links? Are you looking for how long the processor spent executing your code? Or the difference in wall time betw

Re: clock time in milliseconds into a c program

2005-01-19 Thread Daniel O'Connor
On Thu, 20 Jan 2005 11:14, Marco Trentini wrote: > Hi, I need to clock the function execution time into a C > program. I know /usr/include/time.h library but I need to > clock the time in milliseconds. How about.. struct timeval then, now; gettimeofday(&then, NULL); somefunction(); gettimeofday(&

Re: clock time in milliseconds into a c program

2005-01-19 Thread Steve Watt
In article <[EMAIL PROTECTED]> you write: > >Hi, I need to clock the function execution time into a C >program. I know /usr/include/time.h library but I need to >clock the time in milliseconds. > >Any suggestions, links? % man clock_gettime Is nanoseconds too much? -- Steve Watt KD6GGD PP-ASEL