Index: base/trace_event/heap_profiler.h |
diff --git a/base/trace_event/heap_profiler.h b/base/trace_event/heap_profiler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..baa2c635d1bc14e329618f13e32ce54baa0c4de3 |
--- /dev/null |
+++ b/base/trace_event/heap_profiler.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
Dmitry Skiba
2016/04/22 05:37:45
2016
ssid
2016/04/22 05:48:27
Done.
|
+// 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_H |
+#define BASE_TRACE_EVENT_HEAP_PROFILER_H |
+ |
+#include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
+ |
+// This header file defines the set of macros that are used to track memory |
+// usage in the heap profiler. This is in addition to the macros defined in |
+// trace_event.h and are specific to heap profiler. This file also defines |
+// implementation details of these macros. |
+ |
+// Implementation detail: heap profiler macros create temporary variables to |
Primiano Tucci (use gerrit)
2016/04/22 09:24:50
this is really overkill, you are adding 7 lines, a
ssid
2016/04/22 14:49:06
As I said in earlier mail, this doesn't work.
It p
|
+// keep instrumentation overhead low. These macros give each temporary variable |
+// a unique name based on the line number to prevent name collisions. |
+#define INTERNAL_HEAP_PROFILER_EVENT_UID3(a, b) heap_profiler_unique_##a##b |
+#define INTERNAL_HEAP_PROFILER_EVENT_UID2(a, b) \ |
+ INTERNAL_HEAP_PROFILER_EVENT_UID3(a, b) |
+#define INTERNAL_HEAP_PROFILER_EVENT_UID(name_prefix) \ |
+ INTERNAL_HEAP_PROFILER_EVENT_UID2(name_prefix, __LINE__) |
+ |
+// A scoped ignore event used to tell heap profiler to ignore all the |
+// allocations in the scope. It is useful to exclude allocations made for |
+// tracing from the heap profiler dumps. |
+#define HEAP_PROFILER_SCOPED_IGNORE \ |
+ trace_event_internal::HeapProfilerScopedIgnore \ |
+ INTERNAL_HEAP_PROFILER_EVENT_UID(scoped_ignore); \ |
Dmitry Skiba
2016/04/22 05:37:45
Why do you need this at all, if it's only used onc
ssid
2016/04/22 05:48:27
Yes, but at least the user of this macro doesn't h
Dmitry Skiba
2016/04/22 06:01:20
Actually, wait. Why it's called INTERNAL_HEAP_PROF
ssid
2016/04/22 16:24:49
Done.
|
+ if (UNLIKELY( \ |
+ base::trace_event::AllocationContextTracker::capture_enabled())) \ |
+ base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() \ |
+ ->begin_ignore_scope() |
Dmitry Skiba
2016/04/22 05:37:45
Wait, why this is not in HeapProfilerScopedIngnore
ssid
2016/04/22 05:48:27
Primiano had suggested that keeping this out reduc
Dmitry Skiba
2016/04/22 06:01:20
How about inline constructor then? Actually, how a
Primiano Tucci (use gerrit)
2016/04/22 09:24:50
inlining both SGTM and might be even cleaner (also
ssid
2016/04/22 16:24:49
Done.
|
+ |
+namespace trace_event_internal { |
+ |
+class BASE_EXPORT HeapProfilerScopedIgnore { |
+ public: |
+ HeapProfilerScopedIgnore(); |
+ ~HeapProfilerScopedIgnore(); |
+}; |
+ |
+} // namespace trace_event_internal |
+ |
+#endif // BASE_TRACE_EVENT_HEAP_PROFILER_H |