mirror of https://gitee.com/openkylin/linux.git
perf session: Flag if the event stream is entirely in memory
Flag if the event stream is a file that has been mmapped in one go. This is useful, for example, if a tool needs to keep an event for later reference. If the new flag is set, a pointer to the event can be retained, otherwise the event must be copied. Signed-off-by: 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: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1405332185-4050-28-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
9c00a81b6a
commit
919d86d3a3
|
@ -1297,8 +1297,10 @@ int __perf_session__process_events(struct perf_session *session,
|
||||||
ui_progress__init(&prog, file_size, "Processing events...");
|
ui_progress__init(&prog, file_size, "Processing events...");
|
||||||
|
|
||||||
mmap_size = MMAP_SIZE;
|
mmap_size = MMAP_SIZE;
|
||||||
if (mmap_size > file_size)
|
if (mmap_size > file_size) {
|
||||||
mmap_size = file_size;
|
mmap_size = file_size;
|
||||||
|
session->one_mmap = true;
|
||||||
|
}
|
||||||
|
|
||||||
memset(mmaps, 0, sizeof(mmaps));
|
memset(mmaps, 0, sizeof(mmaps));
|
||||||
|
|
||||||
|
@ -1320,6 +1322,10 @@ int __perf_session__process_events(struct perf_session *session,
|
||||||
mmaps[map_idx] = buf;
|
mmaps[map_idx] = buf;
|
||||||
map_idx = (map_idx + 1) & (ARRAY_SIZE(mmaps) - 1);
|
map_idx = (map_idx + 1) & (ARRAY_SIZE(mmaps) - 1);
|
||||||
file_pos = file_offset + head;
|
file_pos = file_offset + head;
|
||||||
|
if (session->one_mmap) {
|
||||||
|
session->one_mmap_addr = buf;
|
||||||
|
session->one_mmap_offset = file_offset;
|
||||||
|
}
|
||||||
|
|
||||||
more:
|
more:
|
||||||
event = fetch_mmaped_event(session, head, mmap_size, buf);
|
event = fetch_mmaped_event(session, head, mmap_size, buf);
|
||||||
|
@ -1365,6 +1371,7 @@ int __perf_session__process_events(struct perf_session *session,
|
||||||
ui_progress__finish();
|
ui_progress__finish();
|
||||||
perf_session__warn_about_errors(session, tool);
|
perf_session__warn_about_errors(session, tool);
|
||||||
perf_session_free_sample_buffers(session);
|
perf_session_free_sample_buffers(session);
|
||||||
|
session->one_mmap = false;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ struct perf_session {
|
||||||
struct trace_event tevent;
|
struct trace_event tevent;
|
||||||
struct events_stats stats;
|
struct events_stats stats;
|
||||||
bool repipe;
|
bool repipe;
|
||||||
|
bool one_mmap;
|
||||||
|
void *one_mmap_addr;
|
||||||
|
u64 one_mmap_offset;
|
||||||
struct ordered_samples ordered_samples;
|
struct ordered_samples ordered_samples;
|
||||||
struct perf_data_file *file;
|
struct perf_data_file *file;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue