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

Side by Side Diff: third_party/tcmalloc/chromium/src/heap-profile-stats.h

Issue 12388070: Count m(un)map for each stacktrace in MemoryRegionMap instead of HeapProfileTable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comments Created 7 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 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 // This file defines structs to accumulate memory allocation and deallocation
6 // counts. These structs are commonly used for malloc (in HeapProfileTable)
7 // and mmap (in MemoryRegionMap).
8
9 #ifndef HEAP_PROFILE_STATS_H_
10 #define HEAP_PROFILE_STATS_H_
11
12 struct HeapProfileStats {
13 int32 allocs; // Number of allocation calls.
Alexander Potapenko 2013/03/07 14:50:52 Again, methods before members and DISALLOW_COPY_AN
Dai Mikurube (NOT FULLTIME) 2013/03/07 17:14:24 Reordered. And, I don't add DISALLOW_COPY_AND_ASS
14 int32 frees; // Number of free calls.
15 int64 alloc_size; // Total size of all allocated objects so far.
16 int64 free_size; // Total size of all freed objects so far.
17
18 // Returns true if the two HeapProfileStats are semantically equal.
19 bool Equivalent(const HeapProfileStats& x) const {
20 return allocs - frees == x.allocs - x.frees &&
21 alloc_size - free_size == x.alloc_size - x.free_size;
22 }
23 };
24
25 // Allocation and deallocation statistics per each stack trace.
26 struct HeapProfileBucket : public HeapProfileStats {
27 // Longest stack trace we record.
28 static const int kMaxStackDepth = 32;
29
30 uintptr_t hash; // Hash value of the stack trace.
31 int depth; // Depth of stack trace.
32 const void** stack; // Stack trace.
33 HeapProfileBucket* next; // Next entry in hash-table.
34 };
35
36 #endif // HEAP_PROFILE_STATS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698