diff --git a/src/benchmark.cc b/src/benchmark.cc index b7767bd00..1aa432b8b 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -663,6 +663,10 @@ void RegisterMemoryManager(MemoryManager* manager) { } void RegisterProfilerManager(ProfilerManager* manager) { + // Don't allow overwriting an existing manager. + if (manager != nullptr) { + BM_CHECK_EQ(internal::profiler_manager, nullptr); + } internal::profiler_manager = manager; }