DPDK 22.11.5
rte_jobstats.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015 Intel Corporation
3 */
4
5#ifndef JOBSTATS_H_
6#define JOBSTATS_H_
7
8#include <stdint.h>
9
10#include <rte_memory.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define RTE_JOBSTATS_NAMESIZE 32
17
18/* Forward declarations. */
19struct rte_jobstats_context;
20struct rte_jobstats;
21
32typedef void (*rte_job_update_period_cb_t)(struct rte_jobstats *job,
33 int64_t job_result);
34
35struct rte_jobstats {
36 uint64_t period;
39 uint64_t min_period;
42 uint64_t max_period;
45 int64_t target;
48 rte_job_update_period_cb_t update_period_cb;
51 uint64_t exec_time;
54 uint64_t min_exec_time;
57 uint64_t max_exec_time;
60 uint64_t exec_cnt;
63 char name[RTE_JOBSTATS_NAMESIZE];
66 struct rte_jobstats_context *context;
69
70struct rte_jobstats_context {
76 uint64_t state_time;
77
78 uint64_t loop_executed_jobs;
81 /* Statistics start. */
82
83 uint64_t exec_time;
86 uint64_t min_exec_time;
89 uint64_t max_exec_time;
98 uint64_t management_time;
99
100 uint64_t min_management_time;
103 uint64_t max_management_time;
106 uint64_t start_time;
109 uint64_t job_exec_cnt;
112 uint64_t loop_cnt;
115
126int
127rte_jobstats_context_init(struct rte_jobstats_context *ctx);
128
135void
136rte_jobstats_context_start(struct rte_jobstats_context *ctx);
137
145void
146rte_jobstats_context_finish(struct rte_jobstats_context *ctx);
147
154void
155rte_jobstats_context_reset(struct rte_jobstats_context *ctx);
156
177int
178rte_jobstats_init(struct rte_jobstats *job, const char *name,
179 uint64_t min_period, uint64_t max_period, uint64_t initial_period,
180 int64_t target);
181
191void
192rte_jobstats_set_target(struct rte_jobstats *job, int64_t target);
193
206int
207rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
208
220int
221rte_jobstats_abort(struct rte_jobstats *job);
222
239int
240rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value);
241
252void
253rte_jobstats_set_period(struct rte_jobstats *job, uint64_t period,
254 uint8_t saturate);
264void
265rte_jobstats_set_min(struct rte_jobstats *job, uint64_t period);
275void
276rte_jobstats_set_max(struct rte_jobstats *job, uint64_t period);
277
289void
290rte_jobstats_set_update_period_function(struct rte_jobstats *job,
291 rte_job_update_period_cb_t update_period_cb);
292
299void
300rte_jobstats_reset(struct rte_jobstats *job);
301
302#ifdef __cplusplus
303}
304#endif
305
306#endif /* JOBSTATS_H_ */
#define __rte_cache_aligned
Definition: rte_common.h:440