add stream-delay-calculation config

This commit is contained in:
Christian Giese
2024-01-15 21:21:35 +00:00
parent 964739e1c4
commit d17ecabb23
5 changed files with 41 additions and 20 deletions
+6 -1
View File
@@ -3343,7 +3343,8 @@ json_parse_config(json_t *root)
const char *schema[] = {
"autostart", "stop-verified", "max-burst",
"stream-rate-calculation"
"stream-rate-calculation",
"stream-delay-calculation"
};
if(!schema_validate(section, "traffic", schema,
sizeof(schema)/sizeof(schema[0]))) {
@@ -3366,6 +3367,10 @@ json_parse_config(json_t *root)
if(value) {
g_ctx->config.stream_rate_calc = json_boolean_value(value);
}
JSON_OBJ_GET_BOOL(section, value, "traffic", "stream-delay-calculation");
if(value) {
g_ctx->config.stream_delay_calc = json_boolean_value(value);
}
}
/* Session Traffic Configuration */
+2
View File
@@ -338,6 +338,8 @@ typedef struct bbl_ctx_
bool traffic_autostart;
bool traffic_stop_verified;
bool stream_rate_calc; /* Enable/disable stream rate calculation */
bool stream_delay_calc; /* Enable/disable stream delay calculation */
uint8_t stream_max_burst; /* Limit the max packets per TX interval */
/* Session Traffic */
+3 -1
View File
@@ -2296,7 +2296,9 @@ bbl_stream_rx(bbl_ethernet_header_s *eth, bbl_session_s *session)
stream->rx_packets++;
stream->rx_last_seq = bbl->flow_seq;
stream->rx_last_epoch = eth->timestamp.tv_sec;
bbl_stream_delay(stream, &eth->timestamp, &bbl->timestamp);
if(g_ctx->config.stream_delay_calc) {
bbl_stream_delay(stream, &eth->timestamp, &bbl->timestamp);
}
return stream;
} else {
return NULL;