Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3128)

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc

Issue 1900223003: [tracing] Ignore tracing allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
index 05c60c722c317cca7bf6e52453a5faba1d7b1903..2463f1a7366b86be9f5d21cd3fb2465ca1fd1cad 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
+++ b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
@@ -10,6 +10,7 @@
#include "base/pending_task.h"
#include "base/trace_event/heap_profiler_allocation_context.h"
#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
+#include "base/trace_event/heap_profiler_scoped_ignore.h"
#include "base/trace_event/trace_event.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -278,5 +279,17 @@ TEST_F(AllocationContextTrackerTest, TrackTaskContext) {
ASSERT_FALSE(ctx.type_name);
}
+TEST_F(AllocationContextTrackerTest, IgnoreAllocationTest) {
+ TRACE_EVENT0("Testing", kCupcake);
+ TRACE_EVENT0("Testing", kDonut);
+ HEAP_PROFILER_SCOPED_IGNORE;
+ AllocationContext ctx1 =
+ AllocationContextTracker::GetInstanceForCurrentThread()
+ ->GetContextSnapshot();
+ const StringPiece kTracingOverhead("tracing_overhead");
+ ASSERT_EQ(kTracingOverhead, ctx1.backtrace.frames[0]);
+ ASSERT_FALSE(ctx1.backtrace.frames[1]);
Primiano Tucci (use gerrit) 2016/04/21 19:47:32 this is not guaranteed to be nullptr anymore. This
ssid 2016/04/22 04:57:12 Done.
+}
+
} // namespace trace_event
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698