| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Scans the Chromium source of UseCounter, formats the Feature enum for | 6 """Scans the Chromium source of UseCounter, formats the Feature enum for |
| 7 histograms.xml and merges it. This script can also generate a python code | 7 histograms.xml and merges it. This script can also generate a python code |
| 8 snippet to put in uma.py of Chromium Dashboard. Make sure that you review the | 8 snippet to put in uma.py of Chromium Dashboard. Make sure that you review the |
| 9 output for correctness. | 9 output for correctness. |
| 10 """ | 10 """ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 if __name__ == '__main__': | 26 if __name__ == '__main__': |
| 27 parser = optparse.OptionParser() | 27 parser = optparse.OptionParser() |
| 28 parser.add_option('--for-dashboard', action='store_true', dest='dashboard', | 28 parser.add_option('--for-dashboard', action='store_true', dest='dashboard', |
| 29 default=False, | 29 default=False, |
| 30 help='Print enum definition formatted for use in uma.py of ' | 30 help='Print enum definition formatted for use in uma.py of ' |
| 31 'Chromium dashboard developed at ' | 31 'Chromium dashboard developed at ' |
| 32 'https://github.com/GoogleChrome/chromium-dashboard') | 32 'https://github.com/GoogleChrome/chromium-dashboard') |
| 33 options, args = parser.parse_args() | 33 options, args = parser.parse_args() |
| 34 | 34 |
| 35 source_path = 'third_party/WebKit/Source/core/frame/UseCounter.h' | 35 source_path = 'third_party/WebKit/public/platform/UseCounterFeature.def' |
| 36 | 36 |
| 37 START_MARKER = '^enum Feature : uint32_t {' | 37 START_MARKER = '^' |
| 38 END_MARKER = '^kNumberOfFeatures' | 38 END_MARKER = '^kNumberOfFeatures' |
| 39 | 39 |
| 40 if options.dashboard: | 40 if options.dashboard: |
| 41 enum_dict, ignored = ReadHistogramValues(source_path, START_MARKER, | 41 enum_dict, ignored = ReadHistogramValues(source_path, START_MARKER, |
| 42 END_MARKER, strip_k_prefix=True) | 42 END_MARKER, strip_k_prefix=True) |
| 43 PrintEnumForDashboard(enum_dict) | 43 PrintEnumForDashboard(enum_dict) |
| 44 else: | 44 else: |
| 45 UpdateHistogramEnum( | 45 UpdateHistogramEnum( |
| 46 histogram_enum_name='FeatureObserver', | 46 histogram_enum_name='FeatureObserver', |
| 47 source_enum_path=source_path, | 47 source_enum_path=source_path, |
| 48 start_marker=START_MARKER, | 48 start_marker=START_MARKER, |
| 49 end_marker=END_MARKER, | 49 end_marker=END_MARKER, |
| 50 strip_k_prefix=True) | 50 strip_k_prefix=True) |
| OLD | NEW |