From 06d2888cc8c1eaea2cc17683975ed7d76797cd1e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 18 Mar 2010 18:57:10 -0700 Subject: Simplify the perf entry handlers * tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls): Just pass an index from the individual entry handlers, and let handle_perf_probe figure out the pp and ph. --- tapset-perfmon.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'tapset-perfmon.cxx') diff --git a/tapset-perfmon.cxx b/tapset-perfmon.cxx index 98bc8fe6..65e28a08 100644 --- a/tapset-perfmon.cxx +++ b/tapset-perfmon.cxx @@ -84,8 +84,7 @@ perf_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline(); /* declarations */ - s.op->newline() << "static void handle_perf_probe (const char *pp, " - << "void (*ph) (struct context*), struct pt_regs *regs);"; + s.op->newline() << "static void handle_perf_probe (unsigned i, struct pt_regs *regs);"; for (unsigned i=0; i < probes.size(); i++) s.op->newline() << "static void enter_perf_probe_" << i << " (struct perf_event *e, int nmi, " @@ -120,19 +119,17 @@ perf_derived_probe_group::emit_module_decls (systemtap_session& s) << "struct perf_sample_data *data, " << "struct pt_regs *regs)"; s.op->newline() << "{"; - s.op->newline(1) << "handle_perf_probe(" << lex_cast_qstring (*probes[i]->sole_location()) - << ", " << probes[i]->name << ", regs);"; + s.op->newline(1) << "handle_perf_probe(" << i << ", regs);"; s.op->newline(-1) << "}"; } s.op->newline(); - s.op->newline() << "static void handle_perf_probe (const char *pp, " - << "void (*ph) (struct context*), struct pt_regs *regs)"; + s.op->newline() << "static void handle_perf_probe (unsigned i, struct pt_regs *regs)"; s.op->newline() << "{"; - s.op->indent(1); - common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING", "pp"); + s.op->newline(1) << "struct stap_perf_probe* stp = & stap_perf_probes [i];"; + common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING", "stp->pp"); s.op->newline() << "c->regs = regs;"; - s.op->newline() << "(*ph) (c);"; + s.op->newline() << "(*stp->ph) (c);"; common_probe_entryfn_epilogue (s.op); s.op->newline(-1) << "}"; } -- cgit