Some checks failed
Tests / Clang total: 1533, failed: 1, passed: 1532
Tests / Clang - debug total: 1531, passed: 1531
Tests / SIMD fallback total: 1533, failed: 1, passed: 1532
Tests / Release [gcc] total: 1533, failed: 1, passed: 1532
Tests / Release [gcc,aarch64] total: 1144, failed: 2, passed: 1142
Tests / Coverage total: 1151, passed: 1151
weaselab/conflict-set/pipeline/head There was a failure building this commit
Even concurrently with calling non-const methods on the associated ConflictSet
36 lines
933 B
C++
36 lines
933 B
C++
#include "ConflictSet.h"
|
|
|
|
#include <cassert>
|
|
#include <cstdio>
|
|
|
|
using namespace weaselab;
|
|
|
|
int main(void) {
|
|
ConflictSet cs(0);
|
|
ConflictSet::WriteRange w;
|
|
w.begin.p = (const uint8_t *)"0000";
|
|
w.begin.len = 4;
|
|
w.end.len = 0;
|
|
cs.addWrites(&w, 1, 1);
|
|
ConflictSet::Result result;
|
|
ConflictSet::ReadRange r;
|
|
r.begin.p = (const uint8_t *)"0000";
|
|
r.begin.len = 4;
|
|
r.end.len = 0;
|
|
r.readVersion = 0;
|
|
cs.check(&r, &result, 1);
|
|
assert(result == ConflictSet::Conflict);
|
|
int64_t bytes = cs.getBytes();
|
|
assert(bytes > 0);
|
|
|
|
ConflictSet::MetricsV1 *metrics;
|
|
int metricsCount;
|
|
cs.getMetricsV1(&metrics, &metricsCount);
|
|
for (int i = 0; i < metricsCount; ++i) {
|
|
printf("# HELP %s %s\n", metrics[i].name, metrics[i].help);
|
|
printf("# TYPE %s %s\n", metrics[i].name,
|
|
metrics[i].type == metrics[i].Counter ? "counter" : "gauge");
|
|
printf("%s %g\n", metrics[i].name, metrics[i].getValue());
|
|
}
|
|
}
|