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

Side by Side 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: autogenerate enum 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Updates GpuDriverBugWorkaroundEntry enum in histograms.xml file with values
7 read from gpu_driver_bug_list.json.
8
9 If the file was pretty-printed, the updated version is pretty-printed too.
10 """
11
12 import os.path
13 import re
14 import sys
15
16 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
17 import path_util
18 import json
19
20 import update_histogram_enum
21
Ilya Sherman 2017/05/04 22:48:37 nit: Please leave an extra blank line here.
22 GPU_DRIVER_BUG_WORKAROUND_PATH = 'gpu/config/gpu_driver_bug_list.json'
23
Ilya Sherman 2017/05/04 22:48:37 nit: Please leave an extra blank line here.
24 def ReadGpuDriverBugEntries(filename):
25 """Reads in the gpu driver bug list, returning a dictionary mapping
26 workaround ids to descriptions.
27 """
28 # Read the file as a list of lines
29 with open(path_util.GetInputFile(filename)) as f:
30 json_data = json.load(f)
31
32 entries = {}
33 for entry in json_data["entries"]:
34 entries[entry["id"]] = "%d: %s" % (entry["id"], entry["description"])
35 return entries
36
37
38 def main():
39 if len(sys.argv) > 1:
40 print >>sys.stderr, 'No arguments expected!'
41 sys.stderr.write(__doc__)
42 sys.exit(1)
43
44 update_histogram_enum.UpdateHistogramFromDict(
45 'GpuDriverBugWorkaroundEntry',
46 ReadGpuDriverBugEntries(GPU_DRIVER_BUG_WORKAROUND_PATH),
47 GPU_DRIVER_BUG_WORKAROUND_PATH)
48
Ilya Sherman 2017/05/04 22:48:36 nit: Please leave an extra blank line here.
49 if __name__ == '__main__':
50 main()
OLDNEW
« tools/metrics/histograms/enums.xml ('K') | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698