diff options
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo_common.c')
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo_common.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.c b/src/plugins/hs_apps/sapi/vpp_echo_common.c index e7829f3ab89..0642ee67429 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_common.c +++ b/src/plugins/hs_apps/sapi/vpp_echo_common.c @@ -258,6 +258,20 @@ echo_unformat_timing_event (unformat_input_t * input, va_list * args) } u8 * +echo_format_bytes_per_sec (u8 * s, va_list * args) +{ + f64 bps = va_arg (*args, f64) * 8; + if (bps > 1e9) + return format (s, "%.3f Gb/s", bps / 1e9); + else if (bps > 1e6) + return format (s, "%.3f Mb/s", bps / 1e6); + else if (bps > 1e3) + return format (s, "%.3f Kb/s", bps / 1e3); + else + return format (s, "%.3f b/s", bps); +} + +u8 * echo_format_timing_event (u8 * s, va_list * args) { u32 timing_event = va_arg (*args, u32); |