Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef HEAP_PROFILE_STATS_H_ | |
| 6 #define HEAP_PROFILE_STATS_H_ | |
| 7 | |
| 8 class HeapProfileStats { | |
|
Alexander Potapenko
2013/03/07 06:48:38
A class with no members and no methods, huh? Maybe
Dai Mikurube (NOT FULLTIME)
2013/03/07 12:32:16
Hmm, agreed. I had other methods in my local chan
| |
| 9 public: | |
|
Alexander Potapenko
2013/03/07 06:48:38
1-space indentation.
Dai Mikurube (NOT FULLTIME)
2013/03/07 12:32:16
It's unnecessary now because of the change above.
| |
| 10 // Longest stack trace we record. | |
| 11 static const int kMaxStackDepth = 32; | |
|
Alexander Potapenko
2013/03/07 06:48:38
Is that enough? Webkit stacks may have up to 250 f
Dai Mikurube (NOT FULLTIME)
2013/03/07 12:32:16
It's the default of TCMalloc's original value. We
| |
| 12 | |
| 13 struct Stats { | |
| 14 int32 allocs; // Number of allocation calls | |
| 15 int32 frees; // Number of free calls | |
| 16 int64 alloc_size; // Total size of all allocated objects so far | |
| 17 int64 free_size; // Total size of all freed objects so far | |
| 18 | |
| 19 // semantic equality | |
|
Alexander Potapenko
2013/03/07 06:48:38
Please fix the comment.
http://google-styleguide.g
Dai Mikurube (NOT FULLTIME)
2013/03/07 12:32:16
Done.
| |
| 20 bool Equivalent(const Stats& x) const { | |
| 21 return allocs - frees == x.allocs - x.frees && | |
|
Alexander Potapenko
2013/03/07 06:48:38
Please remove the extra space before &&.
Dai Mikurube (NOT FULLTIME)
2013/03/07 12:32:16
Done.
| |
| 22 alloc_size - free_size == x.alloc_size - x.free_size; | |
| 23 } | |
| 24 }; | |
| 25 | |
| 26 struct Bucket : public Stats { | |
| 27 uintptr_t hash; // Hash value of the stack trace | |
| 28 int depth; // Depth of stack trace | |
| 29 const void** stack; // Stack trace | |
| 30 Bucket* next; // Next entry in hash-table | |
| 31 }; | |
| 32 }; | |
| 33 | |
| 34 #endif // HEAP_PROFILE_STATS_H_ | |
| OLD | NEW |