diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-09-17 15:34:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-09-19 10:32:17 -0400 |
commit | 33e940a25daaea71be054e8a4bdb61730cc9ebbc (patch) | |
tree | e8d2f1f31f631290eb11da1c2b5a609b09a360be /tools/perf/util | |
parent | e955d5c434009b661dbb200c601254b0c2d9940a (diff) |
perf session: Check for SIGINT in more loops
When processing big files we were not checking if session_done was set
by the SIGINT signal handler, for instance in 'perf report'. Fix it.
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-pyad42lgrtq7xhg2dpsoauq7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/hist.c | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 9 | ||||
-rw-r--r-- | tools/perf/util/session.h | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 46a0d35a05e1..9ff6cf3e9a99 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -611,6 +611,8 @@ void hists__collapse_resort(struct hists *hists) | |||
611 | next = rb_first(root); | 611 | next = rb_first(root); |
612 | 612 | ||
613 | while (next) { | 613 | while (next) { |
614 | if (session_done()) | ||
615 | break; | ||
614 | n = rb_entry(next, struct hist_entry, rb_node_in); | 616 | n = rb_entry(next, struct hist_entry, rb_node_in); |
615 | next = rb_next(&n->rb_node_in); | 617 | next = rb_next(&n->rb_node_in); |
616 | 618 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 51f5edf2a6d0..70ffa41518f3 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -531,6 +531,9 @@ static int flush_sample_queue(struct perf_session *s, | |||
531 | return 0; | 531 | return 0; |
532 | 532 | ||
533 | list_for_each_entry_safe(iter, tmp, head, list) { | 533 | list_for_each_entry_safe(iter, tmp, head, list) { |
534 | if (session_done()) | ||
535 | return 0; | ||
536 | |||
534 | if (iter->timestamp > limit) | 537 | if (iter->timestamp > limit) |
535 | break; | 538 | break; |
536 | 539 | ||
@@ -1160,7 +1163,6 @@ static void perf_session__warn_about_errors(const struct perf_session *session, | |||
1160 | } | 1163 | } |
1161 | } | 1164 | } |
1162 | 1165 | ||
1163 | #define session_done() (*(volatile int *)(&session_done)) | ||
1164 | volatile int session_done; | 1166 | volatile int session_done; |
1165 | 1167 | ||
1166 | static int __perf_session__process_pipe_events(struct perf_session *self, | 1168 | static int __perf_session__process_pipe_events(struct perf_session *self, |
@@ -1372,10 +1374,13 @@ more: | |||
1372 | "Processing events..."); | 1374 | "Processing events..."); |
1373 | } | 1375 | } |
1374 | 1376 | ||
1377 | err = 0; | ||
1378 | if (session_done()) | ||
1379 | goto out_err; | ||
1380 | |||
1375 | if (file_pos < file_size) | 1381 | if (file_pos < file_size) |
1376 | goto more; | 1382 | goto more; |
1377 | 1383 | ||
1378 | err = 0; | ||
1379 | /* do the final flush for ordered samples */ | 1384 | /* do the final flush for ordered samples */ |
1380 | session->ordered_samples.next_flush = ULLONG_MAX; | 1385 | session->ordered_samples.next_flush = ULLONG_MAX; |
1381 | err = flush_sample_queue(session, tool); | 1386 | err = flush_sample_queue(session, tool); |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 3aa75fb2225f..04bf7373a7e5 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -124,4 +124,8 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session, | |||
124 | 124 | ||
125 | #define perf_session__set_tracepoints_handlers(session, array) \ | 125 | #define perf_session__set_tracepoints_handlers(session, array) \ |
126 | __perf_session__set_tracepoints_handlers(session, array, ARRAY_SIZE(array)) | 126 | __perf_session__set_tracepoints_handlers(session, array, ARRAY_SIZE(array)) |
127 | |||
128 | extern volatile int session_done; | ||
129 | |||
130 | #define session_done() (*(volatile int *)(&session_done)) | ||
127 | #endif /* __PERF_SESSION_H */ | 131 | #endif /* __PERF_SESSION_H */ |