* [PATCH] perf: avoid assertion for -p option in perf stat -a
@ 2010-06-02 14:31 Stephane Eranian
0 siblings, 0 replies; only message in thread
From: Stephane Eranian @ 2010-06-02 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: peterz, mingo, paulus, davem, fweisbec, acme, perfmon2-devel,
eranian, eranian, tzanussi
It was possible to use perf stat in system-wide mode with -a
and still attach to a process (-p) or thread (-t). The issue
is that it is not possible to get a termination signal from
the attached task, thus the command never terminates.
Furthermore, passing -p -a was triggering the assertion in
read_counter().
This patch fixes the issue by aborting perf stat if the
parameters conflict.
Signed-off-by: Stephane Eranian <eranian@google.com>
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a6b4d44..a3b6a5f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -573,6 +573,14 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
else
nr_cpus = 1;
+ /*
+ * a system-wide session cannot be delimited via an attachment
+ * because we cannot get a termination notification.
+ * It also triggers the assertion in read_counter()
+ */
+ if (system_wide && (target_tid != -1 || target_pid != -1))
+ usage_with_options(stat_usage, options);
+
if (nr_cpus < 1)
usage_with_options(stat_usage, options);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-02 14:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 14:31 [PATCH] perf: avoid assertion for -p option in perf stat -a Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).