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

Side by Side Diff: base/trace_event/heap_profiler.h

Issue 1900223003: [tracing] Ignore tracing allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make heap_profiler.h and rebase 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 unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/heap_profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_H
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_H
7
8 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
9
10 // This header file defines the set of macros that are used to track memory
11 // usage in the heap profiler. This is in addition to the macros defined in
12 // trace_event.h and are specific to heap profiler. This file also defines
13 // implementation details of these macros.
14
15 // 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
16 // keep instrumentation overhead low. These macros give each temporary variable
17 // a unique name based on the line number to prevent name collisions.
18 #define INTERNAL_HEAP_PROFILER_EVENT_UID3(a, b) heap_profiler_unique_##a##b
19 #define INTERNAL_HEAP_PROFILER_EVENT_UID2(a, b) \
20 INTERNAL_HEAP_PROFILER_EVENT_UID3(a, b)
21 #define INTERNAL_HEAP_PROFILER_EVENT_UID(name_prefix) \
22 INTERNAL_HEAP_PROFILER_EVENT_UID2(name_prefix, __LINE__)
23
24 // A scoped ignore event used to tell heap profiler to ignore all the
25 // allocations in the scope. It is useful to exclude allocations made for
26 // tracing from the heap profiler dumps.
27 #define HEAP_PROFILER_SCOPED_IGNORE \
28 trace_event_internal::HeapProfilerScopedIgnore \
29 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.
30 if (UNLIKELY( \
31 base::trace_event::AllocationContextTracker::capture_enabled())) \
32 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() \
33 ->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.
34
35 namespace trace_event_internal {
36
37 class BASE_EXPORT HeapProfilerScopedIgnore {
38 public:
39 HeapProfilerScopedIgnore();
40 ~HeapProfilerScopedIgnore();
41 };
42
43 } // namespace trace_event_internal
44
45 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_H
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/heap_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698