15 #ifndef SRC_VNET_SESSION_SESSION_DEBUG_H_ 16 #define SRC_VNET_SESSION_SESSION_DEBUG_H_ 21 #define foreach_session_dbg_evt \ 24 _(DEQ_NODE, "dequeue") \ 25 _(POLL_GAP_TRACK, "poll gap track") \ 26 _(POLL_DISPATCH_TIME, "dispatch time")\ 27 _(DISPATCH_END, "dispatch end") \ 28 _(FREE, "session free") \ 30 typedef enum _session_evt_dbg
32 #define _(sym, str) SESSION_EVT_##sym, 37 #define SESSION_DEBUG 0 * (TRANSPORT_DEBUG > 0) 38 #define SESSION_DEQ_NODE_EVTS (0) 39 #define SESSION_EVT_POLL_DBG (0) 40 #define SESSION_SM (0) 44 #define SESSION_DBG(_fmt, _args...) clib_warning (_fmt, ##_args) 46 #define DEC_SESSION_ETD(_s, _e, _size) \ 51 transport_connection_t *_tc = session_get_transport (_s); \ 52 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \ 55 #define DEC_SESSION_ED(_e, _size) \ 60 ed = ELOG_DATA (&vlib_global_main.elog_main, _e) 63 #define SESSION_EVT_FREE_HANDLER(_s) \ 65 ELOG_TYPE_DECLARE (_e) = \ 67 .format = "free: idx %u", \ 68 .format_args = "i4", \ 70 DEC_SESSION_ETD(_s, _e, 1); \ 71 ed->data[0] = _s->session_index; \ 74 #define SESSION_EVT_FREE_HANDLER(_s) 77 #if SESSION_DEQ_NODE_EVTS && SESSION_DEBUG > 1 78 #define SESSION_EVT_DEQ_HANDLER(_s, _body) \ 80 ELOG_TYPE_DECLARE (_e) = \ 82 .format = "deq: id %d len %d rd %d wnd %d", \ 83 .format_args = "i4i4i4i4", \ 85 DEC_SESSION_ETD(_s, _e, 4); \ 86 do { _body; } while (0); \ 89 #define SESSION_EVT_ENQ_HANDLER(_s, _body) \ 91 ELOG_TYPE_DECLARE (_e) = \ 93 .format = "enq: id %d length %d", \ 94 .format_args = "i4i4", \ 96 DEC_SESSION_ETD(_s, _e, 2); \ 97 do { _body; } while (0); \ 100 #define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt) \ 102 ELOG_TYPE_DECLARE (_e) = \ 104 .format = "deq-node: %s", \ 105 .format_args = "t4", \ 106 .n_enum_strings = 2, \ 112 DEC_SESSION_ED(_e, 1); \ 113 ed->data[0] = _node_evt; \ 116 #define SESSION_EVT_DEQ_HANDLER(_s, _body) 117 #define SESSION_EVT_ENQ_HANDLER(_s, _body) 118 #define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt) 121 #if SESSION_EVT_POLL_DBG && SESSION_DEBUG > 1 122 #define SESSION_EVT_POLL_GAP(_smm, _ti) \ 124 ELOG_TYPE_DECLARE (_e) = \ 126 .format = "nixon-gap: %d us", \ 127 .format_args = "i4", \ 129 DEC_SESSION_ED(_e, 1); \ 130 ed->data[0] = (u32) ((now - \ 131 _smm->last_event_poll_by_thread[_ti])*1000000.0); \ 133 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _ti) \ 135 if (PREDICT_TRUE (smm->last_event_poll_by_thread[_ti] != 0.0)) \ 136 if (now > smm->last_event_poll_by_thread[_ti] + 500e-6) \ 137 SESSION_EVT_POLL_GAP(smm, _ti); \ 138 _smm->last_event_poll_by_thread[_ti] = now; \ 141 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti) \ 143 f64 diff = vlib_time_now (vlib_get_main ()) - \ 144 _smm->last_event_poll_by_thread[_ti]; \ 147 ELOG_TYPE_DECLARE (_e) = \ 149 .format = "dispatch time: %d us", \ 150 .format_args = "i4", \ 152 DEC_SESSION_ED(_e, 1); \ 153 ed->data[0] = diff *1000000.0; \ 158 #define SESSION_EVT_POLL_GAP(_smm, _my_thread_index) 159 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index) 160 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti) 163 #define SESSION_EVT_DISPATCH_END_HANDLER(_smm, _ti) \ 165 SESSION_EVT_DEQ_NODE_HANDLER(1); \ 166 SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti); \ 169 #define CONCAT_HELPER(_a, _b) _a##_b 170 #define CC(_a, _b) CONCAT_HELPER(_a, _b) 171 #define SESSION_EVT_DBG(_evt, _args...) CC(_evt, _HANDLER)(_args) 174 #define SESSION_EVT_DBG(_evt, _args...) 175 #define SESSION_DBG(_fmt, _args...)
#define foreach_session_dbg_evt
enum _session_evt_dbg session_evt_dbg_e