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

Unified Diff: base/trace_event/heap_profiler_allocation_context.h

Issue 1839503002: [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increase Backtrace frames, request even more frames 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/heap_profiler.h ('k') | base/trace_event/heap_profiler_allocation_context_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/heap_profiler_allocation_context.h
diff --git a/base/trace_event/heap_profiler_allocation_context.h b/base/trace_event/heap_profiler_allocation_context.h
index 764712f38aae352bd6f7eb3f246fcc48a78c07ec..3566dd08f5d377a7f66e5b747c48717723ffb7a5 100644
--- a/base/trace_event/heap_profiler_allocation_context.h
+++ b/base/trace_event/heap_profiler_allocation_context.h
@@ -29,9 +29,9 @@ namespace trace_event {
// memory used for tracing and accuracy. Measurements done on a prototype
// revealed that:
//
-// - In 60 percent of the cases, stack depth <= 7.
-// - In 87 percent of the cases, stack depth <= 9.
-// - In 95 percent of the cases, stack depth <= 11.
+// - In 60 percent of the cases, pseudo stack depth <= 7.
+// - In 87 percent of the cases, pseudo stack depth <= 9.
+// - In 95 percent of the cases, pseudo stack depth <= 11.
//
// See the design doc (https://goo.gl/4s7v7b) for more details.
@@ -44,6 +44,7 @@ struct BASE_EXPORT StackFrame {
enum class Type {
TRACE_EVENT_NAME, // const char* string
THREAD_NAME, // const char* thread name
+ PROGRAM_COUNTER, // as returned by stack tracing (e.g. by StackTrace)
};
static StackFrame FromTraceEventName(const char* name) {
@@ -52,6 +53,9 @@ struct BASE_EXPORT StackFrame {
static StackFrame FromThreadName(const char* name) {
return {Type::THREAD_NAME, name};
}
+ static StackFrame FromProgramCounter(const void* pc) {
+ return {Type::PROGRAM_COUNTER, pc};
+ }
Type type;
const void* value;
@@ -65,9 +69,9 @@ struct BASE_EXPORT Backtrace {
Backtrace();
// If the stack is higher than what can be stored here, the bottom frames
- // (the ones closer to main()) are stored. Based on the data above, a depth
- // of 12 captures the full stack in the vast majority of the cases.
- enum { kMaxFrameCount = 12 };
+ // (the ones closer to main()) are stored. Depth of 12 is enough for most
+ // pseudo traces (see above), but not for native traces, where we need more.
+ enum { kMaxFrameCount = 24 };
StackFrame frames[kMaxFrameCount];
size_t frame_count;
};
« no previous file with comments | « base/trace_event/heap_profiler.h ('k') | base/trace_event/heap_profiler_allocation_context_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698