aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 51f5edf2a6d0..568b750c01f6 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -256,6 +256,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
256 tool->sample = process_event_sample_stub; 256 tool->sample = process_event_sample_stub;
257 if (tool->mmap == NULL) 257 if (tool->mmap == NULL)
258 tool->mmap = process_event_stub; 258 tool->mmap = process_event_stub;
259 if (tool->mmap2 == NULL)
260 tool->mmap2 = process_event_stub;
259 if (tool->comm == NULL) 261 if (tool->comm == NULL)
260 tool->comm = process_event_stub; 262 tool->comm = process_event_stub;
261 if (tool->fork == NULL) 263 if (tool->fork == NULL)
@@ -531,6 +533,9 @@ static int flush_sample_queue(struct perf_session *s,
531 return 0; 533 return 0;
532 534
533 list_for_each_entry_safe(iter, tmp, head, list) { 535 list_for_each_entry_safe(iter, tmp, head, list) {
536 if (session_done())
537 return 0;
538
534 if (iter->timestamp > limit) 539 if (iter->timestamp > limit)
535 break; 540 break;
536 541
@@ -1160,7 +1165,6 @@ static void perf_session__warn_about_errors(const struct perf_session *session,
1160 } 1165 }
1161} 1166}
1162 1167
1163#define session_done() (*(volatile int *)(&session_done))
1164volatile int session_done; 1168volatile int session_done;
1165 1169
1166static int __perf_session__process_pipe_events(struct perf_session *self, 1170static int __perf_session__process_pipe_events(struct perf_session *self,
@@ -1308,7 +1312,7 @@ int __perf_session__process_events(struct perf_session *session,
1308 file_offset = page_offset; 1312 file_offset = page_offset;
1309 head = data_offset - page_offset; 1313 head = data_offset - page_offset;
1310 1314
1311 if (data_offset + data_size < file_size) 1315 if (data_size && (data_offset + data_size < file_size))
1312 file_size = data_offset + data_size; 1316 file_size = data_offset + data_size;
1313 1317
1314 progress_next = file_size / 16; 1318 progress_next = file_size / 16;
@@ -1372,10 +1376,13 @@ more:
1372 "Processing events..."); 1376 "Processing events...");
1373 } 1377 }
1374 1378
1379 err = 0;
1380 if (session_done())
1381 goto out_err;
1382
1375 if (file_pos < file_size) 1383 if (file_pos < file_size)
1376 goto more; 1384 goto more;
1377 1385
1378 err = 0;
1379 /* do the final flush for ordered samples */ 1386 /* do the final flush for ordered samples */
1380 session->ordered_samples.next_flush = ULLONG_MAX; 1387 session->ordered_samples.next_flush = ULLONG_MAX;
1381 err = flush_sample_queue(session, tool); 1388 err = flush_sample_queue(session, tool);