help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tic toc


From: John Reed
Subject: tic toc
Date: Mon, 04 Jan 2010 15:27:00 -0800

Hello,

I've been getting some strange results using tic toc and cputime to get wall 
time and cputime for an operation using the find() function.

for example:

tic;
c=cputime();

 ind = find( T(:,1) >= -121.9 & ...
                          T(:,1) < -121.8 & ...         
                          T(:,2) >= 37 & ...
                         T_coord_search(:,2) < 37.1 );
 

t=toc;

c=cputime() - c;

fprintf("wall time was %e seconds \n",t);

fprintf("cputime was %e seconds \n",c);

Where T is a 409981 x 2 array of doubles.

sometimes the script returns about 0.016 seconds for both times which seems 
reasonable for this operation

on other occasions  for the exact same array and conditions the script returns 
a wall time of ~ 1e-8 seconds and cputime of 0 seconds which seems unreasonable 
(sometimes the wall time is even given as a negative number)

Am I using tic toc and cputime incorrectly?  Or is the time for find to operate 
really this widely variable?  Or could something be happening peculiar to my 
system that is causing tic and toc and cputime to malfunction?

Any thoughts or advice someone might have would be greatly appreciated.

Thanks,

John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]