Revision: 916 Author: tim.bunce Date: Wed Nov 18 08:33:01 2009 Log: Fixed chomping of newline in fid source code trace. Included fid id in 'source not available' fake source line and NYTP_FIDf_IS_FAKE fake source line. Fixed up edge cases in source code handling. Noted more things to test/consider/fix.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=916 Modified: /trunk/Changes /trunk/NYTProf.xs /trunk/lib/Devel/NYTProf/FileInfo.pm ======================================= --- /trunk/Changes Mon Nov 16 13:32:31 2009 +++ /trunk/Changes Wed Nov 18 08:33:01 2009 @@ -10,6 +10,8 @@ XXX handling of BEGIN's e.g., Perl::Critic::Document (1.105) line 325 XXX add u key to treemap to trigger moving 'up' a level XXX add "calls N subs" to treemap mouseover box +XXX CORE::GLOBAL::foo +XXX string eval merging - must allow at least viewing of source for called subs defined in a nested eval Note: The file format has changed. Old files can't be read. ======================================= --- /trunk/NYTProf.xs Tue Nov 17 13:03:49 2009 +++ /trunk/NYTProf.xs Wed Nov 18 08:33:01 2009 @@ -1149,8 +1149,8 @@ if (len > 3 && strnEQ(&file_name[len-3],".pm", len)) { /* ends in .pm, ok, does a newer .pmc exist? */ /* based on doopen_pm() in perl's pp_ctl.c */ - SV *pmsv = Perl_newSVpvn(aTHX_ file_name, len); - SV *pmcsv = Perl_newSVpvf(aTHX_ "%s%c", SvPV_nolen(pmsv), 'c'); + SV *pmsv = newSVpvn(file_name, len); + SV *pmcsv = newSVpvf("%s%c", SvPV_nolen(pmsv), 'c'); Stat_t pmstat; Stat_t pmcstat; if (PerlLIO_lstat(SvPV_nolen(pmcsv), &pmcstat) == 0) { @@ -3543,16 +3543,17 @@ } ++t_save_src; - lines = av_len(src_av); + lines = av_len(src_av); /* -1 is empty, 1 is 1 line etc, 0 shouldn't happen */ if (trace_level >= 4) - logwarn("fid %d has %ld src lines\n", e->id, (long)lines); + logwarn("fid %d has %ld src lines for %.*s\n", + e->id, (long)lines, e->key_len, e->key); /* for perl 5.10.0 or 5.8.8 (or earlier) use_db_sub is needed to get src */ /* give a hint for the common case */ - if (0 == lines && !opt_use_db_sub + if (lines <= 0 && !opt_use_db_sub && ( (e->key_len == 1 && strnEQ(e->key, "-", 1)) || (e->key_len == 2 && strnEQ(e->key, "-e", 2)) ) ) { - av_store(src_av, 1, newSVpv("# source not available, try using use_db_sub=1 option.\n",0)); + av_store(src_av, 1, newSVpvf("# fid%d: source not available, try using use_db_sub=1 option.\n",e->id)); lines = 1; } for (line = 1; line <= lines; ++line) { /* lines start at 1 */ @@ -3566,7 +3567,7 @@ output_str(src, (I32)len); /* includes newline */ if (trace_level >= 5) { logwarn("fid %d src line %d: %s%s", e->id, line, src, - (*src && src[strlen(src)-1]!=='\n') ? "\n" : ""); + (*src && src[strlen(src)-1]=='\n') ? "" : "\n"); } ++t_lines; } ======================================= --- /trunk/lib/Devel/NYTProf/FileInfo.pm Wed Oct 28 03:32:54 2009 +++ /trunk/lib/Devel/NYTProf/FileInfo.pm Wed Nov 18 08:33:01 2009 @@ -182,7 +182,7 @@ } if ($self->flags & NYTP_FIDf_IS_FAKE) { - return [ "# NYTP_FIDf_IS_FAKE - e.g., unknown caller of an eval.\n" ]; + return [ "# fid$fid: NYTP_FIDf_IS_FAKE - e.g., unknown caller of an eval.\n" ]; } return undef; -- 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]
