Revision: 1275
Author: [email protected]
Date: Mon Jun 7 07:10:32 2010
Log: Add Devel::NYTProf::Util::trace_level function.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1275
Modified:
/trunk/NYTProf.xs
/trunk/lib/Devel/NYTProf/Util.pm
/trunk/t/30-util.t
=======================================
--- /trunk/NYTProf.xs Sun Jun 6 03:36:03 2010
+++ /trunk/NYTProf.xs Mon Jun 7 07:10:32 2010
@@ -4829,6 +4829,16 @@
} while (++constant < end);
newCONSTSUB(stash, "NYTP_ZLIB_VERSION", newSVpv(ZLIB_VERSION, 0));
}
+
+
+MODULE = Devel::NYTProf PACKAGE = Devel::NYTProf::Util
+
+PROTOTYPES: DISABLE
+
+void
+trace_level()
+ PPCODE:
+ XSRETURN_IV(trace_level);
MODULE = Devel::NYTProf PACKAGE = Devel::NYTProf::Test
@@ -4880,8 +4890,8 @@
PERL_UNUSED_VAR(items);
if (opt_use_db_sub)
DB_stmt(aTHX_ NULL, PL_op);
- else if (1||trace_level)
- logwarn("DB called needlessly\n");
+ else
+ logwarn("DB::DB called unexpectedly\n");
void
set_option(const char *opt, const char *value)
=======================================
--- /trunk/lib/Devel/NYTProf/Util.pm Sun May 30 01:30:17 2010
+++ /trunk/lib/Devel/NYTProf/Util.pm Mon Jun 7 07:10:32 2010
@@ -38,6 +38,7 @@
use Carp;
use Cwd qw(getcwd);
use List::Util qw(sum);
+use Devel::NYTProf::Core;
our $VERSION = '4.00';
@@ -51,6 +52,7 @@
get_alternation_regex
get_abs_paths_alternation_regex
html_safe_filename
+ trace_level
);
=======================================
--- /trunk/t/30-util.t Thu Oct 29 05:58:15 2009
+++ /trunk/t/30-util.t Mon Jun 7 07:10:32 2010
@@ -1,8 +1,9 @@
-use Test::More tests => 27;
+use Test::More tests => 28;
use Devel::NYTProf::Util qw(
fmt_time fmt_incl_excl_time
html_safe_filename
+ trace_level
);
my $us = "µs";
@@ -37,3 +38,6 @@
is html_safe_filename('C:\foo'), 'C-foo';
is html_safe_filename('<lots>of|
\'really\'special*"chars"?'), 'lots-of-really-special-chars';
is html_safe_filename('no.dots.please'), 'no-dots-please';
+
+my $trace_level = (($ENV{NYTPROF}||'') =~ m/\b trace=(\d+) /x) ? $1 : 0;
+is trace_level(), $trace_level, "trace_level $trace_level";
--
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]