EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_conf_t Struct Reference

#include <event_machine_init.h>

Collaboration diagram for em_conf_t:

Data Fields

uint16_t device_id
 
int event_timer
 
int thread_per_core
 
int process_per_core
 
uint32_t core_count
 
em_core_mask_t phys_mask
 
em_pool_cfg_t default_pool_cfg
 
struct { 
 
   em_log_func_t   log_fn 
 
   em_vlog_func_t   vlog_fn 
 
log 
 
em_api_hooks_t api_hooks
 
em_idle_hooks_t idle_hooks
 
uint32_t __internal_check
 

Detailed Description

Event Machine run-time configuration options given at startup to em_init()

The 'em_conf_t' struct should be initialized with em_conf_init() before use. This initialization provides better backwards compatibility since all options will be set to default values. The user must further set the needed configuration and call em_init():

em_conf_t conf;
em_conf_init(&conf); // init with default values
conf.thread_per_core = 1;
...
conf.core_count = N; // max number of EM cores for this instance
conf.phys_mask = set N bits; // allowed CPUs for this instance
...
ret = em_init(&conf); // on one core
...
em_conf_local_t conf_local;
em_conf_local_init(&conf_local); // init with default values
conf_local.core_type = select EM-core type;
...
ret = em_init_local(&conf_local); // on each core added to EM
...
void em_conf_local_init(em_conf_local_t *conf_local)
em_status_t em_init_local(const em_conf_local_t *conf_local)
void em_conf_init(em_conf_t *conf)
em_status_t em_init(const em_conf_t *conf)
em_core_mask_t phys_mask

Content is copied into EM by em_init().

Note
Several EM options are configured through compile-time defines. Run-time options allow using the same EM-lib with different configs. Also see the overridable EM runtime config file values, default file: config/em-odp.config
See also
em_conf_init(), em_init()
Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 100 of file event_machine_init.h.

Field Documentation

◆ __internal_check

uint32_t em_conf_t::__internal_check

Internal check - don't touch!

EM will verify that em_conf_init() has been called before calling em_init().

Definition at line 216 of file event_machine_init.h.

◆ api_hooks

em_api_hooks_t em_conf_t::api_hooks

User provided API callback hooks. Set only the needed hooks to avoid performance degradation. Only used if EM_API_HOOKS_ENABLE != 0

Definition at line 201 of file event_machine_init.h.

◆ core_count

uint32_t em_conf_t::core_count

Maximum number of concurrently running EM-cores allowed for this EM instance.

The max number of EM-cores is concerned with concurrently running EM-cores of the type EM_CORE_TYPE_CONTROL or EM_CORE_TYPE_WORKER. Additionally the user may create threads/processes of type EM_CORE_TYPE_EXTERNAL that are not included in this max count, see em_core_type_t.

EM-core ids will be assigned from the range of 0 to 'core_count-1' during local initialization. Based on the options given to em_init_local(), EM-cores will either be assigned in startup/init order regardless of the actual physical CPU ids, or, based on the user provided 'core_id'. Note that the range may be discountiguous if the user removes EM-cores from the middle of the range (by calling em_term_local()) or if the user requests specific core-ids with gaps in between.

The largest value that can be used for 'core_count' is the compile- time constant EM_MAX_CORES.

Default value is 0 and needs to be changed by the user.

Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 156 of file event_machine_init.h.

◆ default_pool_cfg

em_pool_cfg_t em_conf_t::default_pool_cfg

Pool configuration for the EM default pool (EM_POOL_DEFAULT). Default value is set by em_pool_cfg_init() and needs to be changed by the user.

Note that if the default pool configuration is also given in the config file through option 'startup_pools', it will override this default pool configuration.

Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 182 of file event_machine_init.h.

◆ device_id

uint16_t em_conf_t::device_id

EM device id - use different device ids for each EM instance or remote EM device that need to communicate with each other. Default value is 0.

Examples
dyn_cores.c.

Definition at line 106 of file event_machine_init.h.

◆ event_timer

int em_conf_t::event_timer

Event Timer: enable=1, disable=0. Default value is 0 (disable).

Examples
dyn_cores.c.

Definition at line 112 of file event_machine_init.h.

◆ idle_hooks

em_idle_hooks_t em_conf_t::idle_hooks

User provided idle callback hooks. Set only the needed hooks to avoid performance degradation. Only used if EM_IDLE_HOOKS_ENABLE != 0

Definition at line 208 of file event_machine_init.h.

◆ [struct]

struct { ... } em_conf_t::log

EM log functions. Default values are NULL and causes EM to use internal default log-functions.

Examples
dyn_cores.c.

◆ log_fn

em_log_func_t em_conf_t::log_fn

EM log function, user overridable, variable number of args

Examples
dyn_cores.c.

Definition at line 191 of file event_machine_init.h.

◆ phys_mask

em_core_mask_t em_conf_t::phys_mask

Core mask of physical CPUs allowed for EM-cores on this EM instance (this is a physical mask even though the 'em_core_mask_t' type is used).

Similarly to '.core_count', the physical CPU mask is concerned with concurrently running EM-cores of the type EM_CORE_TYPE_CONTROL or EM_CORE_TYPE_WORKER. Additionally the user may create threads/processes of type EM_CORE_TYPE_EXTERNAL that are not included in this mask, see em_core_type_t.

Default value is all-0 and needs to be changed by the user.

Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 171 of file event_machine_init.h.

◆ process_per_core

int em_conf_t::process_per_core

RunMode: EM run with one process per core. Set 'true' to select process-per-core mode. Default value is 0.

Note
The user must set either 'thread_per_core' or 'process_per_core' but not both.
Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 130 of file event_machine_init.h.

◆ thread_per_core

int em_conf_t::thread_per_core

RunMode: EM run with one thread per core. Set 'true' to select thread-per-core mode. This is the recommended mode, but the user must explicitly set it to enable. Default value is 0.

Note
The user must set either 'thread_per_core' or 'process_per_core' but not both.
Examples
bench_event.c, bench_pool.c, and dyn_cores.c.

Definition at line 122 of file event_machine_init.h.

◆ vlog_fn

em_vlog_func_t em_conf_t::vlog_fn

EM log function, user overridable, va_list

Examples
dyn_cores.c.

Definition at line 193 of file event_machine_init.h.


The documentation for this struct was generated from the following file: