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

Side by Side Diff: base/debug/trace_memory.h

Issue 15418002: Record Chrome trace events in tcmalloc heap profiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup, run in all renderers Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | base/debug/trace_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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_DEBUG_TRACE_MEMORY_H_
6 #define BASE_DEBUG_TRACE_MEMORY_H_
7
8 #include "base/base_export.h"
9
10 namespace base {
11
12 class BASE_EXPORT ScopedTraceMemory {
13 public:
14 ScopedTraceMemory(const char* category);
15 ~ScopedTraceMemory();
16
17 static int GetStackIndexForTest();
18 };
19
20 BASE_EXPORT void TraceMemoryStart();
21 BASE_EXPORT void TraceMemoryDump();
22 // Caller owns the char* and must release it with free().
23 BASE_EXPORT char* TraceMemoryDumpAsString();
24 BASE_EXPORT void TraceMemoryStop();
25
26 } // namespace base
27
28 // Make local variables with unique names based on the line number. Note that
29 // the extra level of redirection is needed.
30 #define INTERNAL_TRACE_MEMORY_ID3(line) trace_memory_unique_##line
31 #define INTERNAL_TRACE_MEMORY_ID2(line) INTERNAL_TRACE_MEMORY_ID3(line)
32 #define INTERNAL_TRACE_MEMORY_ID INTERNAL_TRACE_MEMORY_ID2(__LINE__)
33
34 // Generates a unique local variable name.
35 // TODO(jamescook): Make it record both category and name.
36 #define TRACE_MEMORY(category, name) \
37 base::ScopedTraceMemory INTERNAL_TRACE_MEMORY_ID(name);
38
39 // A special trace name that allows us to ignore memory allocations inside
40 // the memory dump system itself. The allocations are recorded, but the
41 // visualizer skips them. Must match the value in heap.js.
42 #define TRACE_MEMORY_IGNORE "trace-memory-ignore"
43
44 #endif // BASE_DEBUG_TRACE_MEMORY_H_
OLDNEW
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | base/debug/trace_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698