forked from weaselab/conflict-set
Make metrics thread-safe
Even concurrently with calling non-const methods on the associated ConflictSet
This commit is contained in:
@@ -362,10 +362,14 @@ void benchMetrics() {
|
||||
ankerl::nanobench::Bench bench;
|
||||
ConflictSet cs{0};
|
||||
|
||||
bench.run("metrics", [&]() {
|
||||
ConflictSet::MetricsV1 *m;
|
||||
int count;
|
||||
cs.getMetricsV1(&m, &count);
|
||||
int count;
|
||||
ConflictSet::MetricsV1 *m;
|
||||
cs.getMetricsV1(&m, &count);
|
||||
bench.batch(count);
|
||||
bench.run("fetch metric", [&]() {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
m[i].getValue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user