Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3711020 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf time-utils: Adopt rdclock() from perf.h

Seems to be a better place for this function to live, further shrinking
the hodge-podge that perf.h was.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-0zzt1u9rpyjukdy1ccr2u5r9@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 91854f9a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@
#include "util/string2.h"
#include "util/string2.h"
#include "util/metricgroup.h"
#include "util/metricgroup.h"
#include "util/target.h"
#include "util/target.h"
#include "util/time-utils.h"
#include "util/top.h"
#include "util/top.h"
#include "asm/bug.h"
#include "asm/bug.h"


+0 −9
Original line number Original line Diff line number Diff line
@@ -2,17 +2,8 @@
#ifndef _PERF_PERF_H
#ifndef _PERF_PERF_H
#define _PERF_PERF_H
#define _PERF_PERF_H


#include <time.h>
#include <stdbool.h>
#include <stdbool.h>


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
#ifndef MAX_NR_CPUS
#define MAX_NR_CPUS			2048
#define MAX_NR_CPUS			2048
#endif
#endif
+1 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include "strlist.h"
#include "strlist.h"
#include "thread.h"
#include "thread.h"
#include "thread_map.h"
#include "thread_map.h"
#include "time-utils.h"
#include <linux/ctype.h>
#include <linux/ctype.h>
#include "map.h"
#include "map.h"
#include "symbol.h"
#include "symbol.h"
+9 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@
#define _TIME_UTILS_H_
#define _TIME_UTILS_H_


#include <stddef.h>
#include <stddef.h>
#include <time.h>
#include <linux/types.h>
#include <linux/types.h>


struct perf_time_interval {
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);
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
#endif