aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_trace.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-26 19:34:22 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:04 +0100
commitcd366260e689d97845c56f30ef960853099465ab (patch)
tree52d5e0c0985b3de0a251818b263ab873280da57b /erts/emulator/beam/erl_bif_trace.c
parente60c9cd4356a91c10657b5de86af8279ccd6eb79 (diff)
downloadotp-cd366260e689d97845c56f30ef960853099465ab.tar.gz
otp-cd366260e689d97845c56f30ef960853099465ab.tar.bz2
otp-cd366260e689d97845c56f30ef960853099465ab.zip
erts: Keep count of number of global traced functions per module
Diffstat (limited to 'erts/emulator/beam/erl_bif_trace.c')
-rw-r--r--erts/emulator/beam/erl_bif_trace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index cb43069fa9..24b16b9679 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -1526,6 +1526,8 @@ erts_set_trace_pattern(Eterm* mfa, int specified,
static int
setup_func_trace(Export* ep, void* match_prog, ErtsCodeIndex code_ix)
{
+ Module* modp;
+
if (ep->addressv[code_ix] == ep->code+3) {
if (ep->code[3] == (BeamInstr) em_call_error_handler) {
return 0;
@@ -1548,12 +1550,16 @@ setup_func_trace(Export* ep, void* match_prog, ErtsCodeIndex code_ix)
if (erts_is_native_break(ep->addressv[code_ix])) {
return 0;
}
-
+
ep->code[3] = (BeamInstr) em_call_traced_function;
ep->code[4] = (BeamInstr) ep->addressv[code_ix];
ep->addressv[code_ix] = ep->code+3;
ep->match_prog_set = match_prog;
MatchSetRef(ep->match_prog_set);
+
+ modp = erts_get_module(ep->code[0], code_ix);
+ ASSERT(modp);
+ modp->curr.num_traced_exports++;
return 1;
}
@@ -1592,6 +1598,10 @@ reset_func_trace(Export* ep, ErtsCodeIndex code_ix)
if (ep->code[3] == (BeamInstr) em_call_error_handler) {
return 0;
} else if (ep->code[3] == (BeamInstr) em_call_traced_function) {
+ Module* modp = erts_get_module(ep->code[0], code_ix);
+ ASSERT(modp);
+ modp->curr.num_traced_exports--;
+
ep->addressv[code_ix] = (Uint *) ep->code[4];
MatchSetUnref(ep->match_prog_set);
ep->match_prog_set = NULL;