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

Unified Diff: chrome/browser/android/vr_shell/fps_meter.cc

Issue 2892813002: Fix off-by-one in fps_meter, fix unit test to catch this. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/android/vr_shell/fps_meter.h ('k') | chrome/browser/android/vr_shell/fps_meter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/fps_meter.cc
diff --git a/chrome/browser/android/vr_shell/fps_meter.cc b/chrome/browser/android/vr_shell/fps_meter.cc
index 09319b1815ce47fb228e3e519c49a340c3aadf92..9065fd4350373435e2b0225e07c81db5999719a1 100644
--- a/chrome/browser/android/vr_shell/fps_meter.cc
+++ b/chrome/browser/android/vr_shell/fps_meter.cc
@@ -10,7 +10,7 @@ namespace vr_shell {
namespace {
-static constexpr size_t kNumFrameTimes = 200;
+static constexpr size_t kNumFrameTimes = 10;
} // namepsace
@@ -20,6 +20,10 @@ FPSMeter::FPSMeter() : total_time_us_(0) {
FPSMeter::~FPSMeter() {}
+size_t FPSMeter::GetNumFrameTimes() {
+ return kNumFrameTimes;
+}
+
void FPSMeter::AddFrame(const base::TimeTicks& time_stamp) {
if (last_time_stamp_.is_null()) {
last_time_stamp_ = time_stamp;
@@ -31,7 +35,7 @@ void FPSMeter::AddFrame(const base::TimeTicks& time_stamp) {
total_time_us_ += delta.InMicroseconds();
- if (frame_times_.size() + 1 < kNumFrameTimes) {
+ if (frame_times_.size() < kNumFrameTimes) {
frame_times_.push_back(delta);
} else {
total_time_us_ -= frame_times_[current_index_].InMicroseconds();
« no previous file with comments | « chrome/browser/android/vr_shell/fps_meter.h ('k') | chrome/browser/android/vr_shell/fps_meter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698