From a04cb3a7a50913f842b100529c2a881daf73efd7 Mon Sep 17 00:00:00 2001 From: chenzizhan Date: Tue, 18 Jun 2024 09:58:48 +0800 Subject: performance, use rcu in fieldstat_easy_output_array_and_reset --- src/fieldstat_easy.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/fieldstat_easy.c b/src/fieldstat_easy.c index b8909a0..9319a41 100644 --- a/src/fieldstat_easy.c +++ b/src/fieldstat_easy.c @@ -295,16 +295,14 @@ void fieldstat_easy_output_array(struct fieldstat_easy *fse, char ***json_object int fieldstat_easy_output_array_and_reset(struct fieldstat_easy *fse, char ***json_objects, size_t *n_object) { if (fse->output_thread_running) { - printf("fieldstat_easy_output_array_and_reset: reset is not allowed when auto output is enabled.\n"); + printf("fieldstat_easy_output_array_and_reset: Output is not allowed when auto output is enabled.\n"); return -1; } struct fieldstat *dst = fieldstat_new(); for (int i = 0; i < fse->max_thread_num; i++) { - pthread_spin_lock(&fse->fsu[i].lock); - fieldstat_merge(dst, fse->fsu[i].active); - fieldstat_reset(fse->fsu[i].active); - pthread_spin_unlock(&fse->fsu[i].lock); + rcu_reclaim_handler(fse->fsu + i); + fieldstat_merge(dst, fse->fsu[i].read_only); } struct timeval timestamp = get_current_timestamp(); -- cgit v1.2.3