diff options
| author | chenzizhan <[email protected]> | 2024-10-16 15:29:28 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-10-16 15:29:28 +0800 |
| commit | 7a81c67ec9534772fc3041a8ba9212f11038627d (patch) | |
| tree | 8c16833d6d7516b3d776db656d565e66ad28d450 /src/fieldstat_easy.c | |
| parent | 0881c354b6ea011f6213c0f0af237e9260ca798a (diff) | |
fieldstat_easy_counter_incrby_batch
Diffstat (limited to 'src/fieldstat_easy.c')
| -rw-r--r-- | src/fieldstat_easy.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fieldstat_easy.c b/src/fieldstat_easy.c index ed94484..43447b3 100644 --- a/src/fieldstat_easy.c +++ b/src/fieldstat_easy.c @@ -339,6 +339,22 @@ int fieldstat_easy_counter_incrby(struct fieldstat_easy *fse, int thread_id, int return ret; } +int fieldstat_easy_counter_incrby_batch(struct fieldstat_easy *fse, int thread_id, int metric_ids[], const struct field *dimensions, size_t n_dimensions, const long long *increments, size_t n_metrics) +{ + if (thread_id < 0) { + return -1; + } + if (thread_id >= fse->max_thread_num) { + return -1; + } + + pthread_spin_lock(&fse->fsu[thread_id].lock); + int ret = fieldstat_counter_incrby_batch(fse->fsu[thread_id].active, 0, dimensions, n_dimensions, metric_ids, increments, n_metrics); + pthread_spin_unlock(&fse->fsu[thread_id].lock); + + return ret; +} + int fieldstat_easy_counter_set(struct fieldstat_easy *fse, int thread_id, int metric_id, const struct field *dimensions, size_t n_dimensions, long long value) { if (thread_id < 0) { |
