EM-ODP  3.7.0
Event Machine on ODP
event_machine_debug.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, 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 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * EM dispatcher debug timestamp points
48  * EM_DEBUG_TSP_SCHED_ENTRY: EM core local timestamp taken by the dispatcher
49  * _before_ asking the scheduler for new events.
50  * EM_DEBUG_TSP_SCHED_RETURN: EM core local timestamp taken by the dispatcher
51  * _after_ returning from the scheduler.
52  */
53 typedef enum {
54  EM_DEBUG_TSP_SCHED_ENTRY, /* timestamp at scheduler entry */
55  EM_DEBUG_TSP_SCHED_RETURN, /* timestamp at scheduler return */
56  EM_DEBUG_TSP_LAST
58 
59 /**
60  * Returns a per core timestamp from the EM dispatcher.
61  *
62  * Not intended for normal application use!
63  * These debug timestamps are disabled by default and must be enabled by the
64  * user (see configure option '--enable-debug-timestamps=...' or the
65  * EM_DEBUG_TIMESTAMP_ENABLE define).
66  *
67  * Timestamps are taken with odp_time_global/_strict() and converted to ns.
68  * The timestamps can be used to e.g. measure the EM dispatcher overhead from
69  * EM_DEBUG_TSP_SCHED_RETURN to the EO-receive() including all code and hooks
70  * in between.
71  *
72  * If debug timestamps are disabled or the given timestamp point does not exist,
73  * 0 will be returned.
74  *
75  * @param tsp timestamp point, selects which EM internal timestamp to return
76  *
77  * @return timestamp in ns
78  * @retval 0 if debug timestamps are disabled or the given timestamp point does not exist
79  *
80  * @see em_debug_tsp_t
81  */
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #pragma GCC visibility pop
89 #endif /* EVENT_MACHINE_DEBUG_H_ */
em_debug_tsp_t
em_debug_tsp_t
Definition: event_machine_debug.h:53
em_debug_timestamp
uint64_t em_debug_timestamp(em_debug_tsp_t tsp)
Definition: event_machine_helper.c:129