| 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,14 @@
|
| size_t size_; // Combined size of data
|
| size_t max_size_; // size_ > max_size_ --> Scavenge()
|
|
|
| + // The following is the tally of bytes allocated on a thread as a response to
|
| + // any flavor of malloc() call. The aggegated amount includes all padding to
|
| + // the smallest class that can hold the request, or to the nearest whole page
|
| + // when a large allocation is made without using a class. This sum is
|
| + // currently used for Chromium profiling, where tallies are kept of the amount
|
| + // of memory allocated during the running of each task on each thread.
|
| + uint32 total_bytes_allocated_; // Total, modulo 2^32.
|
| +
|
| // We sample allocations, biased by the size of the allocation
|
| Sampler sampler_; // A sampler
|
|
|
| @@ -327,6 +346,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));
|
|
|