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

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: added comments for functions 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 // Returns true if the two HeapProfileStats are semantically equal.
14 bool Equivalent(const HeapProfileStats& x) const {
jar (doing other things) 2013/03/08 04:43:31 nit: avoid use of one letter variables. Suggest "
Dai Mikurube (NOT FULLTIME) 2013/03/12 08:24:10 Ok, done. It was just a move from HeapProfileTabl
15 return allocs - frees == x.allocs - x.frees &&
16 alloc_size - free_size == x.alloc_size - x.free_size;
jar (doing other things) 2013/03/08 04:43:31 nit: indent 4
Dai Mikurube (NOT FULLTIME) 2013/03/12 08:24:10 Done.
17 }
18
19 int32 allocs; // Number of allocation calls.
20 int32 frees; // Number of free calls.
jar (doing other things) 2013/03/08 04:43:31 Why aren't these unsigned? What is the meaning af
Dai Mikurube (NOT FULLTIME) 2013/03/12 08:24:10 As I wrote above, it's just a move from the existi
21 int64 alloc_size; // Total size of all allocated objects so far.
22 int64 free_size; // Total size of all freed objects so far.
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;
jar (doing other things) 2013/03/08 04:43:31 Is the intiialization of a static inside a class l
Dai Mikurube (NOT FULLTIME) 2013/03/12 08:24:10 It works for static and const variables. We have
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