blob: f0f88979941cde287dc67ead46f1f93ff82568c4 [file] [log] [blame]
Daniel Chengd88244472022-05-16 09:08:471#!/usr/bin/env python3
Avi Drissmandfd880852022-09-15 20:11:092# Copyright 2014 The Chromium Authors
tyoshino@chromium.org12eb4742014-04-17 06:54:453# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Scans the Chromium source of UseCounter, formats the Feature enum for
7histograms.xml and merges it. This script can also generate a python code
8snippet to put in uma.py of Chromium Dashboard. Make sure that you review the
9output for correctness.
10"""
11
Raul Tambre66e754d2019-09-25 12:03:4412from __future__ import print_function
13
tyoshino@chromium.org12eb4742014-04-17 06:54:4514import optparse
15import os
16import sys
17
tyoshino@chromium.org12eb4742014-04-17 06:54:4518from update_histogram_enum import ReadHistogramValues
19from update_histogram_enum import UpdateHistogramEnum
20
tyoshino@chromium.org12eb4742014-04-17 06:54:4521if __name__ == '__main__':
Johnny Stenbackf26c6562024-05-10 21:03:3222 web_feature_source = \
Johnny Stenback8b7faf3e12024-04-05 22:13:0423 'third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom'
mikelawther@chromium.orgef401ee2014-05-23 10:49:2924
Luna Luf41b4492017-07-04 23:19:5325 START_MARKER = '^enum WebFeature {'
timloh4b963a82017-04-18 08:42:0826 END_MARKER = '^kNumberOfFeatures'
tyoshino@chromium.org12eb4742014-04-17 06:54:4527
Nathan Memmott7b53b062025-01-28 01:28:0428 UpdateHistogramEnum('tools/metrics/histograms/metadata/blink/enums.xml',
Johnny Stenback8b7faf3e12024-04-05 22:13:0429 histogram_enum_name='FeatureObserver',
Johnny Stenbackf26c6562024-05-10 21:03:3230 source_enum_path=web_feature_source,
Johnny Stenback8b7faf3e12024-04-05 22:13:0431 start_marker=START_MARKER,
32 end_marker=END_MARKER,
33 strip_k_prefix=True,
34 calling_script=os.path.basename(__file__))
Johnny Stenbackf26c6562024-05-10 21:03:3235
36 webdx_feature_source = \
37 'third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom'
38 WEBDX_START_MARKER = '^enum WebDXFeature {'
39
Alexei Svitkine5d157202025-01-27 20:42:4840 UpdateHistogramEnum('tools/metrics/histograms/metadata/blink/enums.xml',
Johnny Stenbackf26c6562024-05-10 21:03:3241 histogram_enum_name='WebDXFeatureObserver',
42 source_enum_path=webdx_feature_source,
43 start_marker=WEBDX_START_MARKER,
44 end_marker=END_MARKER,
45 strip_k_prefix=True,
46 calling_script=os.path.basename(__file__))