Rafael Garcia-Suarez wrote:
I think it's worth investigating doing it in a module, providing an
alternate runloop or only changing the pp functions for entersub and leavesub.
Putting probes around every op dispatch has a very noticeable effect,
the reason for the per-sub probes was it provided a reasonable balance
between observability and intrusiveness.
The functions themselves aren't enough as the ENTERSUB and LEAVESUB
macros are used in other places as well:
# dtrace -l | grep perl
36464 perl955 libperl.so perl_run
sub-entry
36465 perl955 libperl.so Perl_pp_sort
sub-entry
36466 perl955 libperl.so Perl_pp_dbstate
sub-entry
36467 perl955 libperl.so Perl_pp_entersub
sub-entry
36468 perl955 libperl.so perl_run
sub-return
36469 perl955 libperl.so Perl_pp_last
sub-return
36470 perl955 libperl.so Perl_pp_return
sub-return
36471 perl955 libperl.so Perl_dounwind
sub-return
36472 perl955 libperl.so Perl_pp_leavesublv
sub-return
36473 perl955 libperl.so Perl_pp_leavesub
sub-return
Dave Mitchell pointed out to me that we'll also need hooks in eval and
require for example.
I'd be more than happy to do it in a module, but I'm not clear how I
would replace functions in libperl from a module. The whole point of
dtrace is that it is lightweight enough to leave it in the code all the
time. Loading an additional module normally requires that you
stop/start the application, embedding the probes would mean you could
enable the probes on the fly.
--
Alan Burlison
--