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/heap_profiler_allocation_context.h

Issue 1877313003: [tracing] Track number of allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up 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_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 27 matching lines...) Expand all
38 using StackFrame = const char*; 38 using StackFrame = const char*;
39 39
40 struct BASE_EXPORT Backtrace { 40 struct BASE_EXPORT Backtrace {
41 // Unused backtrace frames are filled with nullptr frames. If the stack is 41 // Unused backtrace frames are filled with nullptr frames. If the stack is
42 // higher than what can be stored here, the bottom frames are stored. Based 42 // higher than what can be stored here, the bottom frames are stored. Based
43 // on the data above, a depth of 12 captures the full stack in the vast 43 // on the data above, a depth of 12 captures the full stack in the vast
44 // majority of the cases. 44 // majority of the cases.
45 StackFrame frames[12]; 45 StackFrame frames[12];
46 }; 46 };
47 47
48 // Struct to store the size and count of the allocations.
49 struct AllocationsSizeAndCount {
Dmitry Skiba 2016/04/14 19:07:30 You call this 'metrics' everywhere else (metrics_b
Primiano Tucci (use gerrit) 2016/04/14 19:37:21 +1
ssid 2016/04/14 20:17:10 Done.
50 size_t size;
51 size_t count;
52 };
53
48 bool BASE_EXPORT operator==(const Backtrace& lhs, const Backtrace& rhs); 54 bool BASE_EXPORT operator==(const Backtrace& lhs, const Backtrace& rhs);
49 55
50 // The |AllocationContext| is context metadata that is kept for every allocation 56 // The |AllocationContext| is context metadata that is kept for every allocation
51 // when heap profiling is enabled. To simplify memory management for book- 57 // when heap profiling is enabled. To simplify memory management for book-
52 // keeping, this struct has a fixed size. All |const char*|s here must have 58 // keeping, this struct has a fixed size. All |const char*|s here must have
53 // static lifetime. 59 // static lifetime.
54 struct BASE_EXPORT AllocationContext { 60 struct BASE_EXPORT AllocationContext {
55 public: 61 public:
56 // An allocation context with empty backtrace and unknown type. 62 // An allocation context with empty backtrace and unknown type.
57 static AllocationContext Empty(); 63 static AllocationContext Empty();
(...skipping 30 matching lines...) Expand all
88 }; 94 };
89 95
90 template <> 96 template <>
91 struct BASE_EXPORT hash<base::trace_event::AllocationContext> { 97 struct BASE_EXPORT hash<base::trace_event::AllocationContext> {
92 size_t operator()(const base::trace_event::AllocationContext& context) const; 98 size_t operator()(const base::trace_event::AllocationContext& context) const;
93 }; 99 };
94 100
95 } // BASE_HASH_NAMESPACE 101 } // BASE_HASH_NAMESPACE
96 102
97 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 103 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698