From: Masami Hiramatsu Date: Tue, 8 Dec 2009 22:03:02 +0000 (-0500) Subject: perf probe: Remove event suffix number _0 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=17f88fcd667a914b6f4dca146c9a09492fcd57b8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git perf probe: Remove event suffix number _0 Remove event suffix number _0 if it is the first. The first event has no suffix, and from the second, each event has suffix number counted from _1. This reduces typing cost :-). Signed-off-by: Masami Hiramatsu Cc: Steven Rostedt Cc: Jim Keniston Cc: Ananth N Mavinakayanahalli Cc: Christoph Hellwig Cc: Frank Ch. Eigler Cc: Frederic Weisbecker Cc: Jason Baron Cc: K.Prasad Cc: Peter Zijlstra Cc: Srikar Dronamraju Cc: Arnaldo Carvalho de Melo Cc: systemtap Cc: DLE LKML-Reference: <20091208220301.10142.50031.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Ingo Molnar --- diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 2c4d3017441b..31beedcf61c1 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -466,7 +466,16 @@ static void get_new_event_name(char *buf, size_t len, const char *base, struct strlist *namelist) { int i, ret; - for (i = 0; i < MAX_EVENT_INDEX; i++) { + + /* Try no suffix */ + ret = e_snprintf(buf, len, "%s", base); + if (ret < 0) + die("snprintf() failed: %s", strerror(-ret)); + if (!strlist__has_entry(namelist, buf)) + return; + + /* Try to add suffix */ + for (i = 1; i < MAX_EVENT_INDEX; i++) { ret = e_snprintf(buf, len, "%s_%d", base, i); if (ret < 0) die("snprintf() failed: %s", strerror(-ret));