Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4b55492

Browse files
authored
Remove unused Counter and CounterValues class. (#31130)
1 parent e17ee4a commit 4b55492

4 files changed

Lines changed: 0 additions & 130 deletions

File tree

flow/compositor_context.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ CompositorContext::~CompositorContext() = default;
5555
void CompositorContext::BeginFrame(ScopedFrame& frame,
5656
bool enable_instrumentation) {
5757
if (enable_instrumentation) {
58-
frame_count_.Increment();
5958
raster_time_.Start();
6059
}
6160
}

flow/compositor_context.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,13 @@ class CompositorContext {
161161

162162
TextureRegistry& texture_registry() { return texture_registry_; }
163163

164-
const Counter& frame_count() const { return frame_count_; }
165-
166164
const Stopwatch& raster_time() const { return raster_time_; }
167165

168166
Stopwatch& ui_time() { return ui_time_; }
169167

170168
private:
171169
RasterCache raster_cache_;
172170
TextureRegistry texture_registry_;
173-
Counter frame_count_;
174171
Stopwatch raster_time_;
175172
Stopwatch ui_time_;
176173

flow/instrumentation.cc

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "flutter/flow/instrumentation.h"
66

77
#include <algorithm>
8-
#include <limits>
98

109
#include "third_party/skia/include/core/SkPath.h"
1110
#include "third_party/skia/include/core/SkSurface.h"
@@ -241,94 +240,6 @@ fml::Milliseconds Stopwatch::GetFrameBudget() const {
241240
return refresh_rate_updater_.GetFrameBudget();
242241
}
243242

244-
CounterValues::CounterValues() : current_sample_(kMaxSamples - 1) {
245-
values_.resize(kMaxSamples, 0);
246-
}
247-
248-
CounterValues::~CounterValues() = default;
249-
250-
void CounterValues::Add(int64_t value) {
251-
current_sample_ = (current_sample_ + 1) % kMaxSamples;
252-
values_[current_sample_] = value;
253-
}
254-
255-
void CounterValues::Visualize(SkCanvas* canvas, const SkRect& rect) const {
256-
size_t max_bytes = GetMaxValue();
257-
258-
if (max_bytes == 0) {
259-
// The backend for this counter probably did not fill in any values.
260-
return;
261-
}
262-
263-
size_t min_bytes = GetMinValue();
264-
265-
SkPaint paint;
266-
267-
// Paint the background.
268-
paint.setColor(0x99FFFFFF);
269-
canvas->drawRect(rect, paint);
270-
271-
// Establish the graph position.
272-
const SkScalar x = rect.x();
273-
const SkScalar y = rect.y();
274-
const SkScalar width = rect.width();
275-
const SkScalar height = rect.height();
276-
const SkScalar bottom = y + height;
277-
const SkScalar right = x + width;
278-
279-
// Prepare a path for the data.
280-
SkPath path;
281-
path.moveTo(x, bottom);
282-
283-
for (size_t i = 0; i < kMaxSamples; ++i) {
284-
int64_t current_bytes = values_[i];
285-
double ratio = static_cast<double>(current_bytes - min_bytes) /
286-
static_cast<double>(max_bytes - min_bytes);
287-
path.lineTo(
288-
x + ((static_cast<double>(i) / static_cast<double>(kMaxSamples)) *
289-
width),
290-
y + ((1.0 - ratio) * height));
291-
}
292-
293-
path.rLineTo(100, 0);
294-
path.lineTo(right, bottom);
295-
path.close();
296-
297-
// Draw the graph.
298-
paint.setColor(0xAA0000FF);
299-
canvas->drawPath(path, paint);
300-
301-
// Paint the vertical marker for the current frame.
302-
const double sample_unit_width = (1.0 / kMaxSamples);
303-
const double sample_margin_unit_width = sample_unit_width / 6.0;
304-
const double sample_margin_width = width * sample_margin_unit_width;
305-
paint.setStyle(SkPaint::Style::kFill_Style);
306-
paint.setColor(SK_ColorGRAY);
307-
double sample_x =
308-
x + width * (static_cast<double>(current_sample_) / kMaxSamples) -
309-
sample_margin_width;
310-
const auto marker_rect = SkRect::MakeLTRB(
311-
sample_x, y,
312-
sample_x + width * sample_unit_width + sample_margin_width * 2, bottom);
313-
canvas->drawRect(marker_rect, paint);
314-
}
315-
316-
int64_t CounterValues::GetMaxValue() const {
317-
auto max = std::numeric_limits<int64_t>::min();
318-
for (size_t i = 0; i < kMaxSamples; ++i) {
319-
max = std::max<int64_t>(max, values_[i]);
320-
}
321-
return max;
322-
}
323-
324-
int64_t CounterValues::GetMinValue() const {
325-
auto min = std::numeric_limits<int64_t>::max();
326-
for (size_t i = 0; i < kMaxSamples; ++i) {
327-
min = std::min<int64_t>(min, values_[i]);
328-
}
329-
return min;
330-
}
331-
332243
fml::Milliseconds FixedRefreshRateUpdater::GetFrameBudget() const {
333244
return fixed_frame_budget_;
334245
}

flow/instrumentation.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -89,43 +89,6 @@ class FixedRefreshRateStopwatch : public Stopwatch {
8989
FixedRefreshRateUpdater fixed_delegate_;
9090
};
9191

92-
class Counter {
93-
public:
94-
Counter() : count_(0) {}
95-
96-
size_t count() const { return count_; }
97-
98-
void Reset(size_t count = 0) { count_ = count; }
99-
100-
void Increment(size_t count = 1) { count_ += count; }
101-
102-
private:
103-
size_t count_;
104-
105-
FML_DISALLOW_COPY_AND_ASSIGN(Counter);
106-
};
107-
108-
class CounterValues {
109-
public:
110-
CounterValues();
111-
112-
~CounterValues();
113-
114-
void Add(int64_t value);
115-
116-
void Visualize(SkCanvas* canvas, const SkRect& rect) const;
117-
118-
int64_t GetMaxValue() const;
119-
120-
int64_t GetMinValue() const;
121-
122-
private:
123-
std::vector<int64_t> values_;
124-
size_t current_sample_;
125-
126-
FML_DISALLOW_COPY_AND_ASSIGN(CounterValues);
127-
};
128-
12992
} // namespace flutter
13093

13194
#endif // FLUTTER_FLOW_INSTRUMENTATION_H_

0 commit comments

Comments
 (0)