summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2016-11-22 11:31:58 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-23 08:44:03 -0500
commitc52d9e4e677b0407fe553e9211802e2505a2f244 (patch)
treee29777a93f6525a2cfa96ea62ac813a4d9277826 /tools/lib
parentbb5a7316b909612a382b30b568c6b0345b4b6768 (diff)
tools lib traceevent: Add retrieval of preempt count and latency flags
Add a way to retrieve the preempt count as well as the latency flags from a pevent_record. int pevent_data_preempt_count(pevent, record); returns the preempt count of a record. int pevent_data_flags(pevent, record); returns the latency flags for a record. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20161122113158.03a010a8@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/traceevent/event-parse.c30
-rw-r--r--tools/lib/traceevent/event-parse.h2
2 files changed, 30 insertions, 2 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index c1ad1ffa7335..14a4f623c1a5 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5192,11 +5192,11 @@ struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type
5192} 5192}
5193 5193
5194/** 5194/**
5195 * pevent_data_pid - parse the PID from raw data 5195 * pevent_data_pid - parse the PID from record
5196 * @pevent: a handle to the pevent 5196 * @pevent: a handle to the pevent
5197 * @rec: the record to parse 5197 * @rec: the record to parse
5198 * 5198 *
5199 * This returns the PID from a raw data. 5199 * This returns the PID from a record.
5200 */ 5200 */
5201int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) 5201int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec)
5202{ 5202{
@@ -5204,6 +5204,32 @@ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec)
5204} 5204}
5205 5205
5206/** 5206/**
5207 * pevent_data_prempt_count - parse the preempt count from the record
5208 * @pevent: a handle to the pevent
5209 * @rec: the record to parse
5210 *
5211 * This returns the preempt count from a record.
5212 */
5213int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec)
5214{
5215 return parse_common_pc(pevent, rec->data);
5216}
5217
5218/**
5219 * pevent_data_flags - parse the latency flags from the record
5220 * @pevent: a handle to the pevent
5221 * @rec: the record to parse
5222 *
5223 * This returns the latency flags from a record.
5224 *
5225 * Use trace_flag_type enum for the flags (see event-parse.h).
5226 */
5227int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec)
5228{
5229 return parse_common_flags(pevent, rec->data);
5230}
5231
5232/**
5207 * pevent_data_comm_from_pid - return the command line from PID 5233 * pevent_data_comm_from_pid - return the command line from PID
5208 * @pevent: a handle to the pevent 5234 * @pevent: a handle to the pevent
5209 * @pid: the PID of the task to search for 5235 * @pid: the PID of the task to search for
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 783c842d6517..7aae746ec2fe 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -709,6 +709,8 @@ void pevent_data_lat_fmt(struct pevent *pevent,
709int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); 709int pevent_data_type(struct pevent *pevent, struct pevent_record *rec);
710struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); 710struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type);
711int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); 711int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec);
712int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec);
713int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec);
712const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); 714const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
713struct cmdline; 715struct cmdline;
714struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm, 716struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm,