amputate unused kCrashWithStats

This commit is contained in:
Aliaksey Kandratsenka 2024-02-05 22:31:58 -05:00
parent 45a4ad8b70
commit b6798a5130
3 changed files with 0 additions and 22 deletions

View File

@ -45,13 +45,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/spinlock.h" // for SpinLockHolder, SpinLock #include "base/spinlock.h" // for SpinLockHolder, SpinLock
// Variables for storing crash output. Allocated statically since we
// may not be able to heap-allocate while crashing.
static SpinLock crash_lock;
static bool crashed = false;
static const int kStatsBufferSize = 16 << 10;
static char stats_buffer[kStatsBufferSize] = { 0 };
namespace tcmalloc { namespace tcmalloc {
static void WriteMessage(const char* msg, int length) { static void WriteMessage(const char* msg, int length) {
@ -100,20 +93,7 @@ void Log(LogMode mode, const char* filename, int line,
return; return;
} }
bool first_crash = false;
{
SpinLockHolder l(&crash_lock);
if (!crashed) {
crashed = true;
first_crash = true;
}
}
(*log_message_writer)(state.buf_, msglen); (*log_message_writer)(state.buf_, msglen);
if (first_crash && mode == kCrashWithStats) {
MallocExtension::instance()->GetStats(stats_buffer, kStatsBufferSize);
(*log_message_writer)(stats_buffer, strlen(stats_buffer));
}
abort(); abort();
} }

View File

@ -55,7 +55,6 @@ namespace tcmalloc {
enum LogMode { enum LogMode {
kLog, // Just print the message kLog, // Just print the message
kCrash, // Print the message and crash kCrash, // Print the message and crash
kCrashWithStats // Print the message, some stats, and crash
}; };
class Logger; class Logger;

View File

@ -146,7 +146,6 @@ using std::vector;
using tcmalloc::kLog; using tcmalloc::kLog;
using tcmalloc::kCrash; using tcmalloc::kCrash;
using tcmalloc::kCrashWithStats;
using tcmalloc::Log; using tcmalloc::Log;
using tcmalloc::PageHeap; using tcmalloc::PageHeap;
using tcmalloc::PageHeapAllocator; using tcmalloc::PageHeapAllocator;