aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-keystone2/odp_cpu_cycles.c
blob: e86a3387b794fecfe34e2f348e9598e5c1b18b21 (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
34
/*
 * Copyright (c) 2015, Linaro Limited
 * Copyright (c) 2015, Texas Instruments Incorporated
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#include <odp/cpu.h>
#include <odp/hints.h>
#include <odp/plat/ti_mcsdk.h>

uint64_t odp_cpu_cycles(void)
{
	return hplib_mUtilGetPmuCCNT();
}

uint64_t odp_cpu_cycles_max(void)
{
	return UINT32_MAX;
}

uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
{
	if (odp_likely(c2 >= c1))
		return c2 - c1;

	return c2 + (UINT32_MAX - c1) + 1;
}

uint64_t odp_cpu_cycles_resolution(void)
{
	return 1;
}