blob: 588d58c790c85a7e644e9dce2e7b781962e67392 [file] [log] [blame]
Florin Corase69f4952017-03-07 10:06:24 -08001/*
Florin Coras288eaab2019-02-03 15:26:14 -08002 * Copyright (c) 2017-2019 Cisco and/or its affiliates.
Florin Corase69f4952017-03-07 10:06:24 -08003 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef SRC_VNET_SESSION_SESSION_DEBUG_H_
16#define SRC_VNET_SESSION_SESSION_DEBUG_H_
17
18#include <vnet/session/transport.h>
Florin Corase69f4952017-03-07 10:06:24 -080019#include <vlib/vlib.h>
Steven Luong10e5b4a2022-10-10 11:37:57 -070020#include <vpp/vnet/config.h>
Florin Corase69f4952017-03-07 10:06:24 -080021
Steven Luong20de85b2022-10-17 10:39:06 -070022#define foreach_session_dbg_evt \
23 _ (ENQ, DEQ_EVTS, 1, "enqueue") \
24 _ (DEQ, DEQ_EVTS, 1, "dequeue") \
25 _ (DEQ_NODE, DISPATCH_DBG, 1, "dequeue") \
26 _ (POLL_GAP_TRACK, EVT_POLL_DBG, 1, "poll gap track") \
27 _ (POLL_DISPATCH_TIME, EVT_POLL_DBG, 1, "dispatch time") \
28 _ (DISPATCH_START, CLOCKS_EVT_DBG, 1, "dispatch start") \
29 _ (DISPATCH_END, CLOCKS_EVT_DBG, 1, "dispatch end") \
30 _ (DSP_CNTRS, CLOCKS_EVT_DBG, 1, "dispatch counters") \
31 _ (FREE, SM, 1, "session free") \
32 _ (IO_EVT_COUNTS, COUNTS_EVT_DBG, 1, "io evt counts") \
33 _ (COUNTS, COUNTS_EVT_DBG, 1, "ctrl evt counts")
Florin Corase69f4952017-03-07 10:06:24 -080034
35typedef enum _session_evt_dbg
36{
Steven Luong20de85b2022-10-17 10:39:06 -070037#define _(sym, grp, lvl, str) SESSION_EVT_##sym,
Florin Corase69f4952017-03-07 10:06:24 -080038 foreach_session_dbg_evt
39#undef _
40} session_evt_dbg_e;
41
Steven Luong20de85b2022-10-17 10:39:06 -070042typedef enum session_evt_lvl_
43{
44#define _(sym, grp, lvl, str) SESSION_EVT_##sym##_LVL = lvl,
45 foreach_session_dbg_evt
46#undef _
47} session_evt_lvl_e;
48
49#define foreach_session_evt_grp \
50 _ (DEQ_EVTS, "dequeue/enqueue events") \
51 _ (DISPATCH_DBG, "dispatch") \
52 _ (EVT_POLL_DBG, "event poll") \
53 _ (SM, "state machine") \
54 _ (CLOCKS_EVT_DBG, "clocks events") \
55 _ (COUNTS_EVT_DBG, "counts events")
56
57typedef enum session_evt_grp_
58{
59#define _(sym, str) SESSION_EVT_GRP_##sym,
60 foreach_session_evt_grp
61#undef _
62 SESSION_EVT_N_GRP
63} session_evt_grp_e;
64
65typedef enum session_evt_to_grp_
66{
67#define _(sym, grp, lvl, str) SESSION_EVT_##sym##_GRP = SESSION_EVT_GRP_##grp,
68 foreach_session_dbg_evt
69#undef _
70} session_evt_to_grp_e;
71
Florin Coras11166672020-04-13 01:20:25 +000072#define foreach_session_events \
73_(CLK_UPDATE_TIME, 1, 1, "Time Update Time") \
74_(CLK_MQ_DEQ, 1, 1, "Time MQ Dequeue") \
Srikanth Akula73570432020-04-06 19:19:49 -070075_(CLK_CTRL_EVTS, 1, 1, "Time Ctrl Events") \
Florin Coras11166672020-04-13 01:20:25 +000076_(CLK_NEW_IO_EVTS, 1, 1, "Time New IO Events") \
77_(CLK_OLD_IO_EVTS, 1, 1, "Time Old IO Events") \
78_(CLK_TOTAL, 1, 1, "Time Total in Node") \
79_(CLK_START, 1, 1, "Time Since Last Reset") \
80 \
81_(CNT_MQ_EVTS, 1, 0, "# of MQ Events Processed" ) \
82_(CNT_CTRL_EVTS, 1, 0, "# of Ctrl Events Processed" ) \
83_(CNT_NEW_EVTS, 1, 0, "# of New Events Processed" ) \
84_(CNT_OLD_EVTS, 1, 0, "# of Old Events Processed" ) \
85_(CNT_IO_EVTS, 1, 0, "# of Events Processed" ) \
86_(CNT_NODE_CALL, 1, 0, "# of Node Calls") \
87 \
88_(BASE_OFFSET_IO_EVTS, 0, 0, "NULL") \
89_(SESSION_IO_EVT_RX, 1, 0, "# of IO Event RX") \
Srikanth Akula73570432020-04-06 19:19:49 -070090_(SESSION_IO_EVT_TX, 1, 0, "# of IO Event TX") \
91_(SESSION_IO_EVT_TX_FLUSH, 1, 0, "# of IO Event TX Flush") \
Florin Coras11166672020-04-13 01:20:25 +000092_(SESSION_IO_EVT_BUILTIN_RX, 1, 0, "# of IO Event BuiltIn RX") \
93_(SESSION_IO_EVT_BUILTIN_TX, 1, 0, "# of IO Event BuiltIn TX") \
Srikanth Akula73570432020-04-06 19:19:49 -070094
95typedef enum
96{
97#define _(sym, disp, type, str) SESS_Q_##sym,
98 foreach_session_events
99#undef _
100 SESS_Q_MAX_EVT_TYPES
101} sess_q_node_events_types_t;
102
103typedef struct session_dbg_counter_
104{
105 union
106 {
107 f64 f64;
108 u64 u64;
109 };
110} session_dbg_counter_t;
111
112typedef struct session_dbg_evts_t
113{
114 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
115 f64 last_time;
Florin Coras11166672020-04-13 01:20:25 +0000116 f64 start_time;
Srikanth Akula73570432020-04-06 19:19:49 -0700117 u64 prev_io;
Florin Coras11166672020-04-13 01:20:25 +0000118 session_dbg_counter_t counters[SESS_Q_MAX_EVT_TYPES];
Srikanth Akula73570432020-04-06 19:19:49 -0700119} session_dbg_evts_t;
120
121typedef struct session_dbg_main_
122{
123 session_dbg_evts_t *wrk;
Steven Luong20de85b2022-10-17 10:39:06 -0700124 u8 grp_dbg_lvl[SESSION_EVT_N_GRP];
Srikanth Akula73570432020-04-06 19:19:49 -0700125} session_dbg_main_t;
126
127extern session_dbg_main_t session_dbg_main;
128
Steven Luong20de85b2022-10-17 10:39:06 -0700129#if defined VPP_SESSION_DEBUG && (TRANSPORT_DEBUG > 0)
130#define SESSION_DEBUG (1)
131#define SESSION_DEQ_EVTS (1)
132#define SESSION_DISPATCH_DBG (1)
133#define SESSION_EVT_POLL_DBG (1)
134#define SESSION_SM (1)
135#define SESSION_CLOCKS_EVT_DBG (1)
136#define SESSION_COUNTS_EVT_DBG (1)
Steven Luong10e5b4a2022-10-10 11:37:57 -0700137#else
Steven Luong20de85b2022-10-17 10:39:06 -0700138#define SESSION_DEBUG (0)
139#define SESSION_DEQ_EVTS (0)
140#define SESSION_DISPATCH_DBG (0)
141#define SESSION_EVT_POLL_DBG (0)
142#define SESSION_SM (0)
Srikanth Akula73570432020-04-06 19:19:49 -0700143#define SESSION_CLOCKS_EVT_DBG (0)
144#define SESSION_COUNTS_EVT_DBG (0)
Steven Luong20de85b2022-10-17 10:39:06 -0700145#endif
Florin Coras6792ec02017-03-13 03:49:51 -0700146
Florin Corascea194d2017-10-02 00:18:51 -0700147#if SESSION_DEBUG
148
149#define SESSION_DBG(_fmt, _args...) clib_warning (_fmt, ##_args)
Florin Corase69f4952017-03-07 10:06:24 -0800150
151#define DEC_SESSION_ETD(_s, _e, _size) \
152 struct \
153 { \
154 u32 data[_size]; \
155 } * ed; \
Florin Corasc1a448b2018-04-20 10:51:49 -0700156 transport_connection_t *_tc = session_get_transport (_s); \
Florin Corase69f4952017-03-07 10:06:24 -0800157 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \
158 _e, _tc->elog_track)
159
Florin Coras6792ec02017-03-13 03:49:51 -0700160#define DEC_SESSION_ED(_e, _size) \
161 struct \
162 { \
163 u32 data[_size]; \
164 } * ed; \
165 ed = ELOG_DATA (&vlib_global_main.elog_main, _e)
Florin Corase69f4952017-03-07 10:06:24 -0800166
Florin Coras6416e622019-04-03 17:52:43 -0700167#if SESSION_SM
Steven Luong20de85b2022-10-17 10:39:06 -0700168#define SESSION_EVT_FREE_HANDLER(_s) \
169 { \
170 ELOG_TYPE_DECLARE (_e) = { \
171 .format = "free: idx %u", \
172 .format_args = "i4", \
173 }; \
174 DEC_SESSION_ED (_e, 1); \
175 ed->data[0] = _s->session_index; \
176 }
Florin Coras6416e622019-04-03 17:52:43 -0700177#else
178#define SESSION_EVT_FREE_HANDLER(_s)
179#endif
180
Florin Corascca96182019-07-19 07:34:13 -0700181#if SESSION_DEQ_EVTS
182#define SESSION_EVT_DEQ_HANDLER(_s, _now, _max, _has_evt, _ts) \
Florin Corase69f4952017-03-07 10:06:24 -0800183{ \
184 ELOG_TYPE_DECLARE (_e) = \
185 { \
Florin Corascca96182019-07-19 07:34:13 -0700186 .format = "deq: now %u max %d evt %u ts %d", \
Florin Corase69f4952017-03-07 10:06:24 -0800187 .format_args = "i4i4i4i4", \
188 }; \
189 DEC_SESSION_ETD(_s, _e, 4); \
Florin Corascca96182019-07-19 07:34:13 -0700190 ed->data[0] = _now; \
191 ed->data[1] = _max; \
192 ed->data[2] = _has_evt; \
193 ed->data[3] = _ts * 1000000.0; \
Florin Corase69f4952017-03-07 10:06:24 -0800194}
195
Florin Corascca96182019-07-19 07:34:13 -0700196#define SESSION_EVT_ENQ_HANDLER(_s, _len) \
Florin Corase69f4952017-03-07 10:06:24 -0800197{ \
198 ELOG_TYPE_DECLARE (_e) = \
199 { \
Florin Corascca96182019-07-19 07:34:13 -0700200 .format = "enq: length %d", \
201 .format_args = "i4", \
Florin Corase69f4952017-03-07 10:06:24 -0800202 }; \
Florin Corascca96182019-07-19 07:34:13 -0700203 DEC_SESSION_ETD(_s, _e, 1); \
204 ed->data[0] = _len; \
Florin Corase69f4952017-03-07 10:06:24 -0800205}
Florin Corasba13c3b2019-10-30 17:11:53 -0700206#else
207#define SESSION_EVT_DEQ_HANDLER(_s, _now, _max, _has_evt, _ts)
208#define SESSION_EVT_ENQ_HANDLER(_s, _body)
209#endif /* SESSION_DEQ_NODE_EVTS */
Florin Corase69f4952017-03-07 10:06:24 -0800210
Florin Corasba13c3b2019-10-30 17:11:53 -0700211#if SESSION_DISPATCH_DBG
212#define SESSION_EVT_DEQ_NODE_HANDLER(_wrk, _node_evt, _ntx) \
Florin Coras6792ec02017-03-13 03:49:51 -0700213{ \
214 ELOG_TYPE_DECLARE (_e) = \
215 { \
Florin Corasba13c3b2019-10-30 17:11:53 -0700216 .format = "dispatch: %s pkts %u re-entry: %u dispatch %u", \
217 .format_args = "t4i4i4i4", \
Florin Coras6792ec02017-03-13 03:49:51 -0700218 .n_enum_strings = 2, \
219 .enum_strings = { \
220 "start", \
221 "end", \
222 }, \
223 }; \
Florin Corasba13c3b2019-10-30 17:11:53 -0700224 DEC_SESSION_ED(_e, 4); \
Florin Coras6792ec02017-03-13 03:49:51 -0700225 ed->data[0] = _node_evt; \
Florin Corasba13c3b2019-10-30 17:11:53 -0700226 ed->data[1] = _ntx; \
227 ed->data[2] = (_wrk->last_vlib_time - _wrk->last_event_poll) \
228 * 1000000.0; \
229 ed->data[3] = (vlib_time_now (_wrk->vm) - _wrk->last_vlib_time) \
230 * 1000000.0; \
Florin Coras6792ec02017-03-13 03:49:51 -0700231}
232#else
Florin Coras11166672020-04-13 01:20:25 +0000233#define SESSION_EVT_DEQ_NODE_HANDLER(_wrk, _node_evt, _ntx)
Florin Corasba13c3b2019-10-30 17:11:53 -0700234#endif /* SESSION_DISPATCH_DBG */
Florin Coras6792ec02017-03-13 03:49:51 -0700235
Florin Corascea194d2017-10-02 00:18:51 -0700236#if SESSION_EVT_POLL_DBG && SESSION_DEBUG > 1
Florin Corascca96182019-07-19 07:34:13 -0700237#define SESSION_EVT_POLL_GAP(_wrk) \
Florin Coras3e350af2017-03-30 02:54:28 -0700238{ \
239 ELOG_TYPE_DECLARE (_e) = \
240 { \
Florin Corasc1a448b2018-04-20 10:51:49 -0700241 .format = "nixon-gap: %d us", \
Florin Coras3e350af2017-03-30 02:54:28 -0700242 .format_args = "i4", \
243 }; \
244 DEC_SESSION_ED(_e, 1); \
Florin Corasba13c3b2019-10-30 17:11:53 -0700245 ed->data[0] = (u32) ((_wrk->last_vlib_time - _wrk->last_event_poll) \
246 *1000000.0); \
Florin Coras3e350af2017-03-30 02:54:28 -0700247}
Florin Corascca96182019-07-19 07:34:13 -0700248#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_wrk) \
Florin Coras3e350af2017-03-30 02:54:28 -0700249{ \
Florin Corasba13c3b2019-10-30 17:11:53 -0700250 if (PREDICT_TRUE (_wrk->last_event_poll != 0.0)) \
251 if (_wrk->last_vlib_time > _wrk->last_event_poll + 500e-6) \
252 SESSION_EVT_POLL_GAP(_wrk); \
253 _wrk->last_event_poll = _wrk->last_vlib_time; \
Florin Coras3e350af2017-03-30 02:54:28 -0700254}
255
Florin Corascca96182019-07-19 07:34:13 -0700256#define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk) \
Florin Coras8b20bf52018-06-14 14:55:50 -0700257{ \
Florin Corascca96182019-07-19 07:34:13 -0700258 f64 diff = vlib_time_now (vlib_get_main ()) - _wrk->last_event_poll; \
Florin Coras8b20bf52018-06-14 14:55:50 -0700259 if (diff > 5e-2) \
260 { \
261 ELOG_TYPE_DECLARE (_e) = \
262 { \
263 .format = "dispatch time: %d us", \
264 .format_args = "i4", \
265 }; \
266 DEC_SESSION_ED(_e, 1); \
267 ed->data[0] = diff *1000000.0; \
268 } \
269}
270
Florin Coras3e350af2017-03-30 02:54:28 -0700271#else
Florin Corascca96182019-07-19 07:34:13 -0700272#define SESSION_EVT_POLL_GAP(_wrk)
273#define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_wrk)
274#define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk)
Srikanth Akula73570432020-04-06 19:19:49 -0700275#define SESSION_EVT_POLL_CLOCKS_TIME_HANDLER(_wrk)
276
Florin Corascea194d2017-10-02 00:18:51 -0700277#endif /* SESSION_EVT_POLL_DBG */
Florin Coras3e350af2017-03-30 02:54:28 -0700278
Srikanth Akula73570432020-04-06 19:19:49 -0700279#if SESSION_CLOCKS_EVT_DBG
280
Florin Coras41d5f542021-01-15 13:49:33 -0800281#define SESSION_EVT_DSP_CNTRS_UPDATE_TIME_HANDLER(_wrk, _diff, _args...) \
282 session_dbg_evts_t *sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
283 sde->counters[SESS_Q_CLK_UPDATE_TIME].f64 += _diff;
Srikanth Akula73570432020-04-06 19:19:49 -0700284
Florin Coras41d5f542021-01-15 13:49:33 -0800285#define SESSION_EVT_DSP_CNTRS_MQ_DEQ_HANDLER(_wrk, _diff, _cnt, _args...) \
286 session_dbg_evts_t *sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
287 sde->counters[SESS_Q_CNT_MQ_EVTS].u64 += _cnt; \
288 sde->counters[SESS_Q_CLK_MQ_DEQ].f64 += _diff;
Srikanth Akula73570432020-04-06 19:19:49 -0700289
290#define SESSION_EVT_DSP_CNTRS_CTRL_EVTS_HANDLER(_wrk, _diff, _args...) \
Florin Coras11166672020-04-13 01:20:25 +0000291 session_dbg_evts_t *sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
292 sde->counters[SESS_Q_CLK_CTRL_EVTS].f64 += _diff; \
293 sde->prev_io = sde->counters[SESS_Q_CNT_IO_EVTS].u64; \
Srikanth Akula73570432020-04-06 19:19:49 -0700294
295#define SESSION_EVT_DSP_CNTRS_NEW_IO_EVTS_HANDLER(_wrk, _diff, _args...) \
Florin Coras11166672020-04-13 01:20:25 +0000296 session_dbg_evts_t *sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
297 sde->counters[SESS_Q_CLK_NEW_IO_EVTS].f64 += _diff; \
298 sde->counters[SESS_Q_CNT_NEW_EVTS].u64 += \
299 sde->counters[SESS_Q_CNT_IO_EVTS].u64 - sde->prev_io; \
300 sde->prev_io = sde->counters[SESS_Q_CNT_IO_EVTS].u64; \
Srikanth Akula73570432020-04-06 19:19:49 -0700301
302#define SESSION_EVT_DSP_CNTRS_OLD_IO_EVTS_HANDLER(_wrk, _diff, _args...) \
Florin Coras11166672020-04-13 01:20:25 +0000303 session_dbg_evts_t *sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
304 sde->counters[SESS_Q_CLK_OLD_IO_EVTS].f64 += _diff; \
305 sde->counters[SESS_Q_CNT_OLD_EVTS].u64 += \
306 sde->counters[SESS_Q_CNT_IO_EVTS].u64 - sde->prev_io; \
Srikanth Akula73570432020-04-06 19:19:49 -0700307
308#define SESSION_EVT_DSP_CNTRS_HANDLER(_disp_evt, _wrk, _args...) \
309{ \
Florin Coras11166672020-04-13 01:20:25 +0000310 f64 time_now = vlib_time_now (_wrk->vm), diff; \
311 diff = time_now - session_dbg_main.wrk[_wrk->vm->thread_index].last_time; \
Srikanth Akula73570432020-04-06 19:19:49 -0700312 session_dbg_main.wrk[_wrk->vm->thread_index].last_time = time_now; \
313 CC(CC(SESSION_EVT_DSP_CNTRS_,_disp_evt),_HANDLER)(wrk, diff, _args); \
314}
315#else
Florin Coras11166672020-04-13 01:20:25 +0000316#define SESSION_EVT_DSP_CNTRS_HANDLER(_disp_evt, _wrk, _args...)
Srikanth Akula73570432020-04-06 19:19:49 -0700317#endif /*SESSION_CLOCKS_EVT_DBG */
318
319#if SESSION_COUNTS_EVT_DBG
Florin Coras11166672020-04-13 01:20:25 +0000320#define SESSION_EVT_COUNTS_HANDLER(_node_evt, _cnt, _wrk) \
Srikanth Akula73570432020-04-06 19:19:49 -0700321{ \
322 session_dbg_main.wrk[_wrk->vm->thread_index]. \
Florin Coras11166672020-04-13 01:20:25 +0000323 counters[SESS_Q_##_node_evt].u64 += _cnt; \
Srikanth Akula73570432020-04-06 19:19:49 -0700324}
325
Steven Luong20de85b2022-10-17 10:39:06 -0700326#define SESSION_EVT_IO_EVT_COUNTS_HANDLER(_node_evt, _cnt, _wrk) \
327 { \
328 u8 type = SESS_Q_BASE_OFFSET_IO_EVTS + _node_evt + 1; \
329 session_dbg_evts_t *sde; \
330 sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
331 sde->counters[type].u64 += _cnt; \
332 sde->counters[SESS_Q_CNT_IO_EVTS].u64 += _cnt; \
333 }
Srikanth Akula73570432020-04-06 19:19:49 -0700334#else
Florin Coras11166672020-04-13 01:20:25 +0000335#define SESSION_EVT_COUNTS_HANDLER(_node_evt, _cnt, _wrk)
Steven Luong20de85b2022-10-17 10:39:06 -0700336#define SESSION_EVT_IO_EVT_COUNTS_HANDLER(_node_evt, _cnt, _wrk)
Srikanth Akula73570432020-04-06 19:19:49 -0700337#endif /*SESSION_COUNTS_EVT_DBG */
338
339
Florin Corascca96182019-07-19 07:34:13 -0700340#define SESSION_EVT_DISPATCH_START_HANDLER(_wrk) \
Florin Coras8b20bf52018-06-14 14:55:50 -0700341{ \
Florin Coras11166672020-04-13 01:20:25 +0000342 session_dbg_evts_t *sde; \
343 sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
Florin Corascca96182019-07-19 07:34:13 -0700344 if (SESSION_DEQ_EVTS > 1) \
Florin Corasba13c3b2019-10-30 17:11:53 -0700345 SESSION_EVT_DEQ_NODE_HANDLER (_wrk, 0, 0); \
Florin Corascca96182019-07-19 07:34:13 -0700346 SESSION_EVT_POLL_GAP_TRACK_HANDLER (wrk); \
Florin Coras11166672020-04-13 01:20:25 +0000347 sde->counters[SESS_Q_##CNT_NODE_CALL].u64 +=1; \
348 sde->last_time = vlib_time_now (_wrk->vm); \
Florin Corascca96182019-07-19 07:34:13 -0700349}
350
351#define SESSION_EVT_DISPATCH_END_HANDLER(_wrk, _ntx) \
352{ \
Florin Coras11166672020-04-13 01:20:25 +0000353 f64 now = vlib_time_now (_wrk->vm); \
354 session_dbg_evts_t *sde; \
355 sde = &session_dbg_main.wrk[_wrk->vm->thread_index]; \
Florin Corasba13c3b2019-10-30 17:11:53 -0700356 if (_ntx) \
357 SESSION_EVT_DEQ_NODE_HANDLER (_wrk, 1, _ntx); \
Florin Corascca96182019-07-19 07:34:13 -0700358 SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk); \
Florin Coras11166672020-04-13 01:20:25 +0000359 _wrk->last_event_poll = now; \
360 sde->counters[SESS_Q_CLK_TOTAL].f64 += now - _wrk->last_vlib_time; \
361 sde->counters[SESS_Q_CLK_START].f64 = now - sde->start_time; \
Florin Coras8b20bf52018-06-14 14:55:50 -0700362}
363
Florin Corase69f4952017-03-07 10:06:24 -0800364#define CONCAT_HELPER(_a, _b) _a##_b
365#define CC(_a, _b) CONCAT_HELPER(_a, _b)
Steven Luong20de85b2022-10-17 10:39:06 -0700366#define session_evt_lvl(_evt) CC (_evt, _LVL)
367#define session_evt_grp(_evt) CC (_evt, _GRP)
368#define session_evt_grp_dbg_lvl(_evt) \
369 session_dbg_main.grp_dbg_lvl[session_evt_grp (_evt)]
370#define SESSION_EVT(_evt, _args...) \
371 if (PREDICT_FALSE (session_evt_grp_dbg_lvl (_evt) >= \
372 session_evt_lvl (_evt))) \
373 CC (_evt, _HANDLER) (_args)
Florin Corase69f4952017-03-07 10:06:24 -0800374#else
Florin Corascca96182019-07-19 07:34:13 -0700375#define SESSION_EVT(_evt, _args...)
Florin Corascea194d2017-10-02 00:18:51 -0700376#define SESSION_DBG(_fmt, _args...)
377#endif /* SESSION_DEBUG */
Florin Corase69f4952017-03-07 10:06:24 -0800378
Florin Coras11166672020-04-13 01:20:25 +0000379void session_debug_init (void);
380
Florin Corase69f4952017-03-07 10:06:24 -0800381#endif /* SRC_VNET_SESSION_SESSION_DEBUG_H_ */
382/*
383 * fd.io coding-style-patch-verification: ON
384 *
385 * Local Variables:
386 * eval: (c-set-style "gnu")
387 * End:
388 */