| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_ | |
| 6 #define BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <set> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/singleton.h" | |
| 14 #include "base/trace_event/memory_dump_provider.h" | |
| 15 | |
| 16 namespace base { | |
| 17 namespace trace_event { | |
| 18 | |
| 19 // A structure containing some information about a given heap. | |
| 20 struct WinHeapInfo { | |
| 21 HANDLE heap_id; | |
| 22 size_t committed_size; | |
| 23 size_t allocated_size; | |
| 24 size_t block_count; | |
| 25 }; | |
| 26 | |
| 27 // Dump provider which collects process-wide heap memory stats. This provider | |
| 28 // iterates over all the heaps of the current process to gather some metrics | |
| 29 // about them. | |
| 30 class BASE_EXPORT WinHeapDumpProvider : public MemoryDumpProvider { | |
| 31 public: | |
| 32 // Name of the allocated_objects dump. Use this to declare suballocator dumps | |
| 33 // from other dump providers. | |
| 34 static const char kAllocatedObjects[]; | |
| 35 | |
| 36 static WinHeapDumpProvider* GetInstance(); | |
| 37 | |
| 38 // MemoryDumpProvider implementation. | |
| 39 bool OnMemoryDump(const MemoryDumpArgs& args, | |
| 40 ProcessMemoryDump* pmd) override; | |
| 41 | |
| 42 private: | |
| 43 friend struct DefaultSingletonTraits<WinHeapDumpProvider>; | |
| 44 | |
| 45 // Retrieves the information about given heap. The |heap_info| should contain | |
| 46 // a valid handle to an existing heap. The blocks contained in the | |
| 47 // |block_to_skip| set will be ignored. | |
| 48 bool GetHeapInformation(WinHeapInfo* heap_info, | |
| 49 const std::set<void*>& block_to_skip); | |
| 50 | |
| 51 WinHeapDumpProvider() {} | |
| 52 ~WinHeapDumpProvider() override {} | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(WinHeapDumpProvider); | |
| 55 }; | |
| 56 | |
| 57 } // namespace trace_event | |
| 58 } // namespace base | |
| 59 | |
| 60 #endif // BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_ | |
| OLD | NEW |