Bug 1263839: P2. Force re-run of VP9 benchmark based on a version check. r=kentuckyfriedtakahe
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 13 Apr 2016 12:44:29 +1000
changeset 331029 bca6a0b5816fc86522c0cd0c2e81d168847a094e
parent 331028 1cbabad59a633c1b555b1c6574e11bd12404c022
child 331030 bb3412f7937d17ed0d9176aa81ffbfb4bc204b62
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs1263839
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1263839: P2. Force re-run of VP9 benchmark based on a version check. r=kentuckyfriedtakahe The version number is to be manually updated when we want to re-run the test (like improvement in ffvp9 or libvpx) MozReview-Commit-ID: 9KzYCGWvIpp
dom/ipc/ContentParent.cpp
dom/media/Benchmark.cpp
dom/media/Benchmark.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5712,16 +5712,18 @@ ContentParent::RecvGetAndroidSystemInfo(
 
 bool
 ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName,
                                          const uint32_t& aDecodeFPS)
 
 {
   if (aCodecName.EqualsLiteral("VP9")) {
     Preferences::SetUint(VP9Benchmark::sBenchmarkFpsPref, aDecodeFPS);
+    Preferences::SetUint(VP9Benchmark::sBenchmarkFpsVersionCheck,
+                         VP9Benchmark::sBenchmarkVersionID);
   }
   return true;
 }
 
 void
 ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
 {
 #ifdef MOZ_ENABLE_PROFILER_SPS
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -11,27 +11,33 @@
 #include "WebMDemuxer.h"
 #include "WebMSample.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/ContentChild.h"
 
 namespace mozilla {
 
+// Update this version number to force re-running the benchmark. Such as when
+// an improvement to FFVP9 or LIBVPX is deemed worthwhile.
+const uint32_t VP9Benchmark::sBenchmarkVersionID = 1;
+
 const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
+const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck";
 bool VP9Benchmark::sHasRunTest = false;
 
 bool
 VP9Benchmark::IsVP9DecodeFast()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   bool hasPref = Preferences::HasUserValue(sBenchmarkFpsPref);
+  uint32_t hadRecentUpdate = Preferences::GetUint(sBenchmarkFpsVersionCheck, 0U);
 
-  if (!sHasRunTest && !hasPref) {
+  if (!sHasRunTest && (!hasPref || hadRecentUpdate != sBenchmarkVersionID)) {
     sHasRunTest = true;
 
     RefPtr<WebMDemuxer> demuxer =
       new WebMDemuxer(new BufferMediaResource(sWebMSample, sizeof(sWebMSample), nullptr,
                                               NS_LITERAL_CSTRING("video/webm")));
     PDMFactory::Init();
 
     RefPtr<Benchmark> estimiser =
@@ -49,16 +55,17 @@ VP9Benchmark::IsVP9DecodeFast()
         if (XRE_IsContentProcess()) {
           dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
           if (contentChild) {
             contentChild->SendNotifyBenchmarkResult(NS_LITERAL_STRING("VP9"),
                                                     aDecodeFps);
           }
         } else {
           Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+          Preferences::SetUint(sBenchmarkFpsVersionCheck, sBenchmarkVersionID);
         }
         Telemetry::Accumulate(Telemetry::ID::VIDEO_VP9_BENCHMARK_FPS, aDecodeFps);
       },
       []() { });
   }
 
   if (!hasPref) {
     return false;
--- a/dom/media/Benchmark.h
+++ b/dom/media/Benchmark.h
@@ -99,13 +99,15 @@ private:
   MozPromiseHolder<BenchmarkPromise> mPromise;
 };
 
 class VP9Benchmark
 {
 public:
   static bool IsVP9DecodeFast();
   static const char* sBenchmarkFpsPref;
+  static const char* sBenchmarkFpsVersionCheck;
+  static const uint32_t sBenchmarkVersionID;
   static bool sHasRunTest;
 };
 }
 
 #endif