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

Unified Diff: base/trace_event/heap_profiler_scoped_ignore.h

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_scoped_ignore.h
diff --git a/base/trace_event/heap_profiler_scoped_ignore.h b/base/trace_event/heap_profiler_scoped_ignore.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f4853df00360b31b86a4783c7ecced7c3c788ba
--- /dev/null
+++ b/base/trace_event/heap_profiler_scoped_ignore.h
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TRACE_EVENT_HEAP_PROFILER_SCOPED_IGNORE_H
Primiano Tucci (use gerrit) 2016/04/21 19:47:32 if you want feel free to call this file already he
ssid 2016/04/22 04:57:12 Done.
+#define BASE_TRACE_EVENT_HEAP_PROFILER_SCOPED_IGNORE_H
+
+#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
+#include "base/trace_event/trace_event.h"
Primiano Tucci (use gerrit) 2016/04/21 19:47:32 you are including this only for INTERNAL_TRACE_UID
ssid 2016/04/22 04:57:12 This does not seem to work. I had to add macros si
+
+#define HEAP_PROFILER_SCOPED_IGNORE \
+ base::trace_event::HeapProfilerScopedIgnore INTERNAL_TRACE_EVENT_UID( \
+ heap_profiler_ignore); \
+ if (UNLIKELY( \
+ base::trace_event::AllocationContextTracker::capture_enabled())) { \
Primiano Tucci (use gerrit) 2016/04/21 19:47:32 remove the curly braces and make this if (UNLIKE
ssid 2016/04/22 04:57:12 Done.
+ base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() \
+ ->begin_ignore_scope(); \
+ }
+
+namespace base {
+namespace trace_event {
+
+// A scoped ignore event used to tell AllocationContextTracker to ignore all the
Primiano Tucci (use gerrit) 2016/04/21 19:47:32 s/AllocationCOntextTracker/the memory-infra heap p
ssid 2016/04/22 04:57:12 Done.
+// allocations in the scope. It is useful to exclude allocations made for
+// tracing from the heap profiler dumps. This class is to be used only using the
+// macro HEAP_PROFILER_SCOPED_IGNORE.
+class BASE_EXPORT HeapProfilerScopedIgnore {
+ public:
+ HeapProfilerScopedIgnore();
+ ~HeapProfilerScopedIgnore();
+};
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_HEAP_PROFILER_SCOPED_IGNORE_H

Powered by Google App Engine
This is Rietveld 408576698