blob: c8cf27b654d849bc35cb6583e1cb5fb2a22d2fac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <odp/api/cpu.h>
uint64_t odp_cpu_cycles(void)
{
union {
uint64_t tsc_64;
struct {
uint32_t lo_32;
uint32_t hi_32;
};
} tsc;
__asm__ __volatile__ ("rdtsc" :
"=a" (tsc.lo_32),
"=d" (tsc.hi_32) : : "memory");
return tsc.tsc_64;
}
uint64_t odp_cpu_cycles_max(void)
{
return UINT64_MAX;
}
uint64_t odp_cpu_cycles_resolution(void)
{
return 1;
}
|