EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
event_machine_debug.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022-2026, Nokia Solutions and Networks
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30#ifndef EVENT_MACHINE_DEBUG_H_
31#define EVENT_MACHINE_DEBUG_H_
32
33#pragma GCC visibility push(default)
34
35/**
36 * @file
37 * Event Machine helper functions for debug support
38 *
39 * Not for normal application use, may lower performance or cause latency.
40 */
41
42#include <stdint.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 * EM dispatcher debug timestamp points
50 * EM_DEBUG_TSP_SCHED_ENTRY: EM core local timestamp taken by the dispatcher
51 * _before_ asking the scheduler for new events.
52 * EM_DEBUG_TSP_SCHED_RETURN: EM core local timestamp taken by the dispatcher
53 * _after_ returning from the scheduler.
54 */
55typedef enum {
56 EM_DEBUG_TSP_SCHED_ENTRY, /* timestamp at scheduler entry */
57 EM_DEBUG_TSP_SCHED_RETURN, /* timestamp at scheduler return */
58 EM_DEBUG_TSP_LAST
60
61/**
62 * Returns a per core timestamp from the EM dispatcher.
63 *
64 * Not intended for normal application use!
65 * These debug timestamps are disabled by default and must be enabled by the
66 * user (see configure option '--enable-debug-timestamps=...' or the
67 * EM_DEBUG_TIMESTAMP_ENABLE define).
68 *
69 * Timestamps are taken with odp_time_global/_strict() and converted to ns.
70 * The timestamps can be used to e.g. measure the EM dispatcher overhead from
71 * EM_DEBUG_TSP_SCHED_RETURN to the EO-receive() including all code and hooks
72 * in between.
73 *
74 * If debug timestamps are disabled or the given timestamp point does not exist,
75 * 0 will be returned.
76 *
77 * @param tsp timestamp point, selects which EM internal timestamp to return
78 *
79 * @return timestamp in ns
80 * @retval 0 if debug timestamps are disabled or the given timestamp point does not exist
81 *
82 * @see em_debug_tsp_t
83 */
85
86#ifdef __cplusplus
87}
88#endif
89
90#pragma GCC visibility pop
91#endif /* EVENT_MACHINE_DEBUG_H_ */
uint64_t em_debug_timestamp(em_debug_tsp_t tsp)