linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tools lib traceevent: A couple of updates
@ 2016-11-18 22:53 Steven Rostedt
  2016-11-18 22:54 ` [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags Steven Rostedt
  2016-11-18 22:54 ` [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt
  0 siblings, 2 replies; 14+ messages in thread
From: Steven Rostedt @ 2016-11-18 22:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Andrew Morton

I noticed that I have these in my trace-cmd repo. I would like to sync
this up to the kernel tools directory.

Steven Rostedt (Red Hat) (2):
      tools lib traceevent: Add retrieval of preempt count and latency flags
      tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number

----
 tools/lib/traceevent/event-parse.c | 34 ++++++++++++++++++++++++++++++----
 tools/lib/traceevent/event-parse.h |  4 ++++
 2 files changed, 34 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-18 22:53 [PATCH 0/2] tools lib traceevent: A couple of updates Steven Rostedt
@ 2016-11-18 22:54 ` Steven Rostedt
  2016-11-22  6:52   ` Namhyung Kim
  2016-11-18 22:54 ` [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt
  1 sibling, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2016-11-18 22:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Andrew Morton

[-- Attachment #1: 0001-tools-lib-traceevent-Add-retrieval-of-preempt-count-.patch --]
[-- Type: text/plain, Size: 2970 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Add a way to retrieve the preempt count as well as the latency flags from a
pevent_record.

 int pevent_data_pc(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>
---
 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 664c90c8e22b..d6f3cc0a29b0 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5191,11 +5191,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 +5203,32 @@ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec)
 }
 
 /**
+ * pevent_data_pc - 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_pc(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 9ffde377e89d..41b3d2238ed3 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -712,6 +712,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_pc(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.10.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-18 22:53 [PATCH 0/2] tools lib traceevent: A couple of updates Steven Rostedt
  2016-11-18 22:54 ` [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags Steven Rostedt
@ 2016-11-18 22:54 ` Steven Rostedt
  2016-11-18 23:40   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2016-11-18 22:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Andrew Morton

[-- Attachment #1: 0002-tools-lib-traceevent-Use-USECS_PER_SEC-instead-of-ha.patch --]
[-- Type: text/plain, Size: 1389 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.

Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/lib/traceevent/event-parse.c | 4 ++--
 tools/lib/traceevent/event-parse.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d6f3cc0a29b0..2b85b339f6b9 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5465,8 +5465,8 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s,
 		} else {
 			usecs = (nsecs + 500) / NSECS_PER_USEC;
 			/* To avoid usecs larger than 1 sec */
-			if (usecs >= 1000000) {
-				usecs -= 1000000;
+			if (usecs >= USECS_PER_SEC) {
+				usecs -= USECS_PER_SEC;
 				secs++;
 			}
 			p = 6;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 41b3d2238ed3..b09dd49465b0 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -175,6 +175,8 @@ struct pevent_plugin_option {
 #define NSECS_PER_SEC		1000000000ULL
 #define NSECS_PER_USEC		1000ULL
 
+#define USECS_PER_SEC		1000000ULL
+
 enum format_flags {
 	FIELD_IS_ARRAY		= 1,
 	FIELD_IS_POINTER	= 2,
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-18 22:54 ` [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt
@ 2016-11-18 23:40   ` Arnaldo Carvalho de Melo
  2016-11-21 16:41     ` Steven Rostedt
  0 siblings, 1 reply; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-18 23:40 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Ingo Molnar, Jiri Olsa, Namhyung Kim, Andrew Morton

Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.

We already have it in tools/include/linux/time64.h :-)

- Arnaldo
 
> Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  tools/lib/traceevent/event-parse.c | 4 ++--
>  tools/lib/traceevent/event-parse.h | 2 ++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index d6f3cc0a29b0..2b85b339f6b9 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5465,8 +5465,8 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s,
>  		} else {
>  			usecs = (nsecs + 500) / NSECS_PER_USEC;
>  			/* To avoid usecs larger than 1 sec */
> -			if (usecs >= 1000000) {
> -				usecs -= 1000000;
> +			if (usecs >= USECS_PER_SEC) {
> +				usecs -= USECS_PER_SEC;
>  				secs++;
>  			}
>  			p = 6;
> diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> index 41b3d2238ed3..b09dd49465b0 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -175,6 +175,8 @@ struct pevent_plugin_option {
>  #define NSECS_PER_SEC		1000000000ULL
>  #define NSECS_PER_USEC		1000ULL
>  
> +#define USECS_PER_SEC		1000000ULL
> +
>  enum format_flags {
>  	FIELD_IS_ARRAY		= 1,
>  	FIELD_IS_POINTER	= 2,
> -- 
> 2.10.2
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-18 23:40   ` Arnaldo Carvalho de Melo
@ 2016-11-21 16:41     ` Steven Rostedt
  2016-11-21 19:11       ` Arnaldo Carvalho de Melo
                         ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Steven Rostedt @ 2016-11-21 16:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Ingo Molnar, Jiri Olsa, Namhyung Kim, Andrew Morton

On Fri, 18 Nov 2016 20:40:22 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
> > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > 
> > Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.  
> 
> We already have it in tools/include/linux/time64.h :-)

Here's v2 then. Can you take both patches?

-- Steve


>From 856b584cb783b658d200aa3fca8faba58d52ae82 Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Date: Tue, 9 Feb 2016 15:40:15 -0500
Subject: [PATCH] tools lib traceevent: Use USEC_PER_SEC instead of hardcoded
 number

Instead of using 1000000, use the define in time64.h instead.

Also remove the the duplicate defines for NSECS_PER_SEC.

Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/lib/traceevent/event-parse.c | 11 ++++++-----
 tools/lib/traceevent/event-parse.h |  3 ---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d6f3cc0a29b0..8206227866dc 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"
@@ -5450,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) {
@@ -5463,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;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 41b3d2238ed3..dfa06f4e7abf 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -172,9 +172,6 @@ struct pevent_plugin_option {
 #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
 #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
 
-#define NSECS_PER_SEC		1000000000ULL
-#define NSECS_PER_USEC		1000ULL
-
 enum format_flags {
 	FIELD_IS_ARRAY		= 1,
 	FIELD_IS_POINTER	= 2,
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-21 16:41     ` Steven Rostedt
@ 2016-11-21 19:11       ` Arnaldo Carvalho de Melo
  2016-11-22  6:53       ` Namhyung Kim
  2016-11-24  4:14       ` [tip:perf/core] " tip-bot for Steven Rostedt
  2 siblings, 0 replies; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-21 19:11 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Ingo Molnar, Jiri Olsa, Namhyung Kim, Andrew Morton

Em Mon, Nov 21, 2016 at 11:41:49AM -0500, Steven Rostedt escreveu:
> On Fri, 18 Nov 2016 20:40:22 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
> > > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > > 
> > > Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.  
> > 
> > We already have it in tools/include/linux/time64.h :-)
> 
> Here's v2 then. Can you take both patches?

Sure.

- Arnaldo
 
> -- Steve
> 
> 
> From 856b584cb783b658d200aa3fca8faba58d52ae82 Mon Sep 17 00:00:00 2001
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Date: Tue, 9 Feb 2016 15:40:15 -0500
> Subject: [PATCH] tools lib traceevent: Use USEC_PER_SEC instead of hardcoded
>  number
> 
> Instead of using 1000000, use the define in time64.h instead.
> 
> Also remove the the duplicate defines for NSECS_PER_SEC.
> 
> Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  tools/lib/traceevent/event-parse.c | 11 ++++++-----
>  tools/lib/traceevent/event-parse.h |  3 ---
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index d6f3cc0a29b0..8206227866dc 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"
> @@ -5450,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) {
> @@ -5463,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;
> diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> index 41b3d2238ed3..dfa06f4e7abf 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -172,9 +172,6 @@ struct pevent_plugin_option {
>  #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
>  #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
>  
> -#define NSECS_PER_SEC		1000000000ULL
> -#define NSECS_PER_USEC		1000ULL
> -
>  enum format_flags {
>  	FIELD_IS_ARRAY		= 1,
>  	FIELD_IS_POINTER	= 2,
> -- 
> 2.1.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-18 22:54 ` [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags Steven Rostedt
@ 2016-11-22  6:52   ` Namhyung Kim
  2016-11-22 14:33     ` Steven Rostedt
  2016-11-22 16:31     ` [PATCH v2] " Steven Rostedt
  0 siblings, 2 replies; 14+ messages in thread
From: Namhyung Kim @ 2016-11-22  6:52 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa,
	Andrew Morton

Hi Steve,

On Fri, Nov 18, 2016 at 05:54:00PM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> Add a way to retrieve the preempt count as well as the latency flags from a
> pevent_record.
> 
>  int pevent_data_pc(pevent, record);

I think pevent_data_preempt_count() is better..

Thanks,
Namhyung


> 
> 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>
> ---
>  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 664c90c8e22b..d6f3cc0a29b0 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5191,11 +5191,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 +5203,32 @@ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec)
>  }
>  
>  /**
> + * pevent_data_pc - 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_pc(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 9ffde377e89d..41b3d2238ed3 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -712,6 +712,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_pc(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.10.2
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-21 16:41     ` Steven Rostedt
  2016-11-21 19:11       ` Arnaldo Carvalho de Melo
@ 2016-11-22  6:53       ` Namhyung Kim
  2016-11-24  4:14       ` [tip:perf/core] " tip-bot for Steven Rostedt
  2 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2016-11-22  6:53 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Ingo Molnar, Jiri Olsa,
	Andrew Morton

On Mon, Nov 21, 2016 at 11:41:49AM -0500, Steven Rostedt wrote:
> On Fri, 18 Nov 2016 20:40:22 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
> > > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > > 
> > > Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.  
> > 
> > We already have it in tools/include/linux/time64.h :-)
> 
> Here's v2 then. Can you take both patches?
> 
> -- Steve
> 
> 
> From 856b584cb783b658d200aa3fca8faba58d52ae82 Mon Sep 17 00:00:00 2001
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Date: Tue, 9 Feb 2016 15:40:15 -0500
> Subject: [PATCH] tools lib traceevent: Use USEC_PER_SEC instead of hardcoded
>  number
> 
> Instead of using 1000000, use the define in time64.h instead.
> 
> Also remove the the duplicate defines for NSECS_PER_SEC.
> 
> Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  tools/lib/traceevent/event-parse.c | 11 ++++++-----
>  tools/lib/traceevent/event-parse.h |  3 ---
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index d6f3cc0a29b0..8206227866dc 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"
> @@ -5450,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) {
> @@ -5463,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;
> diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> index 41b3d2238ed3..dfa06f4e7abf 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -172,9 +172,6 @@ struct pevent_plugin_option {
>  #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
>  #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
>  
> -#define NSECS_PER_SEC		1000000000ULL
> -#define NSECS_PER_USEC		1000ULL
> -
>  enum format_flags {
>  	FIELD_IS_ARRAY		= 1,
>  	FIELD_IS_POINTER	= 2,
> -- 
> 2.1.0
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-22  6:52   ` Namhyung Kim
@ 2016-11-22 14:33     ` Steven Rostedt
  2016-11-22 16:31     ` [PATCH v2] " Steven Rostedt
  1 sibling, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2016-11-22 14:33 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa,
	Andrew Morton

On Tue, 22 Nov 2016 15:52:45 +0900
Namhyung Kim <namhyung@kernel.org> wrote:

> Hi Steve,
> 
> On Fri, Nov 18, 2016 at 05:54:00PM -0500, Steven Rostedt wrote:
> > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > 
> > Add a way to retrieve the preempt count as well as the latency flags from a
> > pevent_record.
> > 
> >  int pevent_data_pc(pevent, record);  
> 
> I think pevent_data_preempt_count() is better..

Sure, I'll send a v2.

Thanks,

-- Steve

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-22  6:52   ` Namhyung Kim
  2016-11-22 14:33     ` Steven Rostedt
@ 2016-11-22 16:31     ` Steven Rostedt
  2016-11-22 18:06       ` Arnaldo Carvalho de Melo
  2016-11-24  4:15       ` [tip:perf/core] " tip-bot for Steven Rostedt
  1 sibling, 2 replies; 14+ messages in thread
From: Steven Rostedt @ 2016-11-22 16:31 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa,
	Andrew Morton


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>
---
 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 664c90c8e22b..6e2dfcbf9e30 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5191,11 +5191,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 +5203,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 9ffde377e89d..82b83c4d621c 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -712,6 +712,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.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-22 16:31     ` [PATCH v2] " Steven Rostedt
@ 2016-11-22 18:06       ` Arnaldo Carvalho de Melo
  2016-11-23  4:45         ` Namhyung Kim
  2016-11-24  4:15       ` [tip:perf/core] " tip-bot for Steven Rostedt
  1 sibling, 1 reply; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-22 18:06 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Namhyung Kim, linux-kernel, Ingo Molnar, Jiri Olsa, Andrew Morton

Em Tue, Nov 22, 2016 at 11:31:58AM -0500, Steven Rostedt escreveu:
> 
> 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.

Namhyung, I'm preemptively adding your Acked-by, ok?

- Arnaldo
 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  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 664c90c8e22b..6e2dfcbf9e30 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5191,11 +5191,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 +5203,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 9ffde377e89d..82b83c4d621c 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -712,6 +712,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.1.0
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-22 18:06       ` Arnaldo Carvalho de Melo
@ 2016-11-23  4:45         ` Namhyung Kim
  0 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2016-11-23  4:45 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Steven Rostedt, linux-kernel, Ingo Molnar, Jiri Olsa, Andrew Morton

Hi Arnaldo and Steve,

On Tue, Nov 22, 2016 at 03:06:24PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 22, 2016 at 11:31:58AM -0500, Steven Rostedt escreveu:
> > 
> > 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.
> 
> Namhyung, I'm preemptively adding your Acked-by, ok?

Sure.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


>  
> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> > ---
> >  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 664c90c8e22b..6e2dfcbf9e30 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -5191,11 +5191,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 +5203,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 9ffde377e89d..82b83c4d621c 100644
> > --- a/tools/lib/traceevent/event-parse.h
> > +++ b/tools/lib/traceevent/event-parse.h
> > @@ -712,6 +712,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.1.0
> > 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [tip:perf/core] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
  2016-11-21 16:41     ` Steven Rostedt
  2016-11-21 19:11       ` Arnaldo Carvalho de Melo
  2016-11-22  6:53       ` Namhyung Kim
@ 2016-11-24  4:14       ` tip-bot for Steven Rostedt
  2 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Steven Rostedt @ 2016-11-24  4:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, hpa, namhyung, mingo, linux-kernel, acme, tglx, rostedt, akpm

Commit-ID:  bb5a7316b909612a382b30b568c6b0345b4b6768
Gitweb:     http://git.kernel.org/tip/bb5a7316b909612a382b30b568c6b0345b4b6768
Author:     Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Tue, 22 Nov 2016 15:00:31 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:02 -0300

tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number

Instead of using 1000000, use the define in time64.h instead.

Also remove the the duplicate defines for NSECS_PER_SEC.

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@kernel.org>
Link: http://lkml.kernel.org/r/20161121114149.67111981@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 11 ++++++-----
 tools/lib/traceevent/event-parse.h |  3 ---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 664c90c..c1ad1ff 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"
@@ -5424,8 +5425,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 +5438,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;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 9ffde37..783c842 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -172,9 +172,6 @@ struct pevent_plugin_option {
 #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
 #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
 
-#define NSECS_PER_SEC		1000000000ULL
-#define NSECS_PER_USEC		1000ULL
-
 enum format_flags {
 	FIELD_IS_ARRAY		= 1,
 	FIELD_IS_POINTER	= 2,

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip:perf/core] tools lib traceevent: Add retrieval of preempt count and latency flags
  2016-11-22 16:31     ` [PATCH v2] " Steven Rostedt
  2016-11-22 18:06       ` Arnaldo Carvalho de Melo
@ 2016-11-24  4:15       ` tip-bot for Steven Rostedt
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot for Steven Rostedt @ 2016-11-24  4:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, jolsa, tglx, akpm, hpa, namhyung, mingo, rostedt, acme

Commit-ID:  c52d9e4e677b0407fe553e9211802e2505a2f244
Gitweb:     http://git.kernel.org/tip/c52d9e4e677b0407fe553e9211802e2505a2f244
Author:     Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Tue, 22 Nov 2016 11:31:58 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:03 -0300

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>
---
 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 c1ad1ff..14a4f62 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 783c842..7aae746 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,

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-11-24  4:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 22:53 [PATCH 0/2] tools lib traceevent: A couple of updates Steven Rostedt
2016-11-18 22:54 ` [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags Steven Rostedt
2016-11-22  6:52   ` Namhyung Kim
2016-11-22 14:33     ` Steven Rostedt
2016-11-22 16:31     ` [PATCH v2] " Steven Rostedt
2016-11-22 18:06       ` Arnaldo Carvalho de Melo
2016-11-23  4:45         ` Namhyung Kim
2016-11-24  4:15       ` [tip:perf/core] " tip-bot for Steven Rostedt
2016-11-18 22:54 ` [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt
2016-11-18 23:40   ` Arnaldo Carvalho de Melo
2016-11-21 16:41     ` Steven Rostedt
2016-11-21 19:11       ` Arnaldo Carvalho de Melo
2016-11-22  6:53       ` Namhyung Kim
2016-11-24  4:14       ` [tip:perf/core] " tip-bot for Steven Rostedt

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