diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index a7e8c26635db..2741bcb049fb 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -62,6 +62,7 @@ #include "util/string2.h" #include "util/metricgroup.h" #include "util/target.h" +#include "util/time-utils.h" #include "util/top.h" #include "asm/bug.h" diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 7a1a92127b9b..74014033df60 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -2,17 +2,8 @@ #ifndef _PERF_PERF_H #define _PERF_PERF_H -#include #include -static inline unsigned long long rdclock(void) -{ - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - return ts.tv_sec * 1000000000ULL + ts.tv_nsec; -} - #ifndef MAX_NR_CPUS #define MAX_NR_CPUS 2048 #endif diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index c9d1f83c747a..7fa7a303e476 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -21,6 +21,7 @@ #include "strlist.h" #include "thread.h" #include "thread_map.h" +#include "time-utils.h" #include #include "map.h" #include "symbol.h" diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h index 72a42ea1d513..4f42988eb2f7 100644 --- a/tools/perf/util/time-utils.h +++ b/tools/perf/util/time-utils.h @@ -3,6 +3,7 @@ #define _TIME_UTILS_H_ #include +#include #include struct perf_time_interval { @@ -34,4 +35,12 @@ int timestamp__scnprintf_nsec(u64 timestamp, char *buf, size_t sz); int fetch_current_timestamp(char *buf, size_t sz); +static inline unsigned long long rdclock(void) +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec * 1000000000ULL + ts.tv_nsec; +} + #endif