mirror of
https://github.com/gperftools/gperftools
synced 2025-01-02 20:52:03 +00:00
amputate span events history
Nobody used it in years. Abseil tcmalloc had it amputated years ago.
This commit is contained in:
parent
e40c7f231a
commit
87acc2782f
@ -110,7 +110,6 @@ void CentralFreeList::ReleaseToSpans(void* object) {
|
||||
if (span->objects == NULL) {
|
||||
tcmalloc::DLL_Remove(span);
|
||||
tcmalloc::DLL_Prepend(&nonempty_, span);
|
||||
Event(span, 'N', 0);
|
||||
}
|
||||
|
||||
// The following check is expensive, so it is disabled by default
|
||||
@ -129,7 +128,6 @@ void CentralFreeList::ReleaseToSpans(void* object) {
|
||||
counter_++;
|
||||
span->refcount--;
|
||||
if (span->refcount == 0) {
|
||||
Event(span, '#', 0);
|
||||
counter_ -= ((span->length<<kPageShift) /
|
||||
Static::sizemap()->ByteSizeForClass(span->sizeclass));
|
||||
tcmalloc::DLL_Remove(span);
|
||||
@ -305,7 +303,6 @@ int CentralFreeList::FetchFromOneSpans(int N, void **start, void **end) {
|
||||
// Move to empty list
|
||||
tcmalloc::DLL_Remove(span);
|
||||
tcmalloc::DLL_Prepend(&empty_, span);
|
||||
Event(span, 'E', 0);
|
||||
}
|
||||
|
||||
*start = span->objects;
|
||||
|
@ -221,12 +221,10 @@ Span* PageHeap::Split(Span* span, Length n) {
|
||||
ASSERT(n < span->length);
|
||||
ASSERT(span->location == Span::IN_USE);
|
||||
ASSERT(span->sizeclass == 0);
|
||||
Event(span, 'T', n);
|
||||
|
||||
const int extra = span->length - n;
|
||||
Span* leftover = NewSpan(span->start + n, extra);
|
||||
ASSERT(leftover->location == Span::IN_USE);
|
||||
Event(leftover, 'U', extra);
|
||||
RecordSpan(leftover);
|
||||
pagemap_.set(span->start + n - 1, span); // Update map from pageid to span
|
||||
span->length = n;
|
||||
@ -262,14 +260,12 @@ Span* PageHeap::Carve(Span* span, Length n) {
|
||||
const int old_location = span->location;
|
||||
RemoveFromFreeList(span);
|
||||
span->location = Span::IN_USE;
|
||||
Event(span, 'A', n);
|
||||
|
||||
const int extra = span->length - n;
|
||||
ASSERT(extra >= 0);
|
||||
if (extra > 0) {
|
||||
Span* leftover = NewSpan(span->start + n, extra);
|
||||
leftover->location = old_location;
|
||||
Event(leftover, 'S', extra);
|
||||
RecordSpan(leftover);
|
||||
|
||||
// The previous span of |leftover| was just splitted -- no need to
|
||||
@ -309,7 +305,6 @@ void PageHeap::Delete(Span* span) {
|
||||
span->sizeclass = 0;
|
||||
span->sample = 0;
|
||||
span->location = Span::ON_NORMAL_FREELIST;
|
||||
Event(span, 'D', span->length);
|
||||
MergeIntoFreeList(span); // Coalesces if possible
|
||||
IncrementalScavenge(n);
|
||||
ASSERT(stats_.unmapped_bytes+ stats_.committed_bytes==stats_.system_bytes);
|
||||
@ -379,7 +374,6 @@ void PageHeap::MergeIntoFreeList(Span* span) {
|
||||
span->start -= len;
|
||||
span->length += len;
|
||||
pagemap_.set(span->start, span);
|
||||
Event(span, 'L', len);
|
||||
}
|
||||
Span* next = CheckAndHandlePreMerge(span, GetDescriptor(p+n));
|
||||
if (next != NULL) {
|
||||
@ -389,7 +383,6 @@ void PageHeap::MergeIntoFreeList(Span* span) {
|
||||
DeleteSpan(next);
|
||||
span->length += len;
|
||||
pagemap_.set(span->start + span->length - 1, span);
|
||||
Event(span, 'R', len);
|
||||
}
|
||||
|
||||
PrependToFreeList(span);
|
||||
@ -554,7 +547,6 @@ void PageHeap::RegisterSizeClass(Span* span, uint32 sc) {
|
||||
ASSERT(span->location == Span::IN_USE);
|
||||
ASSERT(GetDescriptor(span->start) == span);
|
||||
ASSERT(GetDescriptor(span->start+span->length-1) == span);
|
||||
Event(span, 'C', sc);
|
||||
span->sizeclass = sc;
|
||||
for (Length i = 1; i < span->length-1; i++) {
|
||||
pagemap_.set(span->start+i, span);
|
||||
|
12
src/span.cc
12
src/span.cc
@ -42,23 +42,11 @@
|
||||
|
||||
namespace tcmalloc {
|
||||
|
||||
#ifdef SPAN_HISTORY
|
||||
void Event(Span* span, char op, int v = 0) {
|
||||
span->history[span->nexthistory] = op;
|
||||
span->value[span->nexthistory] = v;
|
||||
span->nexthistory++;
|
||||
if (span->nexthistory == sizeof(span->history)) span->nexthistory = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Span* NewSpan(PageID p, Length len) {
|
||||
Span* result = Static::span_allocator()->New();
|
||||
memset(result, 0, sizeof(*result));
|
||||
result->start = p;
|
||||
result->length = len;
|
||||
#ifdef SPAN_HISTORY
|
||||
result->nexthistory = 0;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
14
src/span.h
14
src/span.h
@ -93,24 +93,10 @@ struct Span {
|
||||
// Copies out and destroys iterator stored in span_iter_space.
|
||||
SpanSet::iterator ExtractSpanSetIterator();
|
||||
|
||||
#undef SPAN_HISTORY
|
||||
#ifdef SPAN_HISTORY
|
||||
// For debugging, we can keep a log events per span
|
||||
int nexthistory;
|
||||
char history[64];
|
||||
int value[64];
|
||||
#endif
|
||||
|
||||
// What freelist the span is on: IN_USE if on none, or normal or returned
|
||||
enum { IN_USE, ON_NORMAL_FREELIST, ON_RETURNED_FREELIST };
|
||||
};
|
||||
|
||||
#ifdef SPAN_HISTORY
|
||||
void Event(Span* span, char op, int v = 0);
|
||||
#else
|
||||
#define Event(s,o,v) ((void) 0)
|
||||
#endif
|
||||
|
||||
inline SpanPtrWithLength::SpanPtrWithLength(Span* s)
|
||||
: span(s),
|
||||
length(s->length) {
|
||||
|
Loading…
Reference in New Issue
Block a user