From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 04/26] perf trace: Improve event processing exit
Date: Tue, 22 Oct 2013 11:28:12 -0300 [thread overview]
Message-ID: <1382452114-1243-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1382452114-1243-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We need to differentiate SIGCHLD from SIGINT, the later should cause as
immediate as possible exit, while the former should wait to process the
events that may be perceived in the ring buffer after the SIGCHLD is
handled.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-vf6n57ewm3mjy2sz6r491hus@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 86d2b1f2399c..ec8289570f4f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1098,10 +1098,12 @@ static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp)
}
static bool done = false;
+static bool interrupted = false;
-static void sig_handler(int sig __maybe_unused)
+static void sig_handler(int sig)
{
done = true;
+ interrupted = sig == SIGINT;
}
static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread,
@@ -1771,24 +1773,23 @@ again:
handler = evsel->handler.func;
handler(trace, evsel, &sample);
- if (done)
- goto out_unmap_evlist;
+ if (interrupted)
+ goto out_disable;
}
}
if (trace->nr_events == before) {
- if (done)
- goto out_unmap_evlist;
+ int timeout = done ? 100 : -1;
- poll(evlist->pollfd, evlist->nr_fds, -1);
+ if (poll(evlist->pollfd, evlist->nr_fds, timeout) > 0)
+ goto again;
+ } else {
+ goto again;
}
- if (done)
- perf_evlist__disable(evlist);
- else
- goto again;
+out_disable:
+ perf_evlist__disable(evlist);
-out_unmap_evlist:
if (!err) {
if (trace->summary)
trace__fprintf_thread_summary(trace, trace->output);
--
1.8.1.4
next prev parent reply other threads:[~2013-10-22 14:33 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 14:28 [GIT PULL 00/26] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 01/26] perf scripting perl: Fix build error on Fedora 12 Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 02/26] perf trace: Split fd -> pathname array handling Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 03/26] perf trace: Use vfs_getname hook if available Arnaldo Carvalho de Melo
2013-10-22 14:28 ` Arnaldo Carvalho de Melo [this message]
2013-10-22 14:28 ` [PATCH 05/26] perf evlist: Introduce perf_evlist__strerror_tp method Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 06/26] perf tools: Introduce filename__read_int helper Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 07/26] perf trace: Improve messages related to /proc/sys/kernel/perf_event_paranoid Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 08/26] perf evsel: Add missing 'mmap2' from debug print Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 09/26] perf evsel: Add missing decrement in id sample parsing Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 10/26] perf record: Improve write_output error message Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 11/26] perf session: Add missing sample flush for piped events Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 12/26] perf session: Add missing members to perf_event__attr_swap() Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 13/26] perf evlist: Fix 32-bit build error Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 14/26] perf tools: Fix test_on_exit for 32-bit build Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 15/26] perf tools: Fix bench/numa.c " Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 16/26] perf evlist: Fix perf_evlist__mmap comments Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 17/26] perf evlist: Factor out duplicated mmap code Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 18/26] perf script: Print addr by default for BTS Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 19/26] perf list: Show error if tracepoints not available Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 20/26] perf callchain: Convert children list to rbtree Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 21/26] perf tools: Compare dso's also when comparing symbols Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 22/26] perf tools: Add data object to handle perf data file Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 23/26] perf tools: Add perf_data_file__open interface to data object Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 24/26] perf session: Separating data file properties from session Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 25/26] perf report: Add --max-stack option to limit callchain stack scan Arnaldo Carvalho de Melo
2013-10-22 14:28 ` [PATCH 26/26] perf top: " Arnaldo Carvalho de Melo
2013-10-23 7:48 ` [GIT PULL 00/26] perf/core improvements and fixes Ingo Molnar
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=1382452114-1243-5-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®