summaryrefslogtreecommitdiff
path: root/shaping/src/shaper.cpp
diff options
context:
space:
mode:
author刘畅 <[email protected]>2023-06-05 02:20:36 +0000
committer刘畅 <[email protected]>2023-06-05 02:20:36 +0000
commit038fb1788f3680a04f29c718f17c6cecc41449a2 (patch)
treeca887b4a07c755b99e6c5df7bad6830b3a6fe243 /shaping/src/shaper.cpp
parent4e63a3a5cd61c1ff579864b03324163e26e1b515 (diff)
parent49b1128205177576fcb000474c6283184bbc44d1 (diff)
Merge branch 'bugfix-remove-borrow-latency' into 'rel'v1.2.1
don't calculate latency for borrow profile See merge request tango/shaping-engine!25
Diffstat (limited to 'shaping/src/shaper.cpp')
-rw-r--r--shaping/src/shaper.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp
index 6ca182d..0943932 100644
--- a/shaping/src/shaper.cpp
+++ b/shaping/src/shaper.cpp
@@ -281,11 +281,10 @@ int shaper_flow_push(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, un
swarmkv_async_command(ctx->swarmkv_db, swarmkv_reply_cb_do_nothing, ctx->global_stat, "HINCRBY tsg-shaping-%d priority-%d 1", s_rule_info->primary.id, priority);
}
shaper_stat_queueing_pkt_inc(&s_rule_info->primary.stat, pkt_wrapper->direction, ctx->thread_index);
- s_rule_info->primary.enqueue_time_us = enqueue_time;
}
if (s_rule_info->borrowing_num == 0) {// no borrow profile
- return ret;
+ goto END;
}
for (i = 0; i < s_rule_info->borrowing_num; i++) {
@@ -297,10 +296,14 @@ int shaper_flow_push(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, un
shaper_global_stat_async_invoke_inc(ctx->global_stat);
swarmkv_async_command(ctx->swarmkv_db, swarmkv_reply_cb_do_nothing, ctx->global_stat, "HINCRBY tsg-shaping-%d priority-%d 1", s_rule_info->borrowing[i].id, priority);
}
- s_rule_info->borrowing[i].enqueue_time_us = enqueue_time;
}
}
+END:
+ if (ret == 0) {//all avl tree success
+ s_rule_info->primary.enqueue_time_us = enqueue_time;
+ }
+
return ret;
}
@@ -338,13 +341,10 @@ void shaper_flow_pop(struct shaping_thread_ctx *ctx, struct shaping_flow *sf)
}
shaper_stat_queueing_pkt_dec(&s_rule_info->primary.stat, pkt_wrapper->direction, ctx->thread_index);
-
- latency = shaper_pkt_latency_calculate(&s_rule_info->primary, &curr_time);
- shaper_stat_max_latency_update(&s_rule_info->primary.stat, pkt_wrapper->direction, latency, ctx->thread_index);
}
if (s_rule_info->borrowing_num == 0) {
- return;
+ goto END;
}
for (i = 0; i < s_rule_info->borrowing_num; i++) {
@@ -355,12 +355,13 @@ void shaper_flow_pop(struct shaping_thread_ctx *ctx, struct shaping_flow *sf)
shaper_global_stat_async_invoke_inc(ctx->global_stat);
swarmkv_async_command(ctx->swarmkv_db, swarmkv_reply_cb_do_nothing, ctx->global_stat, "HINCRBY tsg-shaping-%d priority-%d -1", s_rule_info->borrowing[i].id, priority);
}
-
- latency = shaper_pkt_latency_calculate(&s_rule_info->borrowing[i], &curr_time);
- shaper_stat_max_latency_update(&s_rule_info->borrowing[i].stat, pkt_wrapper->direction, latency, ctx->thread_index);
}
}
+END:
+ latency = shaper_pkt_latency_calculate(&s_rule_info->primary, &curr_time);
+ shaper_stat_max_latency_update(&s_rule_info->primary.stat, pkt_wrapper->direction, latency, ctx->thread_index);
+
return;
}