I’m a bit confused by a profiler printout. Please could someone enligthen
me? Unfortunately I did not find documentation that ultimately clarified
this. I have a simple test (see attachment) which essentially does three
loops calling three different methods. When run with ruby -r profile I
get these results
self seconds(m) * 100 / sum(self seconds) = %(m)
self seconds(m) / calls(m) = self ms per call(m)
What bugs me is that “cumulative seconds” of Fixnum#times is the same as
“self seconds”. I’d think that cumulative should differ since the blocks
are called from the body of times. In this case I’d expect something like
4,89099 seconds for cumulative of Fixnum#times.
I think that ‘self seconds’ and ‘cumulative seconds’ are equal for
the first item in the list because before that (not shown) ‘cumulative seconds’
is equal to zero. Adding 1.07 to 1.65 yields 2.72, the value for
‘cumulative seconds’ on the second line.
···
On Tuesday, 22 April 2003 at 18:12:34 +0900, Robert Klemme wrote:
What bugs me is that “cumulative seconds” of Fixnum#times is the same as
“self seconds”. I’d think that cumulative should differ since the blocks
are called from the body of times. In this case I’d expect something like
4,89099 seconds for cumulative of Fixnum#times.
–
Jim Freeze
There is nothing wrong with Southern California that a rise in the
ocean level wouldn’t cure.
– Ross MacDonald
What bugs me is that “cumulative seconds” of Fixnum#times is the same
as
“self seconds”. I’d think that cumulative should differ since the
blocks
are called from the body of times. In this case I’d expect something
like
4,89099 seconds for cumulative of Fixnum#times.
I think that ‘self seconds’ and ‘cumulative seconds’ are equal for
the first item in the list because before that (not shown) ‘cumulative
seconds’
is equal to zero. Adding 1.07 to 1.65 yields 2.72, the value for
‘cumulative seconds’ on the second line.
Ah, I see. So times from the third column are cumulated through the
printout list and not along the call chain - which is what I suspected.
Thanks a lot!
Regards
robert
···
On Tuesday, 22 April 2003 at 18:12:34 +0900, Robert Klemme wrote: