Chromium Code Reviews| 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..3209bb752071aebb5a7ad6803481d0bcb43d6bfa |
| --- /dev/null |
| +++ b/third_party/tcmalloc/chromium/src/heap-profile-stats.h |
| @@ -0,0 +1,34 @@ |
| +// 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. |
| + |
| +#ifndef HEAP_PROFILE_STATS_H_ |
| +#define HEAP_PROFILE_STATS_H_ |
| + |
| +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
|
| +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.
|
| + // Longest stack trace we record. |
| + 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
|
| + |
| + struct Stats { |
| + int32 allocs; // Number of allocation calls |
| + int32 frees; // Number of free calls |
| + int64 alloc_size; // Total size of all allocated objects so far |
| + int64 free_size; // Total size of all freed objects so far |
| + |
| + // 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.
|
| + bool Equivalent(const Stats& x) const { |
| + 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.
|
| + alloc_size - free_size == x.alloc_size - x.free_size; |
| + } |
| + }; |
| + |
| + struct Bucket : public Stats { |
| + uintptr_t hash; // Hash value of the stack trace |
| + int depth; // Depth of stack trace |
| + const void** stack; // Stack trace |
| + Bucket* next; // Next entry in hash-table |
| + }; |
| +}; |
| + |
| +#endif // HEAP_PROFILE_STATS_H_ |