Skip to content

Commit a41c8ce

Browse files
andreas-abelcopybara-github
authored andcommitted
Remove unused fields from SizeState
PiperOrigin-RevId: 783308222 Change-Id: I15490d705b2364201db0032c273632a8a5d7222d
1 parent d7799c0 commit a41c8ce

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

fleetbench/tcmalloc/empirical.cc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ EmpiricalData::EmpiricalData(size_t seed, const absl::Span<const Entry> weights,
112112
total_birth_rate_ += w.alloc_rate;
113113
const double lifespan = avg_count / w.alloc_rate;
114114
const double death_rate = 1 / lifespan;
115-
state_.push_back({w.size, w.alloc_rate, death_rate, 0, {}});
115+
state_.push_back({w.size, death_rate, {}});
116116
state_.back().objs.reserve(avg_count * 2);
117117
}
118118

@@ -131,11 +131,6 @@ EmpiricalData::EmpiricalData(size_t seed, const absl::Span<const Entry> weights,
131131
}
132132

133133
SnapshotLiveObjects();
134-
135-
for (auto& s : state_) {
136-
// Don't count initial sample towards allocations (skews data).
137-
s.total = 0;
138-
}
139134
}
140135

141136
EmpiricalData::~EmpiricalData() {
@@ -156,7 +151,6 @@ void* EmpiricalData::DoBirth(const size_t i) {
156151
total_bytes_allocated_ += size;
157152
void* p = alloc_(size);
158153
s.objs.push_back(p);
159-
s.total++;
160154
return p;
161155
}
162156

@@ -182,7 +176,6 @@ void EmpiricalData::RecordBirth(const size_t i) {
182176
// when building the trace we can just push nullptr to keep the length of live
183177
// object lists consistent with what it should have been after a true birth.
184178
s.objs.push_back(nullptr);
185-
s.total++;
186179
}
187180

188181
void* EmpiricalData::ReplayBirth(const size_t i) {
@@ -192,7 +185,6 @@ void* EmpiricalData::ReplayBirth(const size_t i) {
192185
total_bytes_allocated_ += size;
193186
void* p = alloc_(size);
194187
s.objs.push_back(p);
195-
s.total++;
196188
return p;
197189
}
198190

@@ -250,8 +242,7 @@ void EmpiricalData::ReplayNext() {
250242

251243
void EmpiricalData::SnapshotLiveObjects() {
252244
for (const auto& s : state_) {
253-
snapshot_state_.push_back(
254-
{s.size, s.birth_rate, s.death_rate, s.total, s.objs});
245+
snapshot_state_.push_back({s.size, s.death_rate, s.objs});
255246
}
256247
}
257248

fleetbench/tcmalloc/empirical.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ class EmpiricalData {
244244

245245
struct SizeState {
246246
const size_t size;
247-
const double birth_rate;
248247
const double death_rate;
249-
size_t total;
250248
std::vector<void*> objs;
251249
};
252250

0 commit comments

Comments
 (0)