Revision: 1013
Author: tim.bunce
Date: Mon Jan 11 13:25:54 2010
Log: Fixed handling of usecputime=1 option.
(Fixed one problem but results are *10 on my mac. Still needs tests.)

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1013

Modified:
 /trunk/Changes
 /trunk/NYTProf.xs

=======================================
--- /trunk/Changes      Wed Jan  6 13:44:43 2010
+++ /trunk/Changes      Mon Jan 11 13:25:54 2010
@@ -15,6 +15,11 @@

 =head2 Changes in Devel::NYTProf 3.02

+  Fixed handling of usecputime=1 option
+
+XXX Fixed one problem but results are *10 on my mac.
+XXX Needs tests.
+
   Added high-resolution (100ns) timer for Mac OS X
     thanks to Markus Peter.

=======================================
--- /trunk/NYTProf.xs   Wed Jan  6 13:44:43 2010
+++ /trunk/NYTProf.xs   Mon Jan 11 13:25:54 2010
@@ -1421,14 +1421,15 @@

     if (usecputime) {
         times(&start_ctime);
+        /* insufficient accuracy for cumulative_overhead_ticks */
     }
     else {
         get_time_of_day(start_time);
-    }
-
-    /* measure time we've spent measuring so we can discount it */
-    get_ticks_between(end_time, start_time, elapsed, overflow);
-    cumulative_overhead_ticks += elapsed;
+
+        /* measure time we've spent measuring so we can discount it */
+        get_ticks_between(end_time, start_time, elapsed, overflow);
+        cumulative_overhead_ticks += elapsed;
+    }

     SETERRNO(saved_errno, 0);
     return;
@@ -2644,7 +2645,12 @@
         sv_setiv(PL_DBsingle, 1);

     /* discard time spent since profiler was disabled */
-    get_time_of_day(start_time);
+    if (usecputime) {
+        times(&start_ctime);
+    }
+    else {
+        get_time_of_day(start_time);
+    }

     return prev_is_profiling;
 }
-- 
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]

Reply via email to