>> profile report Total time in "/usr/local/matlab/toolbox/matlab/elmat/hilb.m": 0.13 seconds
100% of the total time was spent on lines: [23 21 20 22]
19: J = 1:n; 0.02s, 15% 20: J = J(ones(n,1),:); 0.03s, 23% 21: I = J'; 0.01s, 8% 22: E = ones(n,n); 0.07s, 54% 23: H = E./(I+J-1);
>> profile done >> cputime
>> H=hilb(400); >> cputime
I did the first hilb call to ensure that the routine was already interpreted, so there should be no overhead lost there. Neither is the extra CPU time lost in doing the profiling, as the last call without profiling shows.
If the profiler can't account for all the time in a simple five line function like hilb, can we be sure that it has the ratios of time correct?
Is this perhaps rounding error resulting from counting in lots of 0.01 seconds?
I first noticed this when profiling a routine which takes around 210 seconds, and being told by profile that it could only account for 70 seconds.
This is on an SGI O2, running MATLAB Version 126.96.36.1991 on SGI.
-- Tristram Scott, Dept of Management| E-Mail: email@example.com University of Canterbury | Web: http://www.mang.canterbury.ac.nz Christchurch, New Zealand | Ph 643 364-2987 x 8617 Fax 643 364-2020