From 6895bffe081fbcfa6046b7cfc1e9e8824707f4a8 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 19 Sep 2024 19:51:47 +0000 Subject: [PATCH] missed change Change-Id: I16c246395ec8a90774a2cc513d3aa3cd173e0c15 Signed-off-by: Kuat Yessenov --- source/common/common/BUILD | 1 + source/common/common/thread.h | 1 + source/common/profiler/BUILD | 1 + source/common/profiler/profiler.cc | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/source/common/common/BUILD b/source/common/common/BUILD index e2f26a09a229..89a95df0a125 100644 --- a/source/common/common/BUILD +++ b/source/common/common/BUILD @@ -413,6 +413,7 @@ envoy_cc_library( srcs = ["thread.cc"], hdrs = ["thread.h"], deps = envoy_cc_platform_dep("thread_impl_lib") + [ + ":assert_lib", ":macros", ":non_copyable", "@com_google_absl//absl/synchronization", diff --git a/source/common/common/thread.h b/source/common/common/thread.h index 5403a29b0cca..105f95ae89f6 100644 --- a/source/common/common/thread.h +++ b/source/common/common/thread.h @@ -7,6 +7,7 @@ #include "envoy/thread/thread.h" +#include "source/common/common/assert.h" #include "source/common/common/non_copyable.h" #include "absl/synchronization/mutex.h" diff --git a/source/common/profiler/BUILD b/source/common/profiler/BUILD index 1757fd696fc1..d5990ff8662c 100644 --- a/source/common/profiler/BUILD +++ b/source/common/profiler/BUILD @@ -14,6 +14,7 @@ envoy_cc_library( hdrs = ["profiler.h"], tcmalloc_dep = 1, deps = [ + "//source/common/common:thread_lib", "@com_google_absl//absl/status:statusor", ], ) diff --git a/source/common/profiler/profiler.cc b/source/common/profiler/profiler.cc index 64ad6d1e8798..217ff5344990 100644 --- a/source/common/profiler/profiler.cc +++ b/source/common/profiler/profiler.cc @@ -2,6 +2,8 @@ #include +#include "source/common/common/thread.h" + #ifdef PROFILER_AVAILABLE #include "gperftools/heap-profiler.h" @@ -76,6 +78,7 @@ absl::StatusOr TcmallocProfiler::tcmallocHeapProfile() { } absl::Status TcmallocProfiler::startAllocationProfile() { + ASSERT_IS_MAIN_OR_TEST_THREAD(); if (alloc_profiler != nullptr) { return absl::Status(absl::StatusCode::kFailedPrecondition, "Allocation profiler has already started"); @@ -86,6 +89,7 @@ absl::Status TcmallocProfiler::startAllocationProfile() { } absl::StatusOr TcmallocProfiler::stopAllocationProfile() { + ASSERT_IS_MAIN_OR_TEST_THREAD(); if (!alloc_profiler) { return absl::Status(absl::StatusCode::kFailedPrecondition, "Allocation profiler is not started");