perf evlist: Add perf_evlist__parse_sample_timestamp function
tip-bot for Jiri Olsa
merge botCommit-ID: 014681208ea0d1a7e5ea2f014242e7d196d04c34 Gitweb: https://git.kernel.org/tip/014681208ea0d1a7e5ea2f014242e7d196d04c34 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 3 Aug 2017 13:10:28 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 16 Nov 2017 14:50:09 -0300
perf evlist: Add perf_evlist__parse_sample_timestamp function
Add perf_evlist__parse_sample_timestamp to retrieve the timestamp of the sample.
The idea is to use this function instead of the full sample parsing before we queue the sample. At that time only the timestamp is needed and we parse the sample once again later on delivery.
Signed-off-by Jiri Olsa <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/evlist.c | 11 ++++++++ tools/perf/util/evlist.h | 4 +++ tools/perf/util/evsel.c | 65 +++++++++++++++++++++++++++++++++++++++++++----- tools/perf/util/evsel.h | 4 +++ 4 files changed, 78 insertions(+), 6 deletions(-)
tools/perf/util/evlist.c +11 -0
@@ -1582,6 +1582,17 @@ int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *evenreturn perf_evsel__parse_sample (evsel, event, sample); } +int perf_evlist__parse_sample_timestamp (struct perf_evlist *evlist, +union perf_event *event, +u64 *timestamp) +{ +struct perf_evsel *evsel =perf_evlist__event2evsel (evlist, event); + +if (!evsel) +return -EFAULT ; +return perf_evsel__parse_sample_timestamp (evsel, event, timestamp); +} +size_t perf_evlist__fprintf (struct perf_evlist *evlist,FILE *fp) {struct perf_evsel *evsel;
tools/perf/util/evlist.h +4 -0
@@ -205,6 +205,10 @@ u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist);int perf_evlist__parse_sample (struct perf_evlist *evlist,union perf_event *event,struct perf_sample *sample); +int perf_evlist__parse_sample_timestamp (struct perf_evlist *evlist, +union perf_event *event, +u64 *timestamp); +bool perf_evlist__valid_sample_type (struct perf_evlist *evlist);bool perf_evlist__valid_sample_id_all (struct perf_evlist *evlist);bool perf_evlist__valid_read_format (struct perf_evlist *evlist);
tools/perf/util/evsel.c +59 -6
83 lines not on this page · raw message
tools/perf/util/evsel.h +4 -0
@@ -338,6 +338,10 @@ static inline int perf_evsel__read_on_cpu_scaled(struct perf_evsel *evsel,int perf_evsel__parse_sample (struct perf_evsel *evsel,union perf_event *event,struct perf_sample *sample); +int perf_evsel__parse_sample_timestamp (struct perf_evsel *evsel, +union perf_event *event, +u64 *timestamp); +static inline struct perf_evsel *perf_evsel__next (struct perf_evsel *evsel) { return list_entry(evsel->node.next, struct perf_evsel, node);