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

Unified Diff: third_party/tcmalloc/vendor/src/thread_cache.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
Index: third_party/tcmalloc/vendor/src/thread_cache.cc
===================================================================
--- third_party/tcmalloc/vendor/src/thread_cache.cc (revision 126727)
+++ third_party/tcmalloc/vendor/src/thread_cache.cc (working copy)
@@ -32,7 +32,6 @@
#include <config.h>
#include "thread_cache.h"
-#include <errno.h>
#include <string.h> // for memcpy
#include <algorithm> // for max, min
#include "base/commandlineflags.h" // for SpinLockHolder
@@ -86,9 +85,8 @@
# include <sys/utsname.h> // DECL_UNAME checked for <sys/utsname.h> too
void CheckIfKernelSupportsTLS() {
struct utsname buf;
- if (uname(&buf) < 0) { // should be impossible
- Log(kLog, __FILE__, __LINE__,
- "uname failed assuming no TLS support (errno)", errno);
+ if (uname(&buf) != 0) { // should be impossible
+ MESSAGE("uname failed assuming no TLS support (errno=%d)\n", errno);
kernel_supports_tls = false;
} else if (strcasecmp(buf.sysname, "linux") == 0) {
// The linux case: the first kernel to support TLS was 2.6.0
@@ -100,10 +98,6 @@
kernel_supports_tls = false;
else
kernel_supports_tls = true;
- } else if (strcasecmp(buf.sysname, "CYGWIN_NT-6.1-WOW64") == 0) {
- // In my testing, this version of cygwin, at least, would hang
- // when using TLS.
- kernel_supports_tls = false;
} else { // some other kernel, we'll be optimisitic
kernel_supports_tls = true;
}
@@ -266,6 +260,10 @@
}
IncreaseCacheLimit();
+
+// int64 finish = CycleClock::Now();
+// CycleTimer ct;
+// MESSAGE("GC: %.0f ns\n", ct.CyclesToUsec(finish-start)*1000.0);
}
void ThreadCache::IncreaseCacheLimit() {
@@ -478,8 +476,32 @@
}
unclaimed_cache_space_ = overall_thread_cache_size_ - claimed;
per_thread_cache_size_ = space;
+ // TCMalloc_MESSAGE(__FILE__, __LINE__, "Threads %d => cache size %8d\n", n, int(space));
}
+void ThreadCache::Print(TCMalloc_Printer* out) const {
+ for (int cl = 0; cl < kNumClasses; ++cl) {
+ out->printf(" %5" PRIuS " : %4" PRIuS " len; %4d lo; %4"PRIuS
+ " max; %4"PRIuS" overages;\n",
+ Static::sizemap()->ByteSizeForClass(cl),
+ list_[cl].length(),
+ list_[cl].lowwatermark(),
+ list_[cl].max_length(),
+ list_[cl].length_overages());
+ }
+}
+
+void ThreadCache::PrintThreads(TCMalloc_Printer* out) {
+ size_t actual_limit = 0;
+ for (ThreadCache* h = thread_heaps_; h != NULL; h = h->next_) {
+ h->Print(out);
+ actual_limit += h->max_size_;
+ }
+ out->printf("ThreadCache overall: %"PRIuS ", unclaimed: %"PRIdS
+ ", actual: %"PRIuS"\n",
+ overall_thread_cache_size_, unclaimed_cache_space_, actual_limit);
+}
+
void ThreadCache::GetThreadStats(uint64_t* total_bytes, uint64_t* class_count) {
for (ThreadCache* h = thread_heaps_; h != NULL; h = h->next_) {
*total_bytes += h->Size();
« no previous file with comments | « third_party/tcmalloc/vendor/src/thread_cache.h ('k') | third_party/tcmalloc/vendor/src/windows/auto_testing_hook.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698