diff options
| author | chenzizhan <[email protected]> | 2024-10-16 15:16:02 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-10-16 15:16:02 +0800 |
| commit | 0881c354b6ea011f6213c0f0af237e9260ca798a (patch) | |
| tree | 6a558385af24905fd907c1baca18f2408c244ead /include/fieldstat/fieldstat.h | |
| parent | c0e5467f94d11365e2c90c4fedf2c0d4f12862c4 (diff) | |
incrby batch
Diffstat (limited to 'include/fieldstat/fieldstat.h')
| -rw-r--r-- | include/fieldstat/fieldstat.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/fieldstat/fieldstat.h b/include/fieldstat/fieldstat.h index 0e3bce9..f47fb2d 100644 --- a/include/fieldstat/fieldstat.h +++ b/include/fieldstat/fieldstat.h @@ -122,6 +122,14 @@ int fieldstat_register_histogram(struct fieldstat *instance, int cube_id, const * @return Error codes. */ int fieldstat_counter_incrby(struct fieldstat *instance, int cube_id, int metric_id, const struct field *cell_dimensions, size_t n_dimensions, long long increment); + +/* + * @brief refer to fieldstat_counter_incrby. The difference is that the increments of multiple metrics are added in batch. It is faster than calling fieldstat_counter_incrby multiple times. + * @param metric_ids: metric ids, previously returned by fieldstat_register_counter, must be counters. + * @param increments: increments of the counter metrics. The length of increments must be equal to n_metrics. Position i of increments is the increment of metric_ids[i]. + * @param n_metrics: the length of metric_ids and increments. + * @return Error codes. Or just assert fail if the parameters are invalid. +*/ int fieldstat_counter_incrby_batch(struct fieldstat *instance, int cube_id, const struct field *cell_dimensions, size_t n_dimensions, int metric_ids[], long long increments[], size_t n_metrics); |
