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

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

Issue 1900223003: [tracing] Ignore tracing allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ 5 #ifndef BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_
6 #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ 6 #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_
7 7
8 #include <istream> 8 #include <istream>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/platform_thread.h" 14 #include "base/threading/platform_thread.h"
15 #include "base/trace_event/memory_dump_provider.h" 15 #include "base/trace_event/memory_dump_provider.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 17
18 #if defined(OS_LINUX) || defined(OS_ANDROID) || \ 18 #if defined(OS_LINUX) || defined(OS_ANDROID) || \
19 (defined(OS_MACOSX) && !defined(OS_IOS)) 19 (defined(OS_MACOSX) && !defined(OS_IOS))
20 #define MALLOC_MEMORY_TRACING_SUPPORTED 20 #define MALLOC_MEMORY_TRACING_SUPPORTED
21 #endif 21 #endif
22 22
23 #define SCOPED_HEAP_PROFILER_IGNORE_MALLOC_EVENT \
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 HEAP_PROFILER_SCOPED_IGNORE should be enough as a
ssid 2016/04/21 01:07:46 Yes I have already prevented the initialization of
24 base::trace_event::MallocDumpProvider::ScopedHeapProfilerIgnoreMalloc event
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 Ok I know I suggested malloc_dump_provider in the
ssid 2016/04/21 01:07:46 Yes, I was expecting this comment. I still let thi
25
23 namespace base { 26 namespace base {
24 namespace trace_event { 27 namespace trace_event {
25 28
26 class AllocationRegister; 29 class AllocationRegister;
27 30
28 // Dump provider which collects process-wide memory stats. 31 // Dump provider which collects process-wide memory stats.
29 class BASE_EXPORT MallocDumpProvider : public MemoryDumpProvider { 32 class BASE_EXPORT MallocDumpProvider : public MemoryDumpProvider {
30 public: 33 public:
34 class ScopedHeapProfilerIgnoreMalloc {
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 I think I'd drop Malloc from the name, for the rea
ssid 2016/04/21 01:07:46 Done.
35 public:
36 ScopedHeapProfilerIgnoreMalloc();
37 ~ScopedHeapProfilerIgnoreMalloc();
38 };
39
31 // Name of the allocated_objects dump. Use this to declare suballocator dumps 40 // Name of the allocated_objects dump. Use this to declare suballocator dumps
32 // from other dump providers. 41 // from other dump providers.
33 static const char kAllocatedObjects[]; 42 static const char kAllocatedObjects[];
34 43
35 static MallocDumpProvider* GetInstance(); 44 static MallocDumpProvider* GetInstance();
36 45
37 // MemoryDumpProvider implementation. 46 // MemoryDumpProvider implementation.
38 bool OnMemoryDump(const MemoryDumpArgs& args, 47 bool OnMemoryDump(const MemoryDumpArgs& args,
39 ProcessMemoryDump* pmd) override; 48 ProcessMemoryDump* pmd) override;
40 49
(...skipping 19 matching lines...) Expand all
60 // generation is malloc/new-ing for its own bookeeping data structures. 69 // generation is malloc/new-ing for its own bookeeping data structures.
61 PlatformThreadId tid_dumping_heap_; 70 PlatformThreadId tid_dumping_heap_;
62 71
63 DISALLOW_COPY_AND_ASSIGN(MallocDumpProvider); 72 DISALLOW_COPY_AND_ASSIGN(MallocDumpProvider);
64 }; 73 };
65 74
66 } // namespace trace_event 75 } // namespace trace_event
67 } // namespace base 76 } // namespace base
68 77
69 #endif // BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ 78 #endif // BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698