OLD | NEW |
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_TRACE_EVENT_MEMORY_OVERHEAD_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ |
6 #define BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ | 6 #define BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <unordered_map> |
| 11 |
10 #include "base/base_export.h" | 12 #include "base/base_export.h" |
11 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
12 #include "base/containers/small_map.h" | 14 #include "base/containers/small_map.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 | 18 |
17 class RefCountedString; | 19 class RefCountedString; |
18 class Value; | 20 class Value; |
19 | 21 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void Update(const TraceEventMemoryOverhead& other); | 55 void Update(const TraceEventMemoryOverhead& other); |
54 | 56 |
55 void DumpInto(const char* base_name, ProcessMemoryDump* pmd) const; | 57 void DumpInto(const char* base_name, ProcessMemoryDump* pmd) const; |
56 | 58 |
57 private: | 59 private: |
58 struct ObjectCountAndSize { | 60 struct ObjectCountAndSize { |
59 size_t count; | 61 size_t count; |
60 size_t allocated_size_in_bytes; | 62 size_t allocated_size_in_bytes; |
61 size_t resident_size_in_bytes; | 63 size_t resident_size_in_bytes; |
62 }; | 64 }; |
63 using map_type = small_map<hash_map<const char*, ObjectCountAndSize>, 16>; | 65 using map_type = |
| 66 small_map<std::unordered_map<const char*, ObjectCountAndSize>, 16>; |
64 map_type allocated_objects_; | 67 map_type allocated_objects_; |
65 | 68 |
66 void AddOrCreateInternal(const char* object_type, | 69 void AddOrCreateInternal(const char* object_type, |
67 size_t count, | 70 size_t count, |
68 size_t allocated_size_in_bytes, | 71 size_t allocated_size_in_bytes, |
69 size_t resident_size_in_bytes); | 72 size_t resident_size_in_bytes); |
70 | 73 |
71 DISALLOW_COPY_AND_ASSIGN(TraceEventMemoryOverhead); | 74 DISALLOW_COPY_AND_ASSIGN(TraceEventMemoryOverhead); |
72 }; | 75 }; |
73 | 76 |
74 } // namespace trace_event | 77 } // namespace trace_event |
75 } // namespace base | 78 } // namespace base |
76 | 79 |
77 #endif // BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ | 80 #endif // BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ |
OLD | NEW |