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 { |
| 9 public: |
| 10 // Longest stack trace we record. |
| 11 static const int kMaxStackDepth = 32; |
| 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 |
| 20 bool Equivalent(const Stats& x) const { |
| 21 return allocs - frees == x.allocs - x.frees && |
| 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 |