Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: third_party/tcmalloc/chromium/src/page_heap.cc

Issue 9667026: Revert 126020 - Experiment for updating the tcmalloc chromium branch to r144 (gperftools 2.0). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/page_heap.cc
===================================================================
--- third_party/tcmalloc/chromium/src/page_heap.cc (revision 126022)
+++ third_party/tcmalloc/chromium/src/page_heap.cc (working copy)
@@ -34,7 +34,7 @@
#ifdef HAVE_INTTYPES_H
#include <inttypes.h> // for PRIuPTR
#endif
-#include <gperftools/malloc_extension.h> // for MallocRange, etc
+#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
@@ -403,25 +403,103 @@
}
}
-void PageHeap::GetSmallSpanStats(SmallSpanStats* result) {
+static double MiB(uint64_t bytes) {
+ return bytes / 1048576.0;
+}
+
+static double PagesToMiB(uint64_t pages) {
+ return (pages << kPageShift) / 1048576.0;
+}
+
+void PageHeap::GetClassSizes(int64 class_sizes_normal[kMaxPages],
+ int64 class_sizes_returned[kMaxPages],
+ int64* normal_pages_in_spans,
+ int64* returned_pages_in_spans) {
+
for (int s = 0; s < kMaxPages; s++) {
- result->normal_length[s] = DLL_Length(&free_[s].normal);
- result->returned_length[s] = DLL_Length(&free_[s].returned);
+ if (class_sizes_normal != NULL) {
+ class_sizes_normal[s] = DLL_Length(&free_[s].normal);
+ }
+ if (class_sizes_returned != NULL) {
+ class_sizes_returned[s] = DLL_Length(&free_[s].returned);
+ }
}
+
+ if (normal_pages_in_spans != NULL) {
+ *normal_pages_in_spans = 0;
+ for (Span* s = large_.normal.next; s != &large_.normal; s = s->next) {
+ *normal_pages_in_spans += s->length;;
+ }
+ }
+
+ if (returned_pages_in_spans != NULL) {
+ *returned_pages_in_spans = 0;
+ for (Span* s = large_.returned.next; s != &large_.returned; s = s->next) {
+ *returned_pages_in_spans += s->length;
+ }
+ }
}
-void PageHeap::GetLargeSpanStats(LargeSpanStats* result) {
- result->spans = 0;
- result->normal_pages = 0;
- result->returned_pages = 0;
+void PageHeap::Dump(TCMalloc_Printer* out) {
+ int nonempty_sizes = 0;
+ for (int s = 0; s < kMaxPages; s++) {
+ if (!DLL_IsEmpty(&free_[s].normal) || !DLL_IsEmpty(&free_[s].returned)) {
+ nonempty_sizes++;
+ }
+ }
+ out->printf("------------------------------------------------\n");
+ 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;
+ for (int s = 0; s < kMaxPages; s++) {
+ const int n_length = DLL_Length(&free_[s].normal);
+ const int r_length = DLL_Length(&free_[s].returned);
+ if (n_length + r_length > 0) {
+ uint64_t n_pages = s * n_length;
+ uint64_t r_pages = s * r_length;
+ total_normal += n_pages;
+ total_returned += r_pages;
+ 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),
+ PagesToMiB(n_pages + r_pages),
+ PagesToMiB(total_normal + total_returned),
+ PagesToMiB(r_pages),
+ PagesToMiB(total_returned));
+ }
+ }
+
+ uint64_t n_pages = 0;
+ uint64_t r_pages = 0;
+ int n_spans = 0;
+ int r_spans = 0;
+ out->printf("Normal large spans:\n");
for (Span* s = large_.normal.next; s != &large_.normal; s = s->next) {
- result->normal_pages += s->length;;
- result->spans++;
+ 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) {
- result->returned_pages += s->length;
- result->spans++;
+ 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 MiB; %6.1f MiB cum"
+ "; unmapped: %6.1f MiB; %6.1f MiB cum\n",
+ (n_spans + r_spans),
+ PagesToMiB(n_pages + r_pages),
+ PagesToMiB(total_normal + total_returned),
+ PagesToMiB(r_pages),
+ PagesToMiB(total_returned));
}
bool PageHeap::GetNextRange(PageID start, base::MallocRange* r) {
« no previous file with comments | « third_party/tcmalloc/chromium/src/page_heap.h ('k') | third_party/tcmalloc/chromium/src/page_heap_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698