mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
add stream-delay-calculation config
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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, ð->timestamp, &bbl->timestamp);
|
||||
if(g_ctx->config.stream_delay_calc) {
|
||||
bbl_stream_delay(stream, ð->timestamp, &bbl->timestamp);
|
||||
}
|
||||
return stream;
|
||||
} else {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user