perf tools: Add stat round user level event
Adding the stat round event to be stored after each stat interval round, so that report tools (report/script) gets notified and process interval data. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Kan Liang <kan.liang@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1445784728-21732-18-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
0ea0e35586
commit
2d8f0f18a5
@@ -333,6 +333,15 @@ static int process_stat_stub(struct perf_tool *tool __maybe_unused,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int process_stat_round_stub(struct perf_tool *tool __maybe_unused,
|
||||
union perf_event *event __maybe_unused,
|
||||
struct perf_session *perf_session
|
||||
__maybe_unused)
|
||||
{
|
||||
dump_printf(": unhandled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void perf_tool__fill_defaults(struct perf_tool *tool)
|
||||
{
|
||||
if (tool->sample == NULL)
|
||||
@@ -391,6 +400,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
|
||||
tool->stat_config = process_event_stat_config_stub;
|
||||
if (tool->stat == NULL)
|
||||
tool->stat = process_stat_stub;
|
||||
if (tool->stat_round == NULL)
|
||||
tool->stat_round = process_stat_round_stub;
|
||||
}
|
||||
|
||||
static void swap_sample_id_all(union perf_event *event, void *data)
|
||||
@@ -729,6 +740,13 @@ static void perf_event__stat_swap(union perf_event *event,
|
||||
event->stat.run = bswap_64(event->stat.run);
|
||||
}
|
||||
|
||||
static void perf_event__stat_round_swap(union perf_event *event,
|
||||
bool sample_id_all __maybe_unused)
|
||||
{
|
||||
event->stat_round.type = bswap_64(event->stat_round.type);
|
||||
event->stat_round.time = bswap_64(event->stat_round.time);
|
||||
}
|
||||
|
||||
typedef void (*perf_event__swap_op)(union perf_event *event,
|
||||
bool sample_id_all);
|
||||
|
||||
@@ -760,6 +778,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
|
||||
[PERF_RECORD_CPU_MAP] = perf_event__cpu_map_swap,
|
||||
[PERF_RECORD_STAT_CONFIG] = perf_event__stat_config_swap,
|
||||
[PERF_RECORD_STAT] = perf_event__stat_swap,
|
||||
[PERF_RECORD_STAT_ROUND] = perf_event__stat_round_swap,
|
||||
[PERF_RECORD_HEADER_MAX] = NULL,
|
||||
};
|
||||
|
||||
@@ -1304,6 +1323,8 @@ static s64 perf_session__process_user_event(struct perf_session *session,
|
||||
return tool->stat_config(tool, event, session);
|
||||
case PERF_RECORD_STAT:
|
||||
return tool->stat(tool, event, session);
|
||||
case PERF_RECORD_STAT_ROUND:
|
||||
return tool->stat_round(tool, event, session);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user