summaryrefslogtreecommitdiff
path: root/shaping/src/shaper_stat.cpp
diff options
context:
space:
mode:
authorroot <[email protected]>2023-12-07 09:35:24 +0000
committerroot <[email protected]>2023-12-07 09:35:24 +0000
commited2b9e3d510882eef7a2fa20730d89794d24f2ce (patch)
treeee0711cdafebbee42d3afb445d6d8e9a1e65e919 /shaping/src/shaper_stat.cpp
parentfe477349056d0797a5b1ca29556ee7689826b332 (diff)
TSG-17687: fix borrow early, only borrow when tconsume_cb don't get token
Diffstat (limited to 'shaping/src/shaper_stat.cpp')
-rw-r--r--shaping/src/shaper_stat.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/shaping/src/shaper_stat.cpp b/shaping/src/shaper_stat.cpp
index 40a52a2..e9cd3e6 100644
--- a/shaping/src/shaper_stat.cpp
+++ b/shaping/src/shaper_stat.cpp
@@ -134,19 +134,20 @@ static void shaper_stat_tags_build(int vsys_id, int rule_id, int profile_id, int
static void shaper_stat_swarmkv_hincrby_cb(const struct swarmkv_reply *reply, void * cb_arg)
{
- struct shaping_async_cb_arg *arg = (struct shaping_async_cb_arg *)cb_arg;
+ struct shaping_hincrby_cb_arg *arg = (struct shaping_hincrby_cb_arg *)cb_arg;
+ struct shaping_thread_ctx *ctx = arg->ctx;
struct timespec curr_time;
long long curr_time_us;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
curr_time_us = curr_time.tv_sec * MICRO_SECONDS_PER_SEC + curr_time.tv_nsec / NANO_SECONDS_PER_MICRO_SEC;
- shaper_global_stat_swarmkv_latency_update(arg->ctx->global_stat, curr_time_us - arg->start_time_us);
+ shaper_global_stat_swarmkv_latency_update(ctx->global_stat, curr_time_us - arg->start_time_us);
- shaper_global_stat_async_callback_inc(arg->ctx->global_stat);
- shaper_global_stat_hincrby_callback_inc(arg->ctx->global_stat);
+ shaper_global_stat_async_callback_inc(ctx->global_stat);
+ shaper_global_stat_hincrby_callback_inc(ctx->global_stat);
if (reply->type != SWARMKV_REPLY_INTEGER) {
- shaper_global_stat_async_hincrby_failed_inc(arg->ctx->global_stat);
+ shaper_global_stat_async_hincrby_failed_inc(ctx->global_stat);
}
free(cb_arg);
@@ -183,7 +184,7 @@ static void shaper_stat_profile_metirc_refresh(struct shaping_thread_ctx *ctx, i
fieldstat_dynamic_table_metric_value_incrby(stat->instance, stat->table_id, stat->column_ids[IN_QUEUE_LEN_IDX], SHAPER_STAT_ROW_NAME, profile_stat->in.queue_len, tags, TAG_IDX_MAX, thread_id);
fieldstat_dynamic_table_metric_value_incrby(stat->instance, stat->table_id, stat->column_ids[OUT_QUEUE_LEN_IDX], SHAPER_STAT_ROW_NAME, profile_stat->out.queue_len, tags, TAG_IDX_MAX, thread_id);
- struct shaping_async_cb_arg *arg = (struct shaping_async_cb_arg *)calloc(1, sizeof(struct shaping_async_cb_arg));
+ struct shaping_hincrby_cb_arg *arg = (struct shaping_hincrby_cb_arg *)calloc(1, sizeof(struct shaping_hincrby_cb_arg));
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);