Author: tim.bunce
Date: Wed Jan 28 13:57:06 2009
New Revision: 677
Modified:
trunk/NYTProf.xs
trunk/lib/Devel/NYTProf/Data.pm
Log:
Use NYTP_SIi_* constants.
Remove s/(eval \d+)/(eval 0)/g logic from perl code now it's done in C.
Modified: trunk/NYTProf.xs
==============================================================================
--- trunk/NYTProf.xs (original)
+++ trunk/NYTProf.xs Wed Jan 28 13:57:06 2009
@@ -3416,21 +3416,17 @@
}
/* accumulate per-sub totals into subinfo */
- /* sub call count */
- sv = *av_fetch(subinfo_av, 3, 1);
+ sv = *av_fetch(subinfo_av, NYTP_SIi_CALL_COUNT, 1);
sv_setuv(sv, count + (SvOK(sv) ? SvUV(sv) : 0));
- /* sub incl_time */
- sv = *av_fetch(subinfo_av, 4, 1);
+ sv = *av_fetch(subinfo_av, NYTP_SIi_INCL_RTIME, 1);
sv_setnv(sv, incl_time + (SvOK(sv) ? SvNV(sv) : 0.0));
- /* sub excl_time */
- sv = *av_fetch(subinfo_av, 5, 1);
+ sv = *av_fetch(subinfo_av, NYTP_SIi_EXCL_RTIME, 1);
sv_setnv(sv, excl_time + (SvOK(sv) ? SvNV(sv) : 0.0));
/* sub rec_depth - record the maximum */
- sv = *av_fetch(subinfo_av, 8, 1);
+ sv = *av_fetch(subinfo_av, NYTP_SIi_REC_DEPTH, 1);
if (!SvOK(sv) || rec_depth > SvUV(sv))
sv_setuv(sv, rec_depth);
- /* sub reci_time */
- sv = *av_fetch(subinfo_av, 9, 1);
+ sv = *av_fetch(subinfo_av, NYTP_SIi_RECI_RTIME, 1);
sv_setnv(sv, reci_time + (SvOK(sv) ? SvNV(sv) : 0.0));
total_sub_calls += count;
Modified: trunk/lib/Devel/NYTProf/Data.pm
==============================================================================
--- trunk/lib/Devel/NYTProf/Data.pm (original)
+++ trunk/lib/Devel/NYTProf/Data.pm Wed Jan 28 13:57:06 2009
@@ -92,34 +92,6 @@
(my $sub_class = $class) =~ s/\w+$/SubInfo/;
$_ and bless $_ => $sub_class for values %$sub_subinfo;
- # XXX merge evals - should become a method optionally called here
- # (which uses other methods to do the work and those methods
- # should also be called by Devel::NYTProf::SubInfo::callers())
- while (my ($subname, $subinfo) = each %$sub_subinfo) {
-
- # add subname into sub_subinfo
- $subinfo->[6] = $subname; # XXX breaks encapsulation
- if ($subname =~ s/(::__ANON__\[\(\w*eval) \d+\)/$1 0)/) {
-
- # sub names like "PPI::Node::__ANON__[(eval
286)[PPI/Node.pm:642]:4]"
- # aren't very useful, so we merge them by changing the eval to
0
- my $oldname = $subinfo->subname;
- delete $sub_subinfo->{$oldname}; # delete old name
- if (my $newinfo = $sub_subinfo->{$subname}) {
- $newinfo->merge_in($subinfo);
- warn "merged sub_info $oldname into $subname\n" if $trace;
- }
- else {
- # is first to change, so just move ref to new name
- $sub_subinfo->{$subname} = $subinfo;
- $subinfo->[6] = $subname; # XXX breaks encapsulation
- warn "renamed sub_info $oldname into $subname\n" if $trace;
- }
-
- # XXX update fid_fileinfo NYTP_FIDi_SUBS_DEFINED
- # XXX update fid_fileinfo NYTP_FIDi_SUBS_CALLED
- }
- }
$profile->_clear_caches;
# a hack for testing/debugging
@@ -479,8 +451,6 @@
$self->{attribute}{$attr} = 0;
}
- my $eval_regex = qr/ \( ((?:re_)?) eval \s \d+ \) /x;
-
my $abs_path_regex = $^O eq "MSWin32" ? qr,^\w:/, : qr,^/,;
my @abs_inc = grep { $_ =~ $abs_path_regex } $self->inc;
my $is_lib_regex = get_abs_paths_alternation_regex(\...@abs_inc);
@@ -499,19 +469,6 @@
# zero sub into and sub caller times
$_->normalize_for_test for values %{ $self->{sub_subinfo} };
$_->normalize_for_test for $self->all_fileinfos;
-
- for my $info ($self->{sub_subinfo}) {
-
- # normalize eval sequence numbers in sub names to 0
- for my $subname (keys %$info) {
- (my $newname = $subname) =~ s/$eval_regex/(${1}eval 0)/g;
- next if $newname eq $subname;
-
- # XXX should merge instead
- warn "Normalizing evals discarded previous $newname info" if
$info->{$newname};
- $info->{$newname} = delete $info->{$subname};
- }
- }
return;
}
--~--~---------~--~----~------------~-------~--~----~
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]
-~----------~----~----~----~------~----~------~--~---