Author: tim.bunce
Date: Thu Apr 23 05:12:01 2009
New Revision: 743
Modified:
trunk/NYTProf.xs
trunk/lib/Devel/NYTProf.pm
Log:
Add comment outlining a possible implementation of recording sub caller sub
names.
Add note to Limitations section of docs that sub profiler doesn't record
calls to xsubs that exit via an exception.
Modified: trunk/NYTProf.xs
==============================================================================
--- trunk/NYTProf.xs (original)
+++ trunk/NYTProf.xs Thu Apr 23 05:12:01 2009
@@ -2276,9 +2276,19 @@
: get_file_id(aTHX_ file, strlen(file), NYTP_FIDf_VIA_SUB);
fid_line_key_len = sprintf(fid_line_key, "%u:%d", fid, line);
- /* { subname => { "fid:line" => [ count, incl_time ] } } */
+ /* { called_subname => { "fid:line" => [ count, incl_time ] } } */
sv_tmp = *hv_fetch(sub_callers_hv, subname_pv,
(I32)SvCUR(subname_sv), 1);
+
+ /* XXX fid:line can be ambiguous, e.g sub foo { return sub { ... }
}
+ * We could add subname_sv to the [ count, incl_time ] array
+ * and check it on each call. To improve performance we could also
+ * add the op and so avoid the string compare if the op's are the
same.
+ * If there's a call with a different subname_sv value, then we
+ * could interpose a hash to hold per-subname values:
+ * old => { "fid:line" => [ count, incl_time, "sub1"
] }
+ * new => { "fid:line" => { "sub1"=>[ count, incl_time
], "sub2"=>[...] } }
+ */
if (!SvROK(sv_tmp)) { /* autoviv hash ref - is first call of this
subname from anywhere */
HV *hv = newHV();
Modified: trunk/lib/Devel/NYTProf.pm
==============================================================================
--- trunk/lib/Devel/NYTProf.pm (original)
+++ trunk/lib/Devel/NYTProf.pm Thu Apr 23 05:12:01 2009
@@ -608,6 +608,10 @@
The C<goto &foo;> isn't recognised as a subroutine call by the subroutine
profiler.
+=head2 Calls to XSubs which exit via an exception
+
+Calls to XSubs which exit via an exception are not recorded by subroutine
profiler.
+
=head2 #line directives
The reporting code currently doesn't handle #line directives, but at least
it
--~--~---------~--~----~------------~-------~--~----~
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]
-~----------~----~----~----~------~----~------~--~---