Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175418
b: refs/heads/master
c: a9b495b
h: refs/heads/master
v: v3
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Dec 9, 2009
1 parent 1ed075f commit 017326c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 278498d438781426d8f315b65f7bca023a26fcc0
refs/heads/master: a9b495b0d35859971d6896293f6d0a0d880c7dfb
15 changes: 10 additions & 5 deletions trunk/tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,13 @@ static struct strlist *get_perf_event_names(int fd)
return sl;
}

static int write_trace_kprobe_event(int fd, const char *buf)
static void write_trace_kprobe_event(int fd, const char *buf)
{
int ret;

ret = write(fd, buf, strlen(buf));
if (ret <= 0)
die("Failed to create event.");
else
printf("Added new event: %s\n", buf);

return ret;
}

static void get_new_event_name(char *buf, size_t len, const char *base,
Expand Down Expand Up @@ -503,10 +499,19 @@ void add_trace_kprobe_events(struct probe_point *probes, int nr_probes)
PERFPROBE_GROUP, event,
pp->probes[i]);
write_trace_kprobe_event(fd, buf);
printf("Added new event:\n");
/* Get the first parameter (probe-point) */
sscanf(pp->probes[i], "%s", buf);
show_perf_probe_event(PERFPROBE_GROUP, event,
buf, pp);
/* Add added event name to namelist */
strlist__add(namelist, event);
}
}
/* Show how to use the event. */
printf("\nYou can now use it on all perf tools, such as:\n\n");
printf("\tperf record -e %s:%s -a sleep 1\n\n", PERFPROBE_GROUP, event);

strlist__delete(namelist);
close(fd);
}

0 comments on commit 017326c

Please sign in to comment.