Author: chialiang
Date: Tue Apr 21 19:38:58 2009
New Revision: 739
Modified:
trunk/NYTProf.xs
trunk/lib/Devel/NYTProf.pm
trunk/t/test51-enable.p
trunk/t/test51-enable.x
Log:
Make DB::enable_profile work after finish_profile is called.
Modified: trunk/NYTProf.xs
==============================================================================
--- trunk/NYTProf.xs (original)
+++ trunk/NYTProf.xs Tue Apr 21 19:38:58 2009
@@ -2393,11 +2393,6 @@
/* enable the run-time aspects to profiling */
int prev_is_profiling = is_profiling;
- if (!out) {
- warn("enable_profile: NYTProf not active");
- return 0;
- }
-
if (trace_level)
warn("NYTProf enable_profile (previously %s) to %s",
prev_is_profiling ? "enabled" : "disabled",
@@ -2407,6 +2402,9 @@
/* caller wants output to go to a new file */
close_output_file(aTHX);
strncpy(PROF_output_file, file, sizeof(PROF_output_file)-1);
+ }
+
+ if (!out) {
open_output_file(aTHX_ PROF_output_file);
}
Modified: trunk/lib/Devel/NYTProf.pm
==============================================================================
--- trunk/lib/Devel/NYTProf.pm (original)
+++ trunk/lib/Devel/NYTProf.pm Tue Apr 21 19:38:58 2009
@@ -423,7 +423,9 @@
You can finish profiling completely by calling DB::finish_profile().
This may be useful if perl is exiting abnormally, leaving the profile data
file
-in an incomplete state,
+in an incomplete state. You can use DB::enable_profile() after
+DB::finish_profile() to enable profiling again. If the filename is not
given,
+the current profile output file will be overwritten.
=head2 Multiple Output Files
Modified: trunk/t/test51-enable.p
==============================================================================
--- trunk/t/test51-enable.p (original)
+++ trunk/t/test51-enable.p Tue Apr 21 19:38:58 2009
@@ -9,7 +9,7 @@
# switch to new file and (re)enable profiling
DB::enable_profile("nytprof-test51-b.out");
foo();
-
+DB::finish_profile();
# switch to new file while already enabled
DB::enable_profile("nytprof-test51-c.out");
foo();
Modified: trunk/t/test51-enable.x
==============================================================================
--- trunk/t/test51-enable.x (original)
+++ trunk/t/test51-enable.x Tue Apr 21 19:38:58 2009
@@ -12,7 +12,7 @@
0,0,0,# switch to new file and (re)enable profiling
0,0,0,DB::enable_profile("nytprof-test51-b.out");
0,0,0,foo();
-0,0,0,
+0,0,0,DB::finish_profile();
0,0,0,# switch to new file while already enabled
0,0,0,DB::enable_profile("nytprof-test51-c.out");
0,0,0,foo();
--~--~---------~--~----~------------~-------~--~----~
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]
-~----------~----~----~----~------~----~------~--~---