tools lib traceevent: A couple of updates
cover tools lib traceevent: A couple of updates
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(-)
PATCH 1/2 tools lib traceevent: Add retrieval of preempt count and latency flags
From: "Steven Rostedt (Red Hat)" <[email protected]>
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.
--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +28 -2
@@ -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
tools/lib/traceevent/event-parse.h +2 -0
@@ -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,
Signature · 1 line
2.10.2
Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags
Hi Steve,
Quoted 6 lines · Steven Rostedt
From: "Steven Rostedt (Red Hat)" <[email protected]>
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
Quoted 81 lines
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 <[email protected]>--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)tools/lib/traceevent/event-parse.c +28
-2@@ -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 tools/lib/traceevent/event-parse.h +2
-0@@ -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,Signature · 1 line
2.10.2
Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags
Quoted 11 lines · On Tue, 22 Nov 2016 15:52:45 +0900 Namhyung Kim <[email protected]> wrote:
Hi Steve,
Quoted 6 lines · Steven Rostedt
From: "Steven Rostedt (Red Hat)" <[email protected]>
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
PATCH v2 1/1 tools lib traceevent: Add retrieval of preempt count and latency flags
In reply to Namhyung KimAdd 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.
--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +28 -2
@@ -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
tools/lib/traceevent/event-parse.h +2 -0
@@ -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,
Signature · 1 line
2.1.0
Re: [PATCH v2] tools lib traceevent: Add retrieval of preempt count and latency flags
Em Tue, Nov 22, 2016 at 11:31:58AM -0500, Steven Rostedt escreveu:
Quoted 11 lines
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
Quoted 73 lines
Signed-off-by Steven Rostedt <[email protected]>--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)tools/lib/traceevent/event-parse.c +28
-2@@ -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 tools/lib/traceevent/event-parse.h +2
-0@@ -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,Signature · 1 line
2.1.0
Namhyung Kim
Acked-byRe: [PATCH v2] tools lib traceevent: Add retrieval of preempt count and latency flags
Hi Arnaldo and Steve,
Quoted 7 lines · Arnaldo Carvalho de Melo
Em Tue, Nov 22, 2016 at 11:31:58AM -0500, Steven Rostedt escreveu:
Quoted 6 lines
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);
Quoted 7 lines
Quoted 5 lines
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.
Thanks,
Namhyung
Quoted 74 lines
Quoted 74 lines
Signed-off-by Steven Rostedt <[email protected]>--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)tools/lib/traceevent/event-parse.c +28
-2@@ -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 tools/lib/traceevent/event-parse.h +2
-0@@ -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,Signature · 1 line
2.1.0
tip-bot for Steven Rostedt
merge bot[tip:perf/core] tools lib traceevent: Add retrieval of preempt count and latency flags
In reply to Steven Rostedttools lib traceevent: Add retrieval of preempt count and latency flags
Commit-ID: c52d9e4e677b0407fe553e9211802e2505a2f244 Gitweb: http://git.kernel.org/tip/c52d9e4e677b0407fe553e9211802e2505a2f244 Author: Steven Rostedt <[email protected]> AuthorDate: Tue, 22 Nov 2016 11:31:58 -0500 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/lib/traceevent/event-parse.c | 30 ++++++++++++++++++++++++++++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +28 -2
@@ -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
tools/lib/traceevent/event-parse.h +2 -0
@@ -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,
PATCH 2/2 tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
In reply to Steven RostedtFrom: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.
--- tools/lib/traceevent/event-parse.c | 4 ++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +2 -2
@@ -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 ;
tools/lib/traceevent/event-parse.h +2 -0
@@ -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 ,
Signature · 1 line
2.10.2
Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
Quoted 3 lines
From: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of using 1000000, define a
USECS_PER_SECmacro and use that instead.
We already have it in tools/include/linux/time64.h :-)
- Arnaldo
Quoted 39 lines
Signed-off-by Steven Rostedt <[email protected]>--- tools/lib/traceevent/event-parse.c | 4 ++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)tools/lib/traceevent/event-parse.c +2
-2@@ -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 ;tools/lib/traceevent/event-parse.h +2
-0@@ -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 ,Signature · 1 line
2.10.2
Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Quoted 6 lines · On Fri, 18 Nov 2016 20:40:22 -0300 Arnaldo Carvalho de Melo <[email protected]>…
Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
Quoted 3 lines
From: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of using 1000000, define a
USECS_PER_SECmacro and use that instead.We already have it in
tools/include/linux/time64.h:-)
Here's v2 then. Can you take both patches?
-- Steve
Quoted 1 line
From
856b584cb783b658d200aa3fca8faba58d52ae82Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <[email protected]>
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.
--- tools/lib/traceevent/event-parse.c | 11 ++++++----- tools/lib/traceevent/event-parse.h | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +6 -5
@@ -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 ;
tools/lib/traceevent/event-parse.h +0 -3
@@ -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 ,
Signature · 1 line
2.1.0
Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Em Mon, Nov 21, 2016 at 11:41:49AM -0500, Steven Rostedt escreveu:
Quoted 11 lines
Quoted 6 lines · On Fri, 18 Nov 2016 20:40:22 -0300 Arnaldo Carvalho de Melo <[email protected]>…
Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
Quoted 3 lines
From: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of using 1000000, define a
USECS_PER_SECmacro 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
Quoted 74 lines
-- Steve
From
856b584cb783b658d200aa3fca8faba58d52ae82Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <[email protected]>
Date: Tue, 9 Feb 2016 15:40:15 -0500
Subject: [PATCH] tools lib traceevent: UseUSEC_PER_SECinstead of hardcoded
numberInstead of using 1000000, use the define in
time64.hinstead.Also remove the the duplicate defines for
NSECS_PER_SEC.Signed-off-by Steven Rostedt <[email protected]>--- tools/lib/traceevent/event-parse.c | 11 ++++++----- tools/lib/traceevent/event-parse.h | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-)tools/lib/traceevent/event-parse.c +6
-5@@ -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 ;tools/lib/traceevent/event-parse.h +0
-3@@ -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 ,Signature · 1 line
2.1.0
Namhyung Kim
Acked-byRe: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
In reply to Steven RostedtQuoted 21 lines · Steven Rostedt
Quoted 6 lines · On Fri, 18 Nov 2016 20:40:22 -0300 Arnaldo Carvalho de Melo <[email protected]>…
Em Fri, Nov 18, 2016 at 05:54:01PM -0500, Steven Rostedt escreveu:
Quoted 3 lines
From: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of using 1000000, define a
USECS_PER_SECmacro 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
856b584cb783b658d200aa3fca8faba58d52ae82Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <[email protected]>
Date: Tue, 9 Feb 2016 15:40:15 -0500
Subject: [PATCH] tools lib traceevent: UseUSEC_PER_SECinstead of hardcoded
number
Quoted 7 lines
Instead of using 1000000, use the define in
time64.hinstead.Also remove the the duplicate defines for
NSECS_PER_SEC.Signed-off-by Steven Rostedt <[email protected]>
Thanks,
Namhyung
Quoted 59 lines
--- tools/lib/traceevent/event-parse.c | 11 ++++++----- tools/lib/traceevent/event-parse.h | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-)tools/lib/traceevent/event-parse.c +6
-5@@ -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 ;tools/lib/traceevent/event-parse.h +0
-3@@ -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 ,Signature · 1 line
2.1.0
tip-bot for Steven Rostedt
merge bot[tip:perf/core] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
In reply to Steven Rostedttools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Commit-ID: bb5a7316b909612a382b30b568c6b0345b4b6768 Gitweb: http://git.kernel.org/tip/bb5a7316b909612a382b30b568c6b0345b4b6768 Author: Steven Rostedt <[email protected]> AuthorDate: Tue, 22 Nov 2016 15:00:31 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/lib/traceevent/event-parse.c | 11 ++++++----- tools/lib/traceevent/event-parse.h | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +6 -5
@@ -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 ;
tools/lib/traceevent/event-parse.h +0 -3
@@ -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 ,