diff options
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 664c90c8e22b..14a4f623c1a5 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -33,6 +33,7 @@ #include <stdint.h> #include <limits.h> #include <linux/string.h> +#include <linux/time64.h> #include <netinet/in.h> #include "event-parse.h" @@ -5191,11 +5192,11 @@ struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type } /** - * pevent_data_pid - parse the PID from raw data + * pevent_data_pid - parse the PID from record * @pevent: a handle to the pevent * @rec: the record to parse * - * This returns the PID from a raw data. + * This returns the PID from a record. */ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) { @@ -5203,6 +5204,32 @@ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) } /** + * pevent_data_prempt_count - parse the preempt count from the record + * @pevent: a handle to the pevent + * @rec: the record to parse + * + * This returns the preempt count from a record. + */ +int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec) +{ + return parse_common_pc(pevent, rec->data); +} + +/** + * pevent_data_flags - parse the latency flags from the record + * @pevent: a handle to the pevent + * @rec: the record to parse + * + * This returns the latency flags from a record. + * + * Use trace_flag_type enum for the flags (see event-parse.h). + */ +int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec) +{ + return parse_common_flags(pevent, rec->data); +} + +/** * pevent_data_comm_from_pid - return the command line from PID * @pevent: a handle to the pevent * @pid: the PID of the task to search for @@ -5424,8 +5451,8 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, use_usec_format = is_timestamp_in_us(pevent->trace_clock, use_trace_clock); if (use_usec_format) { - secs = record->ts / NSECS_PER_SEC; - nsecs = record->ts - secs * NSECS_PER_SEC; + secs = record->ts / NSEC_PER_SEC; + nsecs = record->ts - secs * NSEC_PER_SEC; } if (pevent->latency_format) { @@ -5437,10 +5464,10 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, usecs = nsecs; p = 9; } else { - usecs = (nsecs + 500) / NSECS_PER_USEC; + usecs = (nsecs + 500) / NSEC_PER_USEC; /* To avoid usecs larger than 1 sec */ - if (usecs >= 1000000) { - usecs -= 1000000; + if (usecs >= USEC_PER_SEC) { + usecs -= USEC_PER_SEC; secs++; } p = 6; |