diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-12-10 10:23:13 +0100 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-12-13 22:05:49 +0000 |
commit | 380e857830985e1b50257b39ba6045b829c833c1 (patch) | |
tree | beff0f39cf00c7497082ad1162e178af4e02fe30 /src/plugins/hs_apps/sapi | |
parent | 407f593dc0d06453f0b5c124b3a48edd52da6704 (diff) |
hsa: Fix timing & nits
Type: fix
Change-Id: I4fef896a3556df75532ef938ca2e263287dd74e8
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/hs_apps/sapi')
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo.c | 11 | ||||
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo_common.h | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c index 019860a47c7..739797a28e2 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo.c +++ b/src/plugins/hs_apps/sapi/vpp_echo.c @@ -150,7 +150,7 @@ print_global_json_stats (echo_main_t * em) fformat (stdout, " \"end_evt_missing\": \"%s\",\n", end_evt_missing ? "True" : "False"); fformat (stdout, " \"rx_data\": %lld,\n", em->stats.rx_total); - fformat (stdout, " \"tx_rx\": %lld,\n", em->stats.tx_total); + fformat (stdout, " \"tx_data\": %lld,\n", em->stats.tx_total); fformat (stdout, " \"closing\": {\n"); fformat (stdout, " \"reset\": { \"q\": %d, \"s\": %d },\n", em->stats.reset_count.q, em->stats.reset_count.s); @@ -244,10 +244,15 @@ echo_update_count_on_session_close (echo_main_t * em, echo_session_t * s) s->bytes_received, s->bytes_received + s->bytes_to_receive, echo_format_session, s, s->bytes_sent, s->bytes_sent + s->bytes_to_send); + + ASSERT (em->stats.tx_total + s->bytes_sent <= em->stats.tx_expected); + ASSERT (em->stats.rx_total + s->bytes_received <= em->stats.rx_expected); clib_atomic_fetch_add (&em->stats.tx_total, s->bytes_sent); clib_atomic_fetch_add (&em->stats.rx_total, s->bytes_received); - if (PREDICT_FALSE (em->stats.rx_total == em->stats.rx_expected)) + if (PREDICT_FALSE + ((em->stats.rx_total == em->stats.rx_expected) + && (em->stats.tx_total == em->stats.tx_expected))) echo_notify_event (em, ECHO_EVT_LAST_BYTE); } @@ -413,7 +418,7 @@ echo_handle_data (echo_main_t * em, echo_session_t * s, u8 * rx_buf) { if (n_sent || n_read) s->idle_cycles = 0; - else if (s->idle_cycles++ == 1e7) + else if (s->idle_cycles++ == LOG_EVERY_N_IDLE_CYCLES) { s->idle_cycles = 0; ECHO_LOG (2, "Idle client TX:%dB RX:%dB", s->bytes_to_send, diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h index 617acac9af9..978a9ec00aa 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_common.h +++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h @@ -37,6 +37,7 @@ #define TIMEOUT 10.0 #define LOGGING_BATCH (100) +#define LOG_EVERY_N_IDLE_CYCLES (1e8) #define foreach_echo_fail_code \ _(ECHO_FAIL_NONE, "ECHO_FAIL_NONE") \ |