aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-record.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 4a1a54265b04..4869050e7194 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -238,6 +238,7 @@ static struct perf_event_header finished_round_event = {
238 238
239static int record__mmap_read_all(struct record *rec) 239static int record__mmap_read_all(struct record *rec)
240{ 240{
241 u64 bytes_written = rec->bytes_written;
241 int i; 242 int i;
242 int rc = 0; 243 int rc = 0;
243 244
@@ -250,7 +251,12 @@ static int record__mmap_read_all(struct record *rec)
250 } 251 }
251 } 252 }
252 253
253 rc = record__write(rec, &finished_round_event, sizeof(finished_round_event)); 254 /*
255 * Mark the round finished in case we wrote
256 * at least one event.
257 */
258 if (bytes_written != rec->bytes_written)
259 rc = record__write(rec, &finished_round_event, sizeof(finished_round_event));
254 260
255out: 261out:
256 return rc; 262 return rc;