blob: a9ef81dfd5717c012518a8e115a6a220dfab2f7c (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP CPU API
*/
#ifndef ODP_CPU_H_
#define ODP_CPU_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/std_types.h>
/** @defgroup odp_cpu ODP CPU
* @{
*/
/**
* CPU identifier
*
* Determine CPU identifier on which the calling is running. CPU numbering is
* system specific.
*
* @return CPU identifier
*/
int odp_cpu_id(void);
/**
* CPU count
*
* Report the number of CPU's available to this ODP program.
* This may be smaller than the number of (online) CPU's in the system.
*
* @return Number of available CPU's
*/
int odp_cpu_count(void);
/**
* Current CPU cycle count
*
* Return current CPU cycle count. Cycle count may not be reset at ODP init
* and thus may wrap back to zero between two calls. Use odp_cpu_cycles_max()
* to read the maximum count value after which it wraps. Cycle count frequency
* follows the CPU frequency and thus may change at any time. The count may
* advance in steps larger than one. Use odp_cpu_cycles_resolution() to read
* the step size.
*
* @note Do not use CPU count for time measurements since the frequency may
* vary.
*
* @return Current CPU cycle count
*/
uint64_t odp_cpu_cycles(void);
/**
* CPU cycle count difference
*
* Calculate difference between cycle counts c1 and c2. Parameter c1 must be the
* first cycle count sample and c2 the second. The function handles correctly
* single cycle count wrap between c1 and c2.
*
* @param c2 Second cycle count
* @param c1 First cycle count
*
* @return CPU cycles from c1 to c2
*/
uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1);
/**
* Maximum CPU cycle count
*
* Maximum CPU cycle count value before it wraps back to zero.
*
* @return Maximum CPU cycle count value
*/
uint64_t odp_cpu_cycles_max(void);
/**
* Resolution of CPU cycle count
*
* CPU cycle count may advance in steps larger than one. This function returns
* resolution of odp_cpu_cycles() in CPU cycles.
*
* @return CPU cycle count resolution in CPU cycles
*/
uint64_t odp_cpu_cycles_resolution(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
|