diff options
author | csilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2011-05-19 21:37:12 +0000 |
---|---|---|
committer | csilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2011-05-19 21:37:12 +0000 |
commit | 8c7d2289d24f7a49f1f6f60d4a6eaee06fa04c60 (patch) | |
tree | 204112b581d072707fe939f77a9b93a520e1028b /src/page_heap.cc | |
parent | 1d30e525ae6ac38ae381bb3118f7f47998af2942 (diff) | |
download | gperftools-8c7d2289d24f7a49f1f6f60d4a6eaee06fa04c60.tar.gz |
* Fix typos in comment in profiler.h (nrhodes)
* #include fixes (jyrki)
* Add missing stddef.h for ptrdiff_t (mec)
* Add M{,un}mapReplacement hooks into MallocHook (ribrdb)
* Force big alloc in frag test (ruemmler)
* PERF: Increase the size class cache to 64K entries (ruemmler)
* PERF: Increase the transfer cache by 16x (ruemmler)
* Use windows intrinsic to get the tsc (csilvers)
* Rename atomicops-internals-x86-msvc.h->windows.h (csilvers)
* Remove flaky DEATH test in malloc_hook_test (ppluzhnikov)
* Expose internal ReadStackTraces()/etc (lantran)
* Refactored system allocator logic (gangren)
* Include-what-you-use: cleanup tcmalloc #includes (csilvers)
* Don't set kAddressBits to 48 on 32-bit systems (csilvers)
* Add declaration for __rdtsc() for windows (koda)
* Don't revert to system alloc for expected errors (gangren)
* Add TCMALLOC_SMALL_BUT_SLOW support (ruemmler)
* Clarify that tcmalloc stats are MiB (robinson)
* Avoid setting cpuinfo_cycles_per_second to 0 (koda)
* Fix frag_unittest memory calculations (ruemmler)
* Remove support for non-tcmalloc debugallocation (blount)
* Add malloc_hook_test (llib)
* Change the objcopy -W test to be cross-friendly (mcgrathr)
* Export __tcmalloc in addition to _tcmalloc, for 86_64 (csilvers)
git-svn-id: http://gperftools.googlecode.com/svn/trunk@109 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/page_heap.cc')
-rw-r--r-- | src/page_heap.cc | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/src/page_heap.cc b/src/page_heap.cc index 2e02444..248e462 100644 --- a/src/page_heap.cc +++ b/src/page_heap.cc @@ -31,10 +31,16 @@ // Author: Sanjay Ghemawat <opensource@google.com> #include <config.h> -#include "page_heap.h" - -#include "static_vars.h" -#include "system-alloc.h" +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> // for PRIuPTR +#endif +#include <google/malloc_extension.h> // for MallocRange, etc +#include "base/basictypes.h" +#include "base/commandlineflags.h" +#include "internal_logging.h" // for ASSERT, TCMalloc_Printer, etc +#include "page_heap_allocator.h" // for PageHeapAllocator +#include "static_vars.h" // for Static +#include "system-alloc.h" // for TCMalloc_SystemAlloc, etc DEFINE_double(tcmalloc_release_rate, EnvToDouble("TCMALLOC_RELEASE_RATE", 1.0), @@ -336,11 +342,11 @@ void PageHeap::RegisterSizeClass(Span* span, size_t sc) { } } -static double MB(uint64_t bytes) { +static double MiB(uint64_t bytes) { return bytes / 1048576.0; } -static double PagesToMB(uint64_t pages) { +static double PagesToMiB(uint64_t pages) { return (pages << kPageShift) / 1048576.0; } @@ -381,8 +387,9 @@ void PageHeap::Dump(TCMalloc_Printer* out) { } } out->printf("------------------------------------------------\n"); - out->printf("PageHeap: %d sizes; %6.1f MB free; %6.1f MB unmapped\n", - nonempty_sizes, MB(stats_.free_bytes), MB(stats_.unmapped_bytes)); + out->printf("PageHeap: %d sizes; %6.1f MiB free; %6.1f MiB unmapped\n", + nonempty_sizes, MiB(stats_.free_bytes), + MiB(stats_.unmapped_bytes)); out->printf("------------------------------------------------\n"); uint64_t total_normal = 0; uint64_t total_returned = 0; @@ -394,14 +401,14 @@ void PageHeap::Dump(TCMalloc_Printer* out) { uint64_t r_pages = s * r_length; total_normal += n_pages; total_returned += r_pages; - out->printf("%6u pages * %6u spans ~ %6.1f MB; %6.1f MB cum" - "; unmapped: %6.1f MB; %6.1f MB cum\n", + out->printf("%6u pages * %6u spans ~ %6.1f MiB; %6.1f MiB cum" + "; unmapped: %6.1f MiB; %6.1f MiB cum\n", s, (n_length + r_length), - PagesToMB(n_pages + r_pages), - PagesToMB(total_normal + total_returned), - PagesToMB(r_pages), - PagesToMB(total_returned)); + PagesToMiB(n_pages + r_pages), + PagesToMiB(total_normal + total_returned), + PagesToMiB(r_pages), + PagesToMiB(total_returned)); } } @@ -411,27 +418,27 @@ void PageHeap::Dump(TCMalloc_Printer* out) { int r_spans = 0; out->printf("Normal large spans:\n"); for (Span* s = large_.normal.next; s != &large_.normal; s = s->next) { - out->printf(" [ %6" PRIuPTR " pages ] %6.1f MB\n", - s->length, PagesToMB(s->length)); + out->printf(" [ %6" PRIuPTR " pages ] %6.1f MiB\n", + s->length, PagesToMiB(s->length)); n_pages += s->length; n_spans++; } out->printf("Unmapped large spans:\n"); for (Span* s = large_.returned.next; s != &large_.returned; s = s->next) { - out->printf(" [ %6" PRIuPTR " pages ] %6.1f MB\n", - s->length, PagesToMB(s->length)); + out->printf(" [ %6" PRIuPTR " pages ] %6.1f MiB\n", + s->length, PagesToMiB(s->length)); r_pages += s->length; r_spans++; } total_normal += n_pages; total_returned += r_pages; - out->printf(">255 large * %6u spans ~ %6.1f MB; %6.1f MB cum" - "; unmapped: %6.1f MB; %6.1f MB cum\n", + out->printf(">255 large * %6u spans ~ %6.1f MiB; %6.1f MiB cum" + "; unmapped: %6.1f MiB; %6.1f MiB cum\n", (n_spans + r_spans), - PagesToMB(n_pages + r_pages), - PagesToMB(total_normal + total_returned), - PagesToMB(r_pages), - PagesToMB(total_returned)); + PagesToMiB(n_pages + r_pages), + PagesToMiB(total_normal + total_returned), + PagesToMiB(r_pages), + PagesToMiB(total_returned)); } bool PageHeap::GetNextRange(PageID start, base::MallocRange* r) { |