Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Steven Rostedt and committed by
Arnaldo Carvalho de Melo
c52d9e4e bb5a7316

+30 -2
+28 -2
tools/lib/traceevent/event-parse.c
··· 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 5196 * @pevent: a handle to the pevent 5197 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 */ 5201 5201 int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) 5202 5202 { 5203 5203 return parse_common_pid(pevent, rec->data); 5204 + } 5205 + 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 + */ 5213 + int 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 + */ 5227 + int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec) 5228 + { 5229 + return parse_common_flags(pevent, rec->data); 5204 5230 } 5205 5231 5206 5232 /**
+2
tools/lib/traceevent/event-parse.h
··· 709 709 int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); 710 710 struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); 711 711 int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); 712 + int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec); 713 + int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); 712 714 const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); 713 715 struct cmdline; 714 716 struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm,