Revision: 1029
Author: tim.bunce
Date: Thu Jan 21 04:42:23 2010
Log: Sub profiler doesn't consider usecputime so shoudn't use ticks_per_sec.
Note the limitation in the docs. (Not worth fixing till clocks get
abstracted.)
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1029
Modified:
/trunk/Changes
/trunk/NYTProf.xs
/trunk/lib/Devel/NYTProf/Run.pm
/trunk/lib/Devel/NYTProf.pm
=======================================
--- /trunk/Changes Thu Jan 21 04:07:11 2010
+++ /trunk/Changes Thu Jan 21 04:42:23 2010
@@ -18,12 +18,13 @@
XXX Fixed one problem with usecputime=1 option but results are *10 on my
mac.
XXX Needs tests.
- Fixed handling of usecputime=1 option
+ Fixed handling of usecputime=1 option but updated
+ docs to note the significant limitations.
Fixed handling of assignment of XS subs to files
in some edge cases thanks to Nicholas Clark.
Added high-resolution (100ns) timer for Mac OS X
- thanks to Markus Peter.
+ many thanks to Markus Peter.
Added assorted optimizations thanks to Nicholas Clark.
Changed subroutine profiler to be slightly more efficient.
=======================================
--- /trunk/NYTProf.xs Thu Jan 21 04:19:09 2010
+++ /trunk/NYTProf.xs Thu Jan 21 04:42:23 2010
@@ -1852,9 +1852,9 @@
get_time_of_day(sub_end_time);
get_ticks_between(subr_entry->initial_call_time, sub_end_time,
ticks, overflow);
- incl_subr_sec = overflow + (ticks / (NV)ticks_per_sec);
+ incl_subr_sec = overflow + (ticks / (NV)CLOCKS_PER_TICK);
/* subtract statement measurement overheads */
- incl_subr_sec -= (overhead_ticks / ticks_per_sec);
+ incl_subr_sec -= (overhead_ticks / CLOCKS_PER_TICK);
/* exclusive = inclusive - time spent in subroutines called by
this subroutine */
excl_subr_sec = incl_subr_sec - called_sub_secs;
}
=======================================
--- /trunk/lib/Devel/NYTProf/Run.pm Thu Dec 10 03:05:52 2009
+++ /trunk/lib/Devel/NYTProf/Run.pm Thu Jan 21 04:42:23 2010
@@ -69,6 +69,11 @@
else {
croak "Neither src_file or src_code was provided";
}
+
+ # undocumented hack that's handy for testing
+ if ($opt{htmlopen}) {
+ warn system("nytprofhtml --open --file='$out_file'");
+ }
my $profile = Devel::NYTProf::Data->new( { filename => $out_file } );
=======================================
--- /trunk/lib/Devel/NYTProf.pm Tue Jan 5 09:39:16 2010
+++ /trunk/lib/Devel/NYTProf.pm Thu Jan 21 04:42:23 2010
@@ -427,7 +427,7 @@
=head2 usecputime=1
Measure user CPU + system CPU time instead of the real elapsed 'wall clock'
-time (which is the default).
+time (which is the default). This currently only applies to the statement
profiler.
Measuring CPU time has the advantage of making the measurements
independent of
time spent blocked waiting for the cpu or network i/o etc. But it also has
the
@@ -439,7 +439,8 @@
have to run the code for many hours to have any hope of reasonably useful
results.
A better alternative would be to use the C<clock=N> option to select a
-high-resolution cpu time clock, if available on your system.
+high-resolution cpu time clock, if available on your system, because
that'll
+give you higher resolution and work for the subroutine profiler as well.
=head2 file=...
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]