aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-12-15 10:32:03 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-15 14:22:02 -0500
commitadf365f486280e4577c9eabd7d8e118e5994a03e (patch)
treed7f17542b84baacb633099fba4354a2e1bfe0b3a /tools/perf
parentabf5ef72477f9fb559a8a034fd6e6c397bb37e1f (diff)
perf probe: Use strlist__for_each macros in probe-event.c
Use strlist__for_each macros instead of using strlist__entry() and index variable. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Jason Baron <jbaron@redhat.com> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20091215153203.17436.52039.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/probe-event.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index eab25d638f21..3e30be928101 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -404,7 +404,6 @@ static void show_perf_probe_event(const char *group, const char *event,
404/* List up current perf-probe events */ 404/* List up current perf-probe events */
405void show_perf_probe_events(void) 405void show_perf_probe_events(void)
406{ 406{
407 unsigned int i;
408 int fd, nr; 407 int fd, nr;
409 char *group, *event; 408 char *group, *event;
410 struct probe_point pp; 409 struct probe_point pp;
@@ -415,8 +414,7 @@ void show_perf_probe_events(void)
415 rawlist = get_trace_kprobe_event_rawlist(fd); 414 rawlist = get_trace_kprobe_event_rawlist(fd);
416 close(fd); 415 close(fd);
417 416
418 for (i = 0; i < strlist__nr_entries(rawlist); i++) { 417 strlist__for_each(ent, rawlist) {
419 ent = strlist__entry(rawlist, i);
420 parse_trace_kprobe_event(ent->s, &group, &event, &pp); 418 parse_trace_kprobe_event(ent->s, &group, &event, &pp);
421 /* Synthesize only event probe point */ 419 /* Synthesize only event probe point */
422 nr = pp.nr_args; 420 nr = pp.nr_args;
@@ -436,7 +434,6 @@ void show_perf_probe_events(void)
436/* Get current perf-probe event names */ 434/* Get current perf-probe event names */
437static struct strlist *get_perf_event_names(int fd, bool include_group) 435static struct strlist *get_perf_event_names(int fd, bool include_group)
438{ 436{
439 unsigned int i;
440 char *group, *event; 437 char *group, *event;
441 char buf[128]; 438 char buf[128];
442 struct strlist *sl, *rawlist; 439 struct strlist *sl, *rawlist;
@@ -445,8 +442,7 @@ static struct strlist *get_perf_event_names(int fd, bool include_group)
445 rawlist = get_trace_kprobe_event_rawlist(fd); 442 rawlist = get_trace_kprobe_event_rawlist(fd);
446 443
447 sl = strlist__new(true, NULL); 444 sl = strlist__new(true, NULL);
448 for (i = 0; i < strlist__nr_entries(rawlist); i++) { 445 strlist__for_each(ent, rawlist) {
449 ent = strlist__entry(rawlist, i);
450 parse_trace_kprobe_event(ent->s, &group, &event, NULL); 446 parse_trace_kprobe_event(ent->s, &group, &event, NULL);
451 if (include_group) { 447 if (include_group) {
452 if (e_snprintf(buf, 128, "%s:%s", group, event) < 0) 448 if (e_snprintf(buf, 128, "%s:%s", group, event) < 0)
@@ -561,7 +557,6 @@ static void del_trace_kprobe_event(int fd, const char *group,
561void del_trace_kprobe_events(struct strlist *dellist) 557void del_trace_kprobe_events(struct strlist *dellist)
562{ 558{
563 int fd; 559 int fd;
564 unsigned int i;
565 const char *group, *event; 560 const char *group, *event;
566 char *p, *str; 561 char *p, *str;
567 struct str_node *ent; 562 struct str_node *ent;
@@ -571,8 +566,7 @@ void del_trace_kprobe_events(struct strlist *dellist)
571 /* Get current event names */ 566 /* Get current event names */
572 namelist = get_perf_event_names(fd, true); 567 namelist = get_perf_event_names(fd, true);
573 568
574 for (i = 0; i < strlist__nr_entries(dellist); i++) { 569 strlist__for_each(ent, dellist) {
575 ent = strlist__entry(dellist, i);
576 str = strdup(ent->s); 570 str = strdup(ent->s);
577 if (!str) 571 if (!str)
578 die("Failed to copy event."); 572 die("Failed to copy event.");