Add flag to limit timer interrupts to 125 Hz on DC

Chrome frequently raises the system's global timer-interrupt frequency in order
to increase responsiveness for timers. Windows handles timers by checking
whether the timer has finished on a given interval; this is called the 'timer-
interrupt frequency'. Increasing the timer-interrupt frequency is done by many
programs to increase the granularity at which timers can be set, so waiting
processes can be notified more accurately (which in some cases will mean more
quickly) when their timers have finished.

However, raising the timer-interrupt frequency makes the system consume
additional power, so should be done sparingly. Chrome currently sets the
following limits for interrupt frequency depending on whether the system is on
battery power:

Default, not raised:        64 Hz
Raised, AC (wall power):    1000 Hz, i.e. MinTimerIntervalHighResMs = 1
Raised, DC (battery power): 250 Hz, i.e. MinTimerIntervalLowResMs = 4

This feature halves the raised frequency of interrupts when on DC power:

Raised, DC (battery power): 125 Hz, i.e. MinTimerIntervalLowResMs = 8

Decreasing the frequency to this level was reported to result in a ~4% system
power savings and minimal negative impact (per crbug.com/927165). This flag will
be enabled via a Finch experiment.

Bug: 927165
Change-Id: I8fe1f0b8dfa1b5095eafe60473706495d22191d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1965014
Commit-Queue: Jesse McKenna <[email protected]>
Reviewed-by: François Doray <[email protected]>
Cr-Commit-Position: refs/heads/master@{#724920}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index c74cef8..52da3d2 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -26,6 +26,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
+#include "base/time/time_win_features.h"
 #include "base/values.h"
 #include "build/branding_buildflags.h"
 #include "build/build_config.h"
@@ -4837,6 +4838,13 @@
      flag_descriptions::kRawClipboardDescription, kOsMac | kOsWin | kOsLinux,
      FEATURE_VALUE_TYPE(blink::features::kRawClipboard)},
 
+#if defined(OS_WIN)
+    {"slow-dc-timer-interrupts-win",
+     flag_descriptions::kSlowDCTimerInterruptsWinName,
+     flag_descriptions::kSlowDCTimerInterruptsWinDescription, kOsWin,
+     FEATURE_VALUE_TYPE(base::kSlowDCTimerInterruptsWin)},
+#endif  // OS_WIN
+
     // NOTE: Adding a new flag requires adding a corresponding entry to enum
     // "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag
     // Histograms" in tools/metrics/histograms/README.md (run the