forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_event_manager_profiler_tracer.h
83 lines (62 loc) · 1.91 KB
/
app_event_manager_profiler_tracer.h
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
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/** @file
* @brief Application Event Manager profiler tracer header.
*/
#ifndef _APP_EVENT_MANAGER_PROFILER_TRACER_H_
#define _APP_EVENT_MANAGER_PROFILER_TRACER_H_
/**
* @defgroup app_event_manager_profiler_tracer Application Event Manager profiler tracer
* @brief Application Event Manager profiler tracer
*
* @{
*/
#include <app_event_manager_profiler_tracer_priv.h>
#include <nrf_profiler.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Event description for profiling.
*/
struct nrf_profiler_info {
/** Function for profiling data related with this event */
void (*profile_fn)(struct log_event_buf *buf, const struct app_event_header *aeh);
/** Number of profiled data fields. */
const uint8_t nrf_profiler_arg_cnt;
/** Labels of profiled data fields. */
const char **nrf_profiler_arg_labels;
/** Types of profiled data fields. */
const enum nrf_profiler_arg *nrf_profiler_arg_types;
/** Profiled event name. */
const char *name;
};
/** Encode event data types or labels.
*
* @param ... Data types or labels to be encoded.
*/
#define ENCODE(...) __VA_ARGS__
/** Define event profiling information.
*
* This macro provides definitions required for an event to be profiled.
*
* @note Types and labels of the profiled values should be wrapped
* with the @ref ENCODE macro.
*
* @param ename Name of the event.
* @param types Types of values to profile (represented as @ref nrf_profiler_arg).
* @param labels Labels of values to profile.
* @param profile_func Function used to profile event data.
*/
#define APP_EVENT_INFO_DEFINE(ename, types, labels, profile_func) \
BUILD_ASSERT(profile_func != NULL); \
_APP_EVENT_INFO_DEFINE(ename, ENCODE(types), ENCODE(labels), profile_func)
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* _APP_EVENT_MANAGER_PROFILER_TRACER_H_ */