aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_cpu.c
blob: cfdb1cfdbf0d54e3e95ed2cdf11fdd5502567668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Copyright (c) 2015-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#include "config.h"

#include <odp/api/cpu.h>
#include <odp/api/hints.h>

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

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