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_START, "dispatch start") \ 28 _(DISPATCH_END, "dispatch end") \ 29 _(FREE, "session free") \ 31 typedef enum _session_evt_dbg
33 #define _(sym, str) SESSION_EVT_##sym, 38 #define SESSION_DEBUG 0 * (TRANSPORT_DEBUG > 0) 39 #define SESSION_DEQ_EVTS (0) 40 #define SESSION_DISPATCH_DBG (0) 41 #define SESSION_EVT_POLL_DBG (0) 42 #define SESSION_SM (0) 46 #define SESSION_DBG(_fmt, _args...) clib_warning (_fmt, ##_args) 48 #define DEC_SESSION_ETD(_s, _e, _size) \ 53 transport_connection_t *_tc = session_get_transport (_s); \ 54 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \ 57 #define DEC_SESSION_ED(_e, _size) \ 62 ed = ELOG_DATA (&vlib_global_main.elog_main, _e) 65 #define SESSION_EVT_FREE_HANDLER(_s) \ 67 ELOG_TYPE_DECLARE (_e) = \ 69 .format = "free: idx %u", \ 70 .format_args = "i4", \ 72 DEC_SESSION_ETD(_s, _e, 1); \ 73 ed->data[0] = _s->session_index; \ 76 #define SESSION_EVT_FREE_HANDLER(_s) 80 #define SESSION_EVT_DEQ_HANDLER(_s, _now, _max, _has_evt, _ts) \ 82 ELOG_TYPE_DECLARE (_e) = \ 84 .format = "deq: now %u max %d evt %u ts %d", \ 85 .format_args = "i4i4i4i4", \ 87 DEC_SESSION_ETD(_s, _e, 4); \ 90 ed->data[2] = _has_evt; \ 91 ed->data[3] = _ts * 1000000.0; \ 94 #define SESSION_EVT_ENQ_HANDLER(_s, _len) \ 96 ELOG_TYPE_DECLARE (_e) = \ 98 .format = "enq: length %d", \ 99 .format_args = "i4", \ 101 DEC_SESSION_ETD(_s, _e, 1); \ 102 ed->data[0] = _len; \ 105 #define SESSION_EVT_DEQ_HANDLER(_s, _now, _max, _has_evt, _ts) 106 #define SESSION_EVT_ENQ_HANDLER(_s, _body) 109 #if SESSION_DISPATCH_DBG 110 #define SESSION_EVT_DEQ_NODE_HANDLER(_wrk, _node_evt, _ntx) \ 112 ELOG_TYPE_DECLARE (_e) = \ 114 .format = "dispatch: %s pkts %u re-entry: %u dispatch %u", \ 115 .format_args = "t4i4i4i4", \ 116 .n_enum_strings = 2, \ 122 DEC_SESSION_ED(_e, 4); \ 123 ed->data[0] = _node_evt; \ 124 ed->data[1] = _ntx; \ 125 ed->data[2] = (_wrk->last_vlib_time - _wrk->last_event_poll) \ 127 ed->data[3] = (vlib_time_now (_wrk->vm) - _wrk->last_vlib_time) \ 131 #define SESSION_EVT_DEQ_NODE_HANDLER(_node_evt, _ntx) 134 #if SESSION_EVT_POLL_DBG && SESSION_DEBUG > 1 135 #define SESSION_EVT_POLL_GAP(_wrk) \ 137 ELOG_TYPE_DECLARE (_e) = \ 139 .format = "nixon-gap: %d us", \ 140 .format_args = "i4", \ 142 DEC_SESSION_ED(_e, 1); \ 143 ed->data[0] = (u32) ((_wrk->last_vlib_time - _wrk->last_event_poll) \ 146 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_wrk) \ 148 if (PREDICT_TRUE (_wrk->last_event_poll != 0.0)) \ 149 if (_wrk->last_vlib_time > _wrk->last_event_poll + 500e-6) \ 150 SESSION_EVT_POLL_GAP(_wrk); \ 151 _wrk->last_event_poll = _wrk->last_vlib_time; \ 154 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk) \ 156 f64 diff = vlib_time_now (vlib_get_main ()) - _wrk->last_event_poll; \ 159 ELOG_TYPE_DECLARE (_e) = \ 161 .format = "dispatch time: %d us", \ 162 .format_args = "i4", \ 164 DEC_SESSION_ED(_e, 1); \ 165 ed->data[0] = diff *1000000.0; \ 170 #define SESSION_EVT_POLL_GAP(_wrk) 171 #define SESSION_EVT_POLL_GAP_TRACK_HANDLER(_wrk) 172 #define SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk) 175 #define SESSION_EVT_DISPATCH_START_HANDLER(_wrk) \ 177 if (SESSION_DEQ_EVTS > 1) \ 178 SESSION_EVT_DEQ_NODE_HANDLER (_wrk, 0, 0); \ 179 SESSION_EVT_POLL_GAP_TRACK_HANDLER (wrk); \ 182 #define SESSION_EVT_DISPATCH_END_HANDLER(_wrk, _ntx) \ 185 SESSION_EVT_DEQ_NODE_HANDLER (_wrk, 1, _ntx); \ 186 SESSION_EVT_POLL_DISPATCH_TIME_HANDLER(_wrk); \ 187 _wrk->last_event_poll = vlib_time_now (_wrk->vm); \ 190 #define CONCAT_HELPER(_a, _b) _a##_b 191 #define CC(_a, _b) CONCAT_HELPER(_a, _b) 192 #define SESSION_EVT(_evt, _args...) CC(_evt, _HANDLER)(_args) 195 #define SESSION_EVT(_evt, _args...) 196 #define SESSION_DBG(_fmt, _args...)
#define foreach_session_dbg_evt
enum _session_evt_dbg session_evt_dbg_e