summaryrefslogtreecommitdiff
path: root/shaping/src
diff options
context:
space:
mode:
Diffstat (limited to 'shaping/src')
-rw-r--r--shaping/src/shaper.cpp21
-rw-r--r--shaping/src/shaper_global_stat.cpp1
2 files changed, 11 insertions, 11 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;
}
diff --git a/shaping/src/shaper_global_stat.cpp b/shaping/src/shaper_global_stat.cpp
index 75dbc8b..11f44e1 100644
--- a/shaping/src/shaper_global_stat.cpp
+++ b/shaping/src/shaper_global_stat.cpp
@@ -60,7 +60,6 @@ struct shaping_global_stat* shaper_global_stat_init()
{
struct shaping_global_stat *stat = NULL;
struct shaping_global_stat_conf conf;
- int column_num;
stat = (struct shaping_global_stat*)calloc(1, sizeof(struct shaping_global_stat));