Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/thread_cache.h |
| =================================================================== |
| --- third_party/tcmalloc/chromium/src/thread_cache.h (revision 121705) |
| +++ third_party/tcmalloc/chromium/src/thread_cache.h (working copy) |
| @@ -96,6 +96,17 @@ |
| // should be sampled |
| bool SampleAllocation(size_t k); |
| + // Record additional bytes allocated. |
| + void AddToByteAllocatedTotal(size_t k) { total_bytes_allocated_ += k; } |
| + |
| + // Return the total number of bytes allocated from this heap. The value will |
| + // wrap when there is an overflow, and so only the differences between two |
| + // values should be relied on (and even then, modulo 2^32). |
| + uint32 GetTotalBytesAllocated() const; |
| + |
| + // On the current thread, return GetTotalBytesAllocated(). |
| + static uint32 GetBytesAllocatedOnCurrentThread(); |
| + |
| static void InitModule(); |
| static void InitTSD(); |
| static ThreadCache* GetThreadHeap(); |
| @@ -291,6 +302,9 @@ |
| size_t size_; // Combined size of data |
| size_t max_size_; // size_ > max_size_ --> Scavenge() |
| + // Chromium profiling. |
|
willchan no longer on Chromium
2012/02/15 01:29:56
You should comment more what this is. In particula
jar (doing other things)
2012/02/15 02:05:08
Done.
|
| + uint32 total_bytes_allocated_; // Total, modulo 2^32. |
| + |
| // We sample allocations, biased by the size of the allocation |
| Sampler sampler_; // A sampler |
| @@ -327,6 +341,10 @@ |
| return sampler_.SampleAllocation(k); |
| } |
| +inline uint32 ThreadCache::GetTotalBytesAllocated() const { |
| + return total_bytes_allocated_; |
| +} |
| + |
| inline void* ThreadCache::Allocate(size_t size, size_t cl) { |
| ASSERT(size <= kMaxSize); |
| ASSERT(size == Static::sizemap()->ByteSizeForClass(cl)); |