develooper Front page | perl.perl5.porters | Postings from July 2008

Code review request for the perl guts vodoo in NYTProf v2

From:
Tim Bunce
Date:
July 20, 2008 17:47
Subject:
Code review request for the perl guts vodoo in NYTProf v2
Message ID:
20080721004737.GB85786@timac.local
In my headlong charge to get Devel::NYTProf v2 out before OSCON I've not
had much time to review the code I'd cooked up to dig around in perl
internals.

For example:

#if (PERL_VERSION < 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION < 8))
/* If we're using DB::DB() instead of opcode redirection with an old perl
 * then PL_curcop in DB() will refer to the DB() wrapper in Devel/NYTProf.pm
 * so we'd have to crawl the stack to find the right cop. However, for some
 * reason that I don't pretend to understand the following expression works:
 */
#define PL_curcop_nytprof (use_db_sub ? ((cxstack + cxstack_ix)->blk_oldcop) : PL_curcop)
#else
#define PL_curcop_nytprof PL_curcop
#endif

Others include the visit_contexts(), check_context(),
start_cop_of_context() and closest_cop() functions.

I've been playing with magic beyond my powers and have, so far, survived
unscathed (not counting too many late night hacking sessions).
I suspect that the code is suboptimal in places. Perhaps lots of places.
Any feedback gratefully recieved.

Tim.

http://blog.timbunce.org/2008/07/15/nytprof-v2-a-major-advance-in-perl-profilers/
http://code.google.com/p/perl-devel-nytprof/source/browse/trunk/NYTProf.xs



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About