[tip:perf/core] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  bd48c63eb0afc28b29fb342f215cdd77b995c02e
Gitweb: http://git.kernel.org/tip/bd48c63eb0afc28b29fb342f215cdd77b995c02e
Author: Arnaldo Carvalho de Melo 
AuthorDate: Fri, 5 Aug 2016 15:40:30 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

And remove it from tools/perf/{perf,util}.h, making code that needs
these macros to include linux/time64.h instead, to match how this is
used in the kernel sources.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-e69fc1pvkgt57yvxqt6eu...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/include/linux/time64.h   | 12 
 tools/perf/MANIFEST|  1 +
 tools/perf/builtin-kvm.c   |  1 +
 tools/perf/builtin-script.c|  7 ---
 tools/perf/builtin-stat.c  |  7 ---
 tools/perf/builtin-trace.c |  1 +
 tools/perf/perf.h  |  7 ---
 tools/perf/util/debug.c| 10 --
 tools/perf/util/scripting-engines/trace-event-perl.c   |  5 +++--
 tools/perf/util/scripting-engines/trace-event-python.c |  5 +++--
 tools/perf/util/util.c |  1 +
 tools/perf/util/util.h |  4 
 12 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/tools/include/linux/time64.h b/tools/include/linux/time64.h
new file mode 100644
index 000..df92654
--- /dev/null
+++ b/tools/include/linux/time64.h
@@ -0,0 +1,12 @@
+#ifndef _TOOLS_LINUX_TIME64_H
+#define _TOOLS_LINUX_TIME64_H
+
+#define MSEC_PER_SEC   1000L
+#define USEC_PER_MSEC  1000L
+#define NSEC_PER_USEC  1000L
+#define NSEC_PER_MSEC  100L
+#define USEC_PER_SEC   100L
+#define NSEC_PER_SEC   10L
+#define FSEC_PER_SEC   1000LL
+
+#endif /* _LINUX_TIME64_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ad2534d..f23a5e7 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -77,4 +77,5 @@ tools/include/linux/stringify.h
 tools/include/linux/types.h
 tools/include/linux/err.h
 tools/include/linux/bitmap.h
+tools/include/linux/time64.h
 tools/arch/*/include/uapi/asm/perf_regs.h
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 5e2127e..a0040f7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -24,6 +24,7 @@
 #include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c859e59..6b3c8b0 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@
 #include "util/thread-stack.h"
 #include 
 #include 
+#include 
 #include "asm/bug.h"
 #include "util/mem-events.h"
 
@@ -464,9 +465,9 @@ static void print_sample_start(struct perf_sample *sample,
 
if (PRINT_FIELD(TIME)) {
nsecs = sample->time;
-   secs = nsecs / NSECS_PER_SEC;
-   nsecs -= secs * NSECS_PER_SEC;
-   usecs = nsecs / NSECS_PER_USEC;
+   secs = nsecs / NSEC_PER_SEC;
+   nsecs -= secs * NSEC_PER_SEC;
+   usecs = nsecs / NSEC_PER_USEC;
if (nanosecs)
printf("%5lu.%09llu: ", secs, nsecs);
else
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3c7452b..e33a66b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -65,6 +65,7 @@
 #include "util/group.h"
 #include "asm/bug.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -354,7 +355,7 @@ static void process_interval(void)
diff_timespec(, , _time);
 
if (STAT_RECORD) {
-   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + 
rs.tv_nsec, INTERVAL))
+   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSEC_PER_SEC + 
rs.tv_nsec, INTERVAL))
pr_err("failed to write stat round event\n");
}
 
@@ -2175,8 +2176,8 @@ static int process_stat_round_event(struct perf_tool 
*tool __maybe_unused,
update_stats(_nsecs_stats, stat_round->time);
 
if (stat_config.interval && stat_round->time) {
-   tsh.tv_sec  = stat_round->time / NSECS_PER_SEC;
-   tsh.tv_nsec = stat_round->time % NSECS_PER_SEC;
+   tsh.tv_sec  = stat_round->time / NSEC_PER_SEC;
+   tsh.tv_nsec = stat_round->time % NSEC_PER_SEC;
ts = 
}
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 

[tip:perf/core] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  bd48c63eb0afc28b29fb342f215cdd77b995c02e
Gitweb: http://git.kernel.org/tip/bd48c63eb0afc28b29fb342f215cdd77b995c02e
Author: Arnaldo Carvalho de Melo 
AuthorDate: Fri, 5 Aug 2016 15:40:30 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

And remove it from tools/perf/{perf,util}.h, making code that needs
these macros to include linux/time64.h instead, to match how this is
used in the kernel sources.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-e69fc1pvkgt57yvxqt6eu...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/include/linux/time64.h   | 12 
 tools/perf/MANIFEST|  1 +
 tools/perf/builtin-kvm.c   |  1 +
 tools/perf/builtin-script.c|  7 ---
 tools/perf/builtin-stat.c  |  7 ---
 tools/perf/builtin-trace.c |  1 +
 tools/perf/perf.h  |  7 ---
 tools/perf/util/debug.c| 10 --
 tools/perf/util/scripting-engines/trace-event-perl.c   |  5 +++--
 tools/perf/util/scripting-engines/trace-event-python.c |  5 +++--
 tools/perf/util/util.c |  1 +
 tools/perf/util/util.h |  4 
 12 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/tools/include/linux/time64.h b/tools/include/linux/time64.h
new file mode 100644
index 000..df92654
--- /dev/null
+++ b/tools/include/linux/time64.h
@@ -0,0 +1,12 @@
+#ifndef _TOOLS_LINUX_TIME64_H
+#define _TOOLS_LINUX_TIME64_H
+
+#define MSEC_PER_SEC   1000L
+#define USEC_PER_MSEC  1000L
+#define NSEC_PER_USEC  1000L
+#define NSEC_PER_MSEC  100L
+#define USEC_PER_SEC   100L
+#define NSEC_PER_SEC   10L
+#define FSEC_PER_SEC   1000LL
+
+#endif /* _LINUX_TIME64_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ad2534d..f23a5e7 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -77,4 +77,5 @@ tools/include/linux/stringify.h
 tools/include/linux/types.h
 tools/include/linux/err.h
 tools/include/linux/bitmap.h
+tools/include/linux/time64.h
 tools/arch/*/include/uapi/asm/perf_regs.h
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 5e2127e..a0040f7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -24,6 +24,7 @@
 #include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c859e59..6b3c8b0 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@
 #include "util/thread-stack.h"
 #include 
 #include 
+#include 
 #include "asm/bug.h"
 #include "util/mem-events.h"
 
@@ -464,9 +465,9 @@ static void print_sample_start(struct perf_sample *sample,
 
if (PRINT_FIELD(TIME)) {
nsecs = sample->time;
-   secs = nsecs / NSECS_PER_SEC;
-   nsecs -= secs * NSECS_PER_SEC;
-   usecs = nsecs / NSECS_PER_USEC;
+   secs = nsecs / NSEC_PER_SEC;
+   nsecs -= secs * NSEC_PER_SEC;
+   usecs = nsecs / NSEC_PER_USEC;
if (nanosecs)
printf("%5lu.%09llu: ", secs, nsecs);
else
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3c7452b..e33a66b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -65,6 +65,7 @@
 #include "util/group.h"
 #include "asm/bug.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -354,7 +355,7 @@ static void process_interval(void)
diff_timespec(, , _time);
 
if (STAT_RECORD) {
-   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + 
rs.tv_nsec, INTERVAL))
+   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSEC_PER_SEC + 
rs.tv_nsec, INTERVAL))
pr_err("failed to write stat round event\n");
}
 
@@ -2175,8 +2176,8 @@ static int process_stat_round_event(struct perf_tool 
*tool __maybe_unused,
update_stats(_nsecs_stats, stat_round->time);
 
if (stat_config.interval && stat_round->time) {
-   tsh.tv_sec  = stat_round->time / NSECS_PER_SEC;
-   tsh.tv_nsec = stat_round->time % NSECS_PER_SEC;
+   tsh.tv_sec  = stat_round->time / NSEC_PER_SEC;
+   tsh.tv_nsec = stat_round->time % NSEC_PER_SEC;
ts = 
}
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index b8c6766..b4fc1ab 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifndef O_CLOEXEC
 # define