linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 05/18] tools lib traceevent: Add retrieval of preempt count and latency flags
Date: Wed, 23 Nov 2016 13:40:05 -0300	[thread overview]
Message-ID: <1479919218-6367-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1479919218-6367-1-git-send-email-acme@kernel.org>

From: Steven Rostedt <rostedt@goodmis.org>

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>
---
 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

  parent reply	other threads:[~2016-11-23 16:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 16:40 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 01/18] perf annotate: Start supporting cross arch annotation Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 02/18] perf annotate: Allow arches to specify functions to skip Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 03/18] perf annotate: Add per arch instructions annotate handlers Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 04/18] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Arnaldo Carvalho de Melo
2016-11-23 16:40 ` Arnaldo Carvalho de Melo [this message]
2016-11-23 16:40 ` [PATCH 06/18] perf tools: Show event fd in debug output Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 07/18] perf c2c report: Setup browser after opening perf.data Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 08/18] perf c2c report: Add -f/--force option Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 09/18] perf c2c report: Add struct c2c_stats::tot_hitm field Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 10/18] perf c2c report: Display total HITMs on default Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 11/18] perf c2c: Support cascading options Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 12/18] perf symbols: Print symbol offsets conditionally Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 13/18] perf evsel: Support printing callchains with arrows Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 14/18] perf sched timehist: Introduce timehist command Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 15/18] perf sched timehist: Add summary options Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 16/18] perf sched timehist: Add -w/--wakeups option Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 17/18] perf sched timehist: Add call graph options Arnaldo Carvalho de Melo
2016-11-23 16:40 ` [PATCH 18/18] perf sched timehist: Add -V/--cpu-visual option Arnaldo Carvalho de Melo
2016-11-24  4:10 ` [GIT PULL 00/18] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479919218-6367-6-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).