Index: third_party/tcmalloc/chromium/src/heap-profile-stats.h |
diff --git a/third_party/tcmalloc/chromium/src/heap-profile-stats.h b/third_party/tcmalloc/chromium/src/heap-profile-stats.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c2819619835dc913da183d50d3eaf43e0f02450a |
--- /dev/null |
+++ b/third_party/tcmalloc/chromium/src/heap-profile-stats.h |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This file defines structs to accumulate memory allocation and deallocation |
+// counts. These structs are commonly used for malloc (in HeapProfileTable) |
+// and mmap (in MemoryRegionMap). |
+ |
+#ifndef HEAP_PROFILE_STATS_H_ |
+#define HEAP_PROFILE_STATS_H_ |
+ |
+struct HeapProfileStats { |
+ // Returns true if the two HeapProfileStats are semantically equal. |
+ 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
|
+ return allocs - frees == x.allocs - x.frees && |
+ 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.
|
+ } |
+ |
+ int32 allocs; // Number of allocation calls. |
+ 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
|
+ int64 alloc_size; // Total size of all allocated objects so far. |
+ int64 free_size; // Total size of all freed objects so far. |
+}; |
+ |
+// Allocation and deallocation statistics per each stack trace. |
+struct HeapProfileBucket : public HeapProfileStats { |
+ // Longest stack trace we record. |
+ 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
|
+ |
+ uintptr_t hash; // Hash value of the stack trace. |
+ int depth; // Depth of stack trace. |
+ const void** stack; // Stack trace. |
+ HeapProfileBucket* next; // Next entry in hash-table. |
+}; |
+ |
+#endif // HEAP_PROFILE_STATS_H_ |