From 0d049a1d2c0e5326a34159465711654edc48ed0c Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 31 Jan 2013 12:29:36 -0500 Subject: [PATCH] PR11576: simplify runtime *perf_counters[] widget Take away unnecessary indirection; *long[] -> *long. --- runtime/linux/uprobes-common.c | 4 ++-- runtime/linux/uprobes-common.h | 2 +- runtime/linux/uprobes-inode.c | 6 +++--- tapsets.cxx | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/runtime/linux/uprobes-common.c b/runtime/linux/uprobes-common.c index c00bb0034..3f76f3935 100644 --- a/runtime/linux/uprobes-common.c +++ b/runtime/linux/uprobes-common.c @@ -86,8 +86,8 @@ static int stap_uprobe_change_plus (struct task_struct *tsk, unsigned long reloc } /* sdt_sem_offset */ for (pci=0; pci < sups->perf_counters_dim; pci++) { - if ((*(sups->perf_counters))[pci] > -1) - _stp_perf_read_init ((*(sups->perf_counters))[pci], tsk); + if ((sups->perf_counters)[pci] > -1) + _stp_perf_read_init ((sups->perf_counters)[pci], tsk); } if (slotted_p) { diff --git a/runtime/linux/uprobes-common.h b/runtime/linux/uprobes-common.h index e794be519..7c17c6c96 100644 --- a/runtime/linux/uprobes-common.h +++ b/runtime/linux/uprobes-common.h @@ -29,7 +29,7 @@ struct stap_uprobe_spec { // List of perf counters used by each probe // This list is an index into struct stap_perf_probe, long perf_counters_dim; - long (*perf_counters) []; + long *perf_counters; const struct stap_probe * const probe; }; diff --git a/runtime/linux/uprobes-inode.c b/runtime/linux/uprobes-inode.c index c8ec64633..e066dd2ae 100644 --- a/runtime/linux/uprobes-inode.c +++ b/runtime/linux/uprobes-inode.c @@ -107,7 +107,7 @@ struct stapiu_consumer { // List of perf counters used by each probe // This list is an index into struct stap_perf_probe, long perf_counters_dim; - long (*perf_counters) []; + long *perf_counters; const struct stap_probe * const probe; }; @@ -349,8 +349,8 @@ stapiu_target_reg(struct stapiu_target *target, struct task_struct* task) if (! c->registered) { int i; for (i=0; i < c->perf_counters_dim; i++) { - if ((*(c->perf_counters))[i] > -1) - _stp_perf_read_init ((*(c->perf_counters))[i], task); + if ((c->perf_counters)[i] > -1) + _stp_perf_read_init ((c->perf_counters)[i], task); } ret = stapiu_register(target->inode, c); if (ret) { diff --git a/tapsets.cxx b/tapsets.cxx index 535882ac2..18b29846c 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -7552,9 +7552,10 @@ uprobe_derived_probe_group::emit_module_utrace_decls (systemtap_session& s) s.op->line() << " .sdt_sem_offset=(unsigned long)0x" << hex << p->sdt_semaphore_addr << dec << "ULL,"; + // XXX: don't bother emit if array is empty s.op->line() << " .perf_counters_dim=ARRAY_SIZE(perf_counters_" << lex_cast(i) << "),"; // List of perf counters used by a probe from above - s.op->line() << " .perf_counters=&perf_counters_" + lex_cast(i) + ","; + s.op->line() << " .perf_counters=perf_counters_" + lex_cast(i) + ","; if (p->has_return) s.op->line() << " .return_p=1,"; @@ -7845,9 +7846,10 @@ uprobe_derived_probe_group::emit_module_inode_decls (systemtap_session& s) if (p->sdt_semaphore_addr) s.op->line() << " .sdt_sem_offset=(loff_t)0x" << hex << p->sdt_semaphore_addr << dec << "ULL,"; + // XXX: don't bother emit if array is empty s.op->line() << " .perf_counters_dim=ARRAY_SIZE(perf_counters_" << lex_cast(i) << "),"; // List of perf counters used by a probe from above - s.op->line() << " .perf_counters=&perf_counters_" + lex_cast(i) + ","; + s.op->line() << " .perf_counters=perf_counters_" + lex_cast(i) + ","; s.op->line() << " .probe=" << common_probe_init (p) << ","; s.op->line() << " },"; } -- 2.43.5