perf tools: Add support for PERF_RECORD_ITRACE_START
Add support for the PERF_RECORD_ITRACE_START event type. This event can be used to determine the pid and tid that are running when Instruction Tracing starts. Generally that information would come from a sched_switch event but, at the start, no sched_switch events may yet have been recorded. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1430404667-10593-8-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
4a96f7a02e
commit
0ad21f6869
@@ -327,6 +327,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
|
||||
tool->lost = perf_event__process_lost;
|
||||
if (tool->aux == NULL)
|
||||
tool->aux = perf_event__process_aux;
|
||||
if (tool->itrace_start == NULL)
|
||||
tool->itrace_start = perf_event__process_itrace_start;
|
||||
if (tool->read == NULL)
|
||||
tool->read = process_event_sample_stub;
|
||||
if (tool->throttle == NULL)
|
||||
@@ -455,6 +457,16 @@ static void perf_event__aux_swap(union perf_event *event, bool sample_id_all)
|
||||
swap_sample_id_all(event, &event->aux + 1);
|
||||
}
|
||||
|
||||
static void perf_event__itrace_start_swap(union perf_event *event,
|
||||
bool sample_id_all)
|
||||
{
|
||||
event->itrace_start.pid = bswap_32(event->itrace_start.pid);
|
||||
event->itrace_start.tid = bswap_32(event->itrace_start.tid);
|
||||
|
||||
if (sample_id_all)
|
||||
swap_sample_id_all(event, &event->itrace_start + 1);
|
||||
}
|
||||
|
||||
static void perf_event__throttle_swap(union perf_event *event,
|
||||
bool sample_id_all)
|
||||
{
|
||||
@@ -593,6 +605,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
|
||||
[PERF_RECORD_UNTHROTTLE] = perf_event__throttle_swap,
|
||||
[PERF_RECORD_SAMPLE] = perf_event__all64_swap,
|
||||
[PERF_RECORD_AUX] = perf_event__aux_swap,
|
||||
[PERF_RECORD_ITRACE_START] = perf_event__itrace_start_swap,
|
||||
[PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
|
||||
[PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,
|
||||
[PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap,
|
||||
@@ -1044,6 +1057,8 @@ static int machines__deliver_event(struct machines *machines,
|
||||
return tool->unthrottle(tool, event, sample, machine);
|
||||
case PERF_RECORD_AUX:
|
||||
return tool->aux(tool, event, sample, machine);
|
||||
case PERF_RECORD_ITRACE_START:
|
||||
return tool->itrace_start(tool, event, sample, machine);
|
||||
default:
|
||||
++evlist->stats.nr_unknown_events;
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user