All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, paulus@samba.org,
	davem@davemloft.net, fweisbec@gmail.com, acme@infradead.org,
	perfmon2-devel@lists.sf.net, eranian@gmail.com,
	eranian@google.com, tzanussi@gmail.com
Subject: [PATCH] perf: avoid assertion for -p option in perf stat -a
Date: Wed, 2 Jun 2010 16:31:01 +0200	[thread overview]
Message-ID: <4c066bb2.5cebd80a.19ec.45d8@mx.google.com> (raw)

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);
 

                 reply	other threads:[~2010-06-02 14:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c066bb2.5cebd80a.19ec.45d8@mx.google.com \
    --to=eranian@google.com \
    --cc=acme@infradead.org \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=tzanussi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.