summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn M Moore <sartak@bestpractical.com>2011-07-06 22:35:47 -0400
committerFather Chrysostomos <sprout@cpan.org>2011-07-11 20:29:55 -0700
commitcb3f81892d39d9404a61efa6a7efd0c627dd6870 (patch)
tree162a5038ad7d6d6e66190a6d6b1be64ab736bda8
parentca7b837b497c7593dd1e10c394a96b3b71835897 (diff)
downloadperl-cb3f81892d39d9404a61efa6a7efd0c627dd6870.tar.gz
Add a phase-change DTrace probe
-rw-r--r--mydtrace.h6
-rw-r--r--perl.h1
-rw-r--r--perldtrace.d2
3 files changed, 9 insertions, 0 deletions
diff --git a/mydtrace.h b/mydtrace.h
index 75e6918015..a7a4e470c6 100644
--- a/mydtrace.h
+++ b/mydtrace.h
@@ -23,11 +23,17 @@
PERL_SUB_RETURN(func, file, line, stash); \
}
+# define PHASE_CHANGE_PROBE(new_phase, old_phase) \
+ if (PERL_PHASE_CHANGE_ENABLED()) { \
+ PERL_PHASE_CHANGE(new_phase, old_phase); \
+ }
+
#else
/* NOPs */
# define ENTRY_PROBE(func, file, line, stash)
# define RETURN_PROBE(func, file, line, stash)
+# define PHASE_CHANGE_PROBE(new_phase, old_phase)
#endif
diff --git a/perl.h b/perl.h
index 423d264785..4d2004717a 100644
--- a/perl.h
+++ b/perl.h
@@ -4720,6 +4720,7 @@ EXTCONST char PL_bincompat_options[];
#ifndef PERL_SET_PHASE
# define PERL_SET_PHASE(new_phase) \
+ PHASE_CHANGE_PROBE(PL_phase_names[new_phase], PL_phase_names[PL_phase]); \
PL_phase = new_phase;
#endif
diff --git a/perldtrace.d b/perldtrace.d
index 5175f249b1..6040d2bbc9 100644
--- a/perldtrace.d
+++ b/perldtrace.d
@@ -6,6 +6,8 @@
provider perl {
probe sub__entry(char *, char *, int, char *);
probe sub__return(char *, char *, int, char *);
+
+ probe phase__change(const char *, const char *);
};
/*