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") \ 29 typedef enum _session_evt_dbg
31 #define _(sym, str) SESSION_EVT_##sym, 36 #define SESSION_DEBUG 0 * (TRANSPORT_DEBUG > 0) 37 #define SESSION_DEQ_NODE_EVTS (0) 38 #define SESSION_EVT_POLL_DBG (0) 42 #define SESSION_DBG(_fmt, _args...) clib_warning (_fmt, ##_args) 44 #define DEC_SESSION_ETD(_s, _e, _size) \ 49 transport_connection_t *_tc = session_get_transport (_s); \ 50 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \ 53 #define DEC_SESSION_ED(_e, _size) \ 58 ed = ELOG_DATA (&vlib_global_main.elog_main, _e) 60 #if SESSION_DEQ_NODE_EVTS && SESSION_DEBUG > 1 61 #define SESSION_EVT_DEQ_HANDLER(_s, _body) \ 63 ELOG_TYPE_DECLARE (_e) = \ 65 .format = "deq: id %d len %d rd %d wnd %d", \ 66 .format_args = "i4i4i4i4", \ 68 DEC_SESSION_ETD(_s, _e, 4); \ 69 do { _body; } while (0); \ 72 #define SESSION_EVT_ENQ_HANDLER(_s, _body) \ 74 ELOG_TYPE_DECLARE (_e) = \ 76 .format = "enq: id %d length %d", \ 77 .format_args = "i4i4", \ 79 DEC_SESSION_ETD(_s, _e, 2); \ 80 do { _body; } while (0); \ 83 #define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt) \ 85 ELOG_TYPE_DECLARE (_e) = \ 87 .format = "deq-node: %s", \ 88 .format_args = "t4", \ 89 .n_enum_strings = 2, \ 95 DEC_SESSION_ED(_e, 1); \ 96 ed->data[0] = _node_evt; \ 99 #define SESSION_EVT_DEQ_HANDLER(_s, _body) 100 #define SESSION_EVT_ENQ_HANDLER(_s, _body) 101 #define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt) 104 #if SESSION_EVT_POLL_DBG && SESSION_DEBUG > 1 105 #define SESSION_EVT_POLL_GAP(_smm, _ti) \ 107 ELOG_TYPE_DECLARE (_e) = \ 109 .format = "nixon-gap: %d us", \ 110 .format_args = "i4", \ 112 DEC_SESSION_ED(_e, 1); \ 113 ed->data[0] = (u32) ((now - \ 114 _smm->last_event_poll_by_thread[_ti])*1000000.0); \ 116 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _ti) \ 118 if (PREDICT_TRUE (smm->last_event_poll_by_thread[_ti] != 0.0)) \ 119 if (now > smm->last_event_poll_by_thread[_ti] + 500e-6) \ 120 SESSION_EVT_POLL_GAP(smm, _ti); \ 121 _smm->last_event_poll_by_thread[_ti] = now; \ 124 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti) \ 126 f64 diff = vlib_time_now (vlib_get_main ()) - \ 127 _smm->last_event_poll_by_thread[_ti]; \ 130 ELOG_TYPE_DECLARE (_e) = \ 132 .format = "dispatch time: %d us", \ 133 .format_args = "i4", \ 135 DEC_SESSION_ED(_e, 1); \ 136 ed->data[0] = diff *1000000.0; \ 141 #define SESSION_EVT_POLL_GAP(_smm, _my_thread_index) 142 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_smm, _my_thread_index) 143 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti) 146 #define SESSION_EVT_DISPATCH_END_HANDLER(_smm, _ti) \ 148 SESSION_EVT_DEQ_NODE_HANDLER(1); \ 149 SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_smm, _ti); \ 152 #define CONCAT_HELPER(_a, _b) _a##_b 153 #define CC(_a, _b) CONCAT_HELPER(_a, _b) 154 #define SESSION_EVT_DBG(_evt, _args...) CC(_evt, _HANDLER)(_args) 157 #define SESSION_EVT_DBG(_evt, _args...) 158 #define SESSION_DBG(_fmt, _args...)
#define foreach_session_dbg_evt
enum _session_evt_dbg session_evt_dbg_e