diff options
author | Jiri Olsa <jolsa@kernel.org> | 2014-07-25 10:56:16 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-25 11:17:36 -0400 |
commit | dcabb507fd3a2b19aed6b4068e2a954f5fd8de45 (patch) | |
tree | 7b6a25848d195c28b701f3cfead9bd3bca69e54c /tools | |
parent | 33bf7481971a622a2b8c8aaa0e5e61a6eaeecd71 (diff) |
perf record: Store PERF_RECORD_FINISHED_ROUND only for nonempty rounds
Currently we store PERF_RECORD_FINISHED_ROUND event each time
we go throught mmap buffers no matter if it contains any data,
which is useless.
Forcing the PERF_RECORD_FINISHED_ROUND event to be stored any
time we finished the round AND wrote at least one event.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1406300177-31805-19-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 8 |
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 | ||
239 | static int record__mmap_read_all(struct record *rec) | 239 | static 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 | ||
255 | out: | 261 | out: |
256 | return rc; | 262 | return rc; |