From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756854AbcKWQka (ORCPT ); Wed, 23 Nov 2016 11:40:30 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:44696 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756830AbcKWQk3 (ORCPT ); Wed, 23 Nov 2016 11:40:29 -0500 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Steven Rostedt , Andrew Morton , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 05/18] tools lib traceevent: Add retrieval of preempt count and latency flags Date: Wed, 23 Nov 2016 13:40:05 -0300 Message-Id: <1479919218-6367-6-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479919218-6367-1-git-send-email-acme@kernel.org> References: <1479919218-6367-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt 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 Acked-by: Namhyung Kim Cc: Andrew Morton Cc: Jiri Olsa Link: http://lkml.kernel.org/r/20161122113158.03a010a8@gandalf.local.home Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 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 } /** - * 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) { @@ -5204,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 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, int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); +int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec); +int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); struct cmdline; struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm, -- 2.7.4