diff options
| author | chenzizhan <[email protected]> | 2024-06-18 09:58:48 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-06-18 09:58:48 +0800 |
| commit | a04cb3a7a50913f842b100529c2a881daf73efd7 (patch) | |
| tree | 01219c08e1ef34991d76a83c2768ca34ae8f5dde | |
| parent | 5c39e8e0f8627ae0d7c72c0967bec000ee0010ea (diff) | |
performance, use rcu in fieldstat_easy_output_array_and_resetv4.5.10
| -rw-r--r-- | src/fieldstat_easy.c | 8 |
1 files 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(); |
