Add public showMemory symbol (when SHOW_MEMORY=1)
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#if SHOW_MEMORY
|
||||||
|
void showMemory(const ConflictSet &cs);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ANKERL_NANOBENCH_IMPLEMENT
|
#define ANKERL_NANOBENCH_IMPLEMENT
|
||||||
#include "third_party/nanobench.h"
|
#include "third_party/nanobench.h"
|
||||||
|
|
||||||
|
@@ -1905,21 +1905,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
|
|||||||
root->entry.rangeVersion = oldestVersion;
|
root->entry.rangeVersion = oldestVersion;
|
||||||
root->entryPresent = true;
|
root->entryPresent = true;
|
||||||
}
|
}
|
||||||
~Impl() {
|
~Impl() { destroyTree(root); }
|
||||||
destroyTree(root);
|
|
||||||
#if SHOW_MEMORY
|
|
||||||
fprintf(stderr, "Max Node1 memory usage: %" PRId64 "\n",
|
|
||||||
allocators.node1.highWaterMarkBytes());
|
|
||||||
fprintf(stderr, "Max Node4 memory usage: %" PRId64 "\n",
|
|
||||||
allocators.node4.highWaterMarkBytes());
|
|
||||||
fprintf(stderr, "Max Node16 memory usage: %" PRId64 "\n",
|
|
||||||
allocators.node16.highWaterMarkBytes());
|
|
||||||
fprintf(stderr, "Max Node48 memory usage: %" PRId64 "\n",
|
|
||||||
allocators.node48.highWaterMarkBytes());
|
|
||||||
fprintf(stderr, "Max Node256 memory usage: %" PRId64 "\n",
|
|
||||||
allocators.node256.highWaterMarkBytes());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeAllocators allocators;
|
NodeAllocators allocators;
|
||||||
|
|
||||||
@@ -1981,6 +1967,23 @@ ConflictSet::~ConflictSet() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SHOW_MEMORY
|
||||||
|
__attribute__((visibility("default"))) void showMemory(const ConflictSet &cs) {
|
||||||
|
ConflictSet::Impl *impl;
|
||||||
|
memcpy(&impl, &cs, sizeof(impl)); // NOLINT
|
||||||
|
fprintf(stderr, "Max Node1 memory usage: %" PRId64 "\n",
|
||||||
|
impl->allocators.node1.highWaterMarkBytes());
|
||||||
|
fprintf(stderr, "Max Node4 memory usage: %" PRId64 "\n",
|
||||||
|
impl->allocators.node4.highWaterMarkBytes());
|
||||||
|
fprintf(stderr, "Max Node16 memory usage: %" PRId64 "\n",
|
||||||
|
impl->allocators.node16.highWaterMarkBytes());
|
||||||
|
fprintf(stderr, "Max Node48 memory usage: %" PRId64 "\n",
|
||||||
|
impl->allocators.node48.highWaterMarkBytes());
|
||||||
|
fprintf(stderr, "Max Node256 memory usage: %" PRId64 "\n",
|
||||||
|
impl->allocators.node256.highWaterMarkBytes());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ConflictSet::ConflictSet(ConflictSet &&other) noexcept
|
ConflictSet::ConflictSet(ConflictSet &&other) noexcept
|
||||||
: impl(std::exchange(other.impl, nullptr)) {}
|
: impl(std::exchange(other.impl, nullptr)) {}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user