diff --git a/Internal.h b/Internal.h index 4942b0e..5cd03d9 100644 --- a/Internal.h +++ b/Internal.h @@ -18,6 +18,11 @@ #include #include +#if __has_include() +#define CALLGRIND +#include +#endif + #define DEBUG_VERBOSE 0 [[nodiscard]] inline auto @@ -556,7 +561,13 @@ template struct TestDriver { assert(iter == keys.end()); assert(i == numPointWrites + numRangeWrites); +#ifdef CALLGRIND + CALLGRIND_START_INSTRUMENTATION; +#endif cs.addWrites(writes, numPointWrites + numRangeWrites); +#ifdef CALLGRIND + CALLGRIND_STOP_INSTRUMENTATION; +#endif refImpl.addWrites(writes, numPointWrites + numRangeWrites); } { @@ -618,7 +629,13 @@ template struct TestDriver { new (arena) ConflictSet::Result[numPointReads + numRangeReads]; auto *results2 = new (arena) ConflictSet::Result[numPointReads + numRangeReads]; +#ifdef CALLGRIND + CALLGRIND_START_INSTRUMENTATION; +#endif cs.check(reads, results1, numPointReads + numRangeReads); +#ifdef CALLGRIND + CALLGRIND_STOP_INSTRUMENTATION; +#endif refImpl.check(reads, results2, numPointReads + numRangeReads); for (int i = 0; i < numPointReads + numRangeReads; ++i) { if (results1[i] != results2[i]) {