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

Unified Diff: components/scheduler/renderer/coarse_duration_timer.h

Issue 1898233002: Report expected task queueing time via UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Super rough alternative approach. Created 4 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
Index: components/scheduler/renderer/coarse_duration_timer.h
diff --git a/components/scheduler/renderer/coarse_duration_timer.h b/components/scheduler/renderer/coarse_duration_timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..bdb44d8b1c4da3bd2b5825af2a9d065bb8b8aa2a
--- /dev/null
+++ b/components/scheduler/renderer/coarse_duration_timer.h
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_
+#define COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_
+
+#include "base/message_loop/message_loop.h"
+#include "base/optional.h"
+#include "base/time/time.h"
+
+namespace scheduler {
+
+// TODO - add locking things.
tdresser 2016/05/30 19:07:46 ^
+class CoarseDurationTimer : public base::MessageLoop::RecentTimeObserver {
+ public:
+ // RecentTimeObserver implementation:
+ void OnUpdateRecentTime(base::TimeTicks time) override;
+
+ void BeginInterval();
+ base::TimeDelta EndInterval();
+ base::TimeTicks most_recent_time() { return most_recent_time_; }
+
+ private:
+ enum class State {
+ OUTSIDE_INTERVAL,
+ WITHIN_INTERVAL_NEEDS_START,
+ WITHIN_INTERVAL
+ };
+
+ State state_;
+ base::TimeTicks start_time_;
+ base::TimeTicks most_recent_time_;
+};
+
+} // namespace scheduler
+
+#endif // COMPONENTS_SCHEDULER_RENDERER_COARSE_DURATION_TIMER_H_

Powered by Google App Engine
This is Rietveld 408576698