EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_cli_types.h
Go to the documentation of this file.
1/* Copyright (c) 2021, Nokia
2 * All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/**
8 * @file
9 * EM Command Line Interface support
10 */
11
12#ifndef EM_CLI_TYPES_H_
13#define EM_CLI_TYPES_H_
14
15#include <stdbool.h>
16#include <stddef.h> /* offsetof */
17#include <stdint.h>
18
19#include <odp_api.h>
20#include <odp/helper/odph_api.h>
21
22#include <event_machine.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#if EM_CLI
30typedef struct {
31 struct {
32 odp_atomic_u32_t seq;
33
34 bool while_idle;
35 odp_time_t to_active;
36 odp_time_t to_idle;
37 uint64_t active_sum;
38
39 /** Previous active sum for this core */
40 uint64_t prev_active_sum;
41
42 /** pad size to a multiple of cache line size */
43 void *end[0] ENV_CACHE_LINE_ALIGNED;
45
46 /** Start time for calcuting core usage */
47 odp_time_t t0;
48
49 /** Previous measure time */
50 odp_time_t t_prev;
51} em_cli_top_t;
52
53/* Verify that the core_times starts at a cache lines */
54COMPILE_TIME_ASSERT(offsetof(em_cli_top_t, core_times) % ENV_CACHE_LINE_SIZE == 0,
55 OFFSETOF_CORE_TIMES_ERROR);
56
57/* Verify that the core_times[1] starts at a separate cache lines */
58COMPILE_TIME_ASSERT(offsetof(em_cli_top_t, core_times[1]) % ENV_CACHE_LINE_SIZE == 0,
59 OFFSETOF_CORE_TIMES_1_ERROR);
60
61/* Verify that the core_times member size is a multiple of cache lines */
62COMPILE_TIME_ASSERT((offsetof(em_cli_top_t, core_times[1]) -
63 offsetof(em_cli_top_t, core_times[0])) %
64 ENV_CACHE_LINE_SIZE == 0,
65 EM_CLI_TOP_CORE_TIMES_SIZE_ERROR);
66typedef struct {
67 /** Handle for this shared memory */
68 odp_shm_t this_shm;
69 /** ODP control thread for running EM-CLI server */
70 odph_thread_t em_cli_thread;
71 /** Has the EM-CLI server thread been created? Is a join() needed or not */
72 bool server_thr_created;
73 /** Did odph_cli_run() fail? Should odph_cli_stop() be called or not? */
74 bool run_failed;
75
76 /** Data used by cli top command */
77 em_cli_top_t top;
78} em_cli_shm_t;
79
80#endif /* EM_CLI */
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* EM_CLI_TYPES_H_ */
#define EM_MAX_CORES