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

Unified Diff: third_party/tcmalloc/vendor/src/common.cc

Issue 9701040: Revert 126715 - Update the tcmalloc vendor 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
« no previous file with comments | « third_party/tcmalloc/vendor/src/common.h ('k') | third_party/tcmalloc/vendor/src/config.h.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/vendor/src/common.cc
===================================================================
--- third_party/tcmalloc/vendor/src/common.cc (revision 126727)
+++ third_party/tcmalloc/vendor/src/common.cc (working copy)
@@ -99,12 +99,10 @@
void SizeMap::Init() {
// Do some sanity checking on add_amount[]/shift_amount[]/class_array[]
if (ClassIndex(0) < 0) {
- Log(kCrash, __FILE__, __LINE__,
- "Invalid class index for size 0", ClassIndex(0));
+ CRASH("Invalid class index %d for size 0\n", ClassIndex(0));
}
if (ClassIndex(kMaxSize) >= sizeof(class_array_)) {
- Log(kCrash, __FILE__, __LINE__,
- "Invalid class index for kMaxSize", ClassIndex(kMaxSize));
+ CRASH("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
}
// Compute the size classes we want to use
@@ -149,8 +147,8 @@
sc++;
}
if (sc != kNumClasses) {
- Log(kCrash, __FILE__, __LINE__,
- "wrong number of size classes: (found vs. expected )", sc, kNumClasses);
+ CRASH("wrong number of size classes: found %d instead of %d\n",
+ sc, int(kNumClasses));
}
// Initialize the mapping arrays
@@ -167,18 +165,19 @@
for (size_t size = 0; size <= kMaxSize; size++) {
const int sc = SizeClass(size);
if (sc <= 0 || sc >= kNumClasses) {
- Log(kCrash, __FILE__, __LINE__,
- "Bad size class (class, size)", sc, size);
+ CRASH("Bad size class %d for %" PRIuS "\n", sc, size);
}
if (sc > 1 && size <= class_to_size_[sc-1]) {
- Log(kCrash, __FILE__, __LINE__,
- "Allocating unnecessarily large class (class, size)", sc, size);
+ CRASH("Allocating unnecessarily large class %d for %" PRIuS
+ "\n", sc, size);
}
const size_t s = class_to_size_[sc];
- if (size > s || s == 0) {
- Log(kCrash, __FILE__, __LINE__,
- "Bad (class, size, requested)", sc, s, size);
+ if (size > s) {
+ CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc);
}
+ if (s == 0) {
+ CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc);
+ }
}
// Initialize the num_objects_to_move array.
@@ -187,6 +186,23 @@
}
}
+void SizeMap::Dump(TCMalloc_Printer* out) {
+ // Dump class sizes and maximum external wastage per size class
+ for (size_t cl = 1; cl < kNumClasses; ++cl) {
+ const int alloc_size = class_to_pages_[cl] << kPageShift;
+ const int alloc_objs = alloc_size / class_to_size_[cl];
+ const int min_used = (class_to_size_[cl-1] + 1) * alloc_objs;
+ const int max_waste = alloc_size - min_used;
+ out->printf("SC %3d [ %8d .. %8d ] from %8d ; %2.0f%% maxwaste\n",
+ int(cl),
+ int(class_to_size_[cl-1] + 1),
+ int(class_to_size_[cl]),
+ int(class_to_pages_[cl] << kPageShift),
+ max_waste * 100.0 / alloc_size
+ );
+ }
+}
+
// Metadata allocator -- keeps stats about how many bytes allocated.
static uint64_t metadata_system_bytes_ = 0;
void* MetaDataAlloc(size_t bytes) {
« no previous file with comments | « third_party/tcmalloc/vendor/src/common.h ('k') | third_party/tcmalloc/vendor/src/config.h.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698