mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
perf: Introduce a new "round of buffers read" pseudo event
In order to provide a more rubust and deterministic reordering algorithm, we need to know when we reach a point where we just did a pass through over every counter buffers to read every thing they had. This patch introduces a new PERF_RECORD_FINISHED_ROUND pseudo event that only consist in an event header and doesn't need to contain anything. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Masami Hiramatsu <mhiramat@redhat.com>
This commit is contained in:
parent
e157eb8341
commit
9840280757
2 changed files with 26 additions and 11 deletions
|
@ -494,6 +494,29 @@ static void event__synthesize_guest_os(struct machine *machine, void *data)
|
||||||
" relocation symbol.\n", machine->pid);
|
" relocation symbol.\n", machine->pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct perf_event_header finished_round_event = {
|
||||||
|
.size = sizeof(struct perf_event_header),
|
||||||
|
.type = PERF_RECORD_FINISHED_ROUND,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void mmap_read_all(void)
|
||||||
|
{
|
||||||
|
int i, counter, thread;
|
||||||
|
|
||||||
|
for (i = 0; i < nr_cpu; i++) {
|
||||||
|
for (counter = 0; counter < nr_counters; counter++) {
|
||||||
|
for (thread = 0; thread < thread_num; thread++) {
|
||||||
|
if (mmap_array[i][counter][thread].base)
|
||||||
|
mmap_read(&mmap_array[i][counter][thread]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perf_header__has_feat(&session->header, HEADER_TRACE_INFO))
|
||||||
|
write_output(&finished_round_event, sizeof(finished_round_event));
|
||||||
|
}
|
||||||
|
|
||||||
static int __cmd_record(int argc, const char **argv)
|
static int __cmd_record(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
int i, counter;
|
int i, counter;
|
||||||
|
@ -726,16 +749,7 @@ static int __cmd_record(int argc, const char **argv)
|
||||||
int hits = samples;
|
int hits = samples;
|
||||||
int thread;
|
int thread;
|
||||||
|
|
||||||
for (i = 0; i < nr_cpu; i++) {
|
mmap_read_all();
|
||||||
for (counter = 0; counter < nr_counters; counter++) {
|
|
||||||
for (thread = 0;
|
|
||||||
thread < thread_num; thread++) {
|
|
||||||
if (mmap_array[i][counter][thread].base)
|
|
||||||
mmap_read(&mmap_array[i][counter][thread]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hits == samples) {
|
if (hits == samples) {
|
||||||
if (done)
|
if (done)
|
||||||
|
|
|
@ -84,11 +84,12 @@ struct build_id_event {
|
||||||
char filename[];
|
char filename[];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum perf_header_event_type { /* above any possible kernel type */
|
enum perf_user_event_type { /* above any possible kernel type */
|
||||||
PERF_RECORD_HEADER_ATTR = 64,
|
PERF_RECORD_HEADER_ATTR = 64,
|
||||||
PERF_RECORD_HEADER_EVENT_TYPE = 65,
|
PERF_RECORD_HEADER_EVENT_TYPE = 65,
|
||||||
PERF_RECORD_HEADER_TRACING_DATA = 66,
|
PERF_RECORD_HEADER_TRACING_DATA = 66,
|
||||||
PERF_RECORD_HEADER_BUILD_ID = 67,
|
PERF_RECORD_HEADER_BUILD_ID = 67,
|
||||||
|
PERF_RECORD_FINISHED_ROUND = 68,
|
||||||
PERF_RECORD_HEADER_MAX
|
PERF_RECORD_HEADER_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue