DPDK 21.11.9
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#include <rte_memcpy.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#define RTE_JOBSTATS_NAMESIZE 32
18
19/* Forward declarations. */
20struct rte_jobstats_context;
21struct rte_jobstats;
22
33typedef void (*rte_job_update_period_cb_t)(struct rte_jobstats *job,
34 int64_t job_result);
35
36struct rte_jobstats {
37 uint64_t period;
40 uint64_t min_period;
43 uint64_t max_period;
46 int64_t target;
49 rte_job_update_period_cb_t update_period_cb;
52 uint64_t exec_time;
55 uint64_t min_exec_time;
58 uint64_t max_exec_time;
61 uint64_t exec_cnt;
64 char name[RTE_JOBSTATS_NAMESIZE];
67 struct rte_jobstats_context *context;
70
71struct rte_jobstats_context {
77 uint64_t state_time;
78
79 uint64_t loop_executed_jobs;
82 /* Statistics start. */
83
84 uint64_t exec_time;
87 uint64_t min_exec_time;
90 uint64_t max_exec_time;
99 uint64_t management_time;
100
101 uint64_t min_management_time;
104 uint64_t max_management_time;
107 uint64_t start_time;
110 uint64_t job_exec_cnt;
113 uint64_t loop_cnt;
116
127int
128rte_jobstats_context_init(struct rte_jobstats_context *ctx);
129
136void
137rte_jobstats_context_start(struct rte_jobstats_context *ctx);
138
146void
147rte_jobstats_context_finish(struct rte_jobstats_context *ctx);
148
155void
156rte_jobstats_context_reset(struct rte_jobstats_context *ctx);
157
178int
179rte_jobstats_init(struct rte_jobstats *job, const char *name,
180 uint64_t min_period, uint64_t max_period, uint64_t initial_period,
181 int64_t target);
182
192void
193rte_jobstats_set_target(struct rte_jobstats *job, int64_t target);
194
207int
208rte_jobstats_start(struct rte_jobstats_context *ctx, struct rte_jobstats *job);
209
221int
222rte_jobstats_abort(struct rte_jobstats *job);
223
240int
241rte_jobstats_finish(struct rte_jobstats *job, int64_t job_value);
242
253void
254rte_jobstats_set_period(struct rte_jobstats *job, uint64_t period,
255 uint8_t saturate);
265void
266rte_jobstats_set_min(struct rte_jobstats *job, uint64_t period);
276void
277rte_jobstats_set_max(struct rte_jobstats *job, uint64_t period);
278
290void
291rte_jobstats_set_update_period_function(struct rte_jobstats *job,
292 rte_job_update_period_cb_t update_period_cb);
293
300void
301rte_jobstats_reset(struct rte_jobstats *job);
302
303#ifdef __cplusplus
304}
305#endif
306
307#endif /* JOBSTATS_H_ */
#define __rte_cache_aligned
Definition: rte_common.h:420