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

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

Issue 1375963007: [tracing] Display the resident size of the discardable memory segments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lock_discardable
Patch Set: Nit. Created 5 years, 2 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 | « no previous file | base/trace_event/process_memory_dump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PROCESS_MEMORY_DUMP_H_ 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/containers/small_map.h" 12 #include "base/containers/small_map.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/trace_event/memory_allocator_dump.h" 15 #include "base/trace_event/memory_allocator_dump.h"
16 #include "base/trace_event/memory_allocator_dump_guid.h" 16 #include "base/trace_event/memory_allocator_dump_guid.h"
17 #include "base/trace_event/memory_dump_session_state.h" 17 #include "base/trace_event/memory_dump_session_state.h"
18 #include "base/trace_event/process_memory_maps.h" 18 #include "base/trace_event/process_memory_maps.h"
19 #include "base/trace_event/process_memory_totals.h" 19 #include "base/trace_event/process_memory_totals.h"
20 20
21 // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the
22 // resident memory.
23 #if defined(OS_POSIX) && !defined(OS_NACL)
24 #define COUNT_RESIDENT_BYTES_SUPPORTED
25 #endif
26
21 namespace base { 27 namespace base {
22 namespace trace_event { 28 namespace trace_event {
23 29
24 class ConvertableToTraceFormat; 30 class ConvertableToTraceFormat;
25 class MemoryDumpManager; 31 class MemoryDumpManager;
26 class MemoryDumpSessionState; 32 class MemoryDumpSessionState;
27 33
28 // ProcessMemoryDump is as a strongly typed container which holds the dumps 34 // ProcessMemoryDump is as a strongly typed container which holds the dumps
29 // produced by the MemoryDumpProvider(s) for a specific process. 35 // produced by the MemoryDumpProvider(s) for a specific process.
30 class BASE_EXPORT ProcessMemoryDump { 36 class BASE_EXPORT ProcessMemoryDump {
31 public: 37 public:
32 struct MemoryAllocatorDumpEdge { 38 struct MemoryAllocatorDumpEdge {
33 MemoryAllocatorDumpGuid source; 39 MemoryAllocatorDumpGuid source;
34 MemoryAllocatorDumpGuid target; 40 MemoryAllocatorDumpGuid target;
35 int importance; 41 int importance;
36 const char* type; 42 const char* type;
37 }; 43 };
38 44
39 // Maps allocator dumps absolute names (allocator_name/heap/subheap) to 45 // Maps allocator dumps absolute names (allocator_name/heap/subheap) to
40 // MemoryAllocatorDump instances. 46 // MemoryAllocatorDump instances.
41 using AllocatorDumpsMap = 47 using AllocatorDumpsMap =
42 SmallMap<hash_map<std::string, MemoryAllocatorDump*>>; 48 SmallMap<hash_map<std::string, MemoryAllocatorDump*>>;
43 49
50 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
51 // Returns the total bytes resident for a virtual address range, with given
52 // |start_address| and |mapped_size|. |mapped_size| is specified in bytes. The
53 // value returned is valid only if the given range is currently mmapped by the
54 // process. The |start_address| must be page-aligned.
55 static size_t CountResidentBytes(void* start_address, size_t mapped_size);
56 #endif
57
44 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state); 58 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state);
45 ~ProcessMemoryDump(); 59 ~ProcessMemoryDump();
46 60
47 // Creates a new MemoryAllocatorDump with the given name and returns the 61 // Creates a new MemoryAllocatorDump with the given name and returns the
48 // empty object back to the caller. 62 // empty object back to the caller.
49 // Arguments: 63 // Arguments:
50 // absolute_name: a name that uniquely identifies allocator dumps produced 64 // absolute_name: a name that uniquely identifies allocator dumps produced
51 // by this provider. It is possible to specify nesting by using a 65 // by this provider. It is possible to specify nesting by using a
52 // path-like string (e.g., v8/isolate1/heap1, v8/isolate1/heap2). 66 // path-like string (e.g., v8/isolate1/heap1, v8/isolate1/heap2).
53 // Leading or trailing slashes are not allowed. 67 // Leading or trailing slashes are not allowed.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Keeps track of relationships between MemoryAllocatorDump(s). 162 // Keeps track of relationships between MemoryAllocatorDump(s).
149 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; 163 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_;
150 164
151 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); 165 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump);
152 }; 166 };
153 167
154 } // namespace trace_event 168 } // namespace trace_event
155 } // namespace base 169 } // namespace base
156 170
157 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ 171 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/process_memory_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698