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

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

Issue 2223063004: find_unmapped_histograms.py: filter filenames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@find_unmapped_histograms_remove_comments
Patch Set: Rebase Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/find_unmapped_histograms.py
diff --git a/tools/metrics/histograms/find_unmapped_histograms.py b/tools/metrics/histograms/find_unmapped_histograms.py
index e25f52aef0df01cf4ee14c494808ee3bef4fc6bf..95f5d9703c4d6cc85732ea45824fee60d7943957 100644
--- a/tools/metrics/histograms/find_unmapped_histograms.py
+++ b/tools/metrics/histograms/find_unmapped_histograms.py
@@ -24,6 +24,16 @@ import path_util
import extract_histograms
+C_FILENAME = re.compile(r"""
+ .* # Anything
+ \.(cc|cpp|h|mm) # Ending in these extensions
+ $ # End of string
+ """, re.VERBOSE)
+TEST_FILENAME = re.compile(r"""
+ .* # Anything
+ test # The word test
+ \. # A literal '.'
+ """, re.VERBOSE)
CPP_COMMENT = re.compile(r"""
\s* # Optional whitespace
(?: # Non-capturing group
@@ -185,7 +195,9 @@ def readChromiumHistograms():
# 'path/to/foo.cc:420: UMA_HISTOGRAM_COUNTS_100("FooGroup.FooName",'
# 'path/to/bar.cc:632: UMA_HISTOGRAM_ENUMERATION('
locations = RunGit(['gs', 'UMA_HISTOGRAM']).split('\n')
- filenames = set([location.split(':')[0] for location in locations])
+ all_filenames = set(location.split(':')[0] for location in locations);
+ filenames = [f for f in all_filenames
+ if C_FILENAME.match(f) and not TEST_FILENAME.match(f)]
histograms = set()
location_map = dict()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698