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

Unified Diff: tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py

Issue 2841273002: Add UMA histograms for GPU driver bug workaround entries. (Closed)
Patch Set: update script, include 0 entry 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 | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py
diff --git a/tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py b/tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py
new file mode 100755
index 0000000000000000000000000000000000000000..1250dd7471c125da91dd800efcb2dff1d5eca91e
--- /dev/null
+++ b/tools/metrics/histograms/update_gpu_driver_bug_workaround_entries.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+"""Updates GpuDriverBugWorkaroundEntry enum in histograms.xml file with values
+ read from gpu_driver_bug_list.json.
+
+If the file was pretty-printed, the updated version is pretty-printed too.
+"""
+
+import os.path
+import re
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
+import path_util
+import json
+
+import update_histogram_enum
+
+
+GPU_DRIVER_BUG_WORKAROUND_PATH = 'gpu/config/gpu_driver_bug_list.json'
+
+
+def ReadGpuDriverBugEntries(filename):
+ """Reads in the gpu driver bug list, returning a dictionary mapping
+ workaround ids to descriptions.
+ """
+ # Read the file as a list of lines
+ with open(path_util.GetInputFile(filename)) as f:
+ json_data = json.load(f)
+
+ entries = {}
+ entries[0] = '0: Recorded once every time this histogram is updated.'
+ for entry in json_data["entries"]:
+ entries[entry["id"]] = "%d: %s" % (entry["id"], entry["description"])
+ return entries
+
+
+def main():
+ if len(sys.argv) > 1:
+ print >>sys.stderr, 'No arguments expected!'
+ sys.stderr.write(__doc__)
+ sys.exit(1)
+
+ update_histogram_enum.UpdateHistogramFromDict(
+ 'GpuDriverBugWorkaroundEntry',
+ ReadGpuDriverBugEntries(GPU_DRIVER_BUG_WORKAROUND_PATH),
+ GPU_DRIVER_BUG_WORKAROUND_PATH)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698