aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/cycles.h
blob: e832d82a38fcd6c84865997bd2308d8b90df406d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef ASM_CYCLES_H
#define ASM_CYCLES_H

#include <stdint.h>
#include <inttypes.h>

typedef uint64_t cycles_t;

#define CYCLES_FMT PRIu64

static inline cycles_t get_cycles(void)
{
	cycles_t c;
	asm volatile(
		"isb\n"
		"mrs %0, cntvct_el0" : "=r" (c));
	return c;
}

#endif