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

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

Issue 1100173002: Add a WinHeap dump provider to the memory profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(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_H_
6 #define BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_H_
7
8 #include <istream>
Primiano Tucci (use gerrit) 2015/04/22 23:48:32 out of curiosity, what do you need istream for in
Sébastien Marchand 2015/04/23 10:52:03 It's a leftover from one of my experiments :), rem
9 #include <set>
10
11 #include "base/memory/singleton.h"
12 #include "base/trace_event/memory_dump_provider.h"
13
14 namespace base {
15 namespace trace_event {
16
17 // A structure containing some information about a given heap.
18 struct WinHeapInfo {
19 HANDLE heap_id;
20 size_t committed_size;
21 size_t allocated_size;
22 size_t block_count;
23 };
24
25 // Dump provider which collects process-wide heap memory stats. This provider
26 // iterates over all the heaps of the current process to gather some metrics
27 // about them.
28 class BASE_EXPORT WinHeapDumpProvider : public MemoryDumpProvider {
29 public:
30 static WinHeapDumpProvider* GetInstance();
31
32 // MemoryDumpProvider implementation.
33 bool DumpInto(ProcessMemoryDump* pmd) override;
34 const char* GetFriendlyName() const override;
35
36 protected:
37 // Retrieves the information about given heap. The |heap_info| should contain
Primiano Tucci (use gerrit) 2015/04/22 23:48:32 Should this friend the test class?
Sébastien Marchand 2015/04/23 10:52:03 Done.
38 // a valid handle to an existing heap. The blocks contained in the
39 // |block_to_skip| set will be ignored.
40 bool GetHeapInformation(WinHeapInfo* heap_info,
41 const std::set<void*>& block_to_skip);
42
43 // Exposed as protected for unittesting purposes.
44 WinHeapDumpProvider() { }
45 ~WinHeapDumpProvider() override { }
46
47 private:
48 friend struct DefaultSingletonTraits<WinHeapDumpProvider>;
49
50 DISALLOW_COPY_AND_ASSIGN(WinHeapDumpProvider);
51 };
52
53 } // namespace trace_event
54 } // namespace base
55
56 #endif // BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698