зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1782344 - Remove cache directory and configs from CCacheStats. r=firefox-build-system-reviewers,ahochheiden
The info is unused and not part of the ccache --print-stats output that we're going to use shortly. Differential Revision: https://phabricator.services.mozilla.com/D166631
This commit is contained in:
Родитель
708b0943a7
Коммит
2cef595382
|
@ -877,9 +877,11 @@ class CCacheStats(object):
|
|||
("cache_max_size", "max cache size"),
|
||||
]
|
||||
|
||||
DIRECTORY_DESCRIPTION = "cache directory"
|
||||
PRIMARY_CONFIG_DESCRIPTION = "primary config"
|
||||
SECONDARY_CONFIG_DESCRIPTION = "secondary config"
|
||||
SKIP_LINES = (
|
||||
"cache directory",
|
||||
"primary config",
|
||||
"secondary config",
|
||||
)
|
||||
|
||||
STATS_KEYS_4_4 = [
|
||||
("stats_updated", "Summary/Stats updated"),
|
||||
|
@ -938,6 +940,9 @@ class CCacheStats(object):
|
|||
]
|
||||
|
||||
SKIP_KEYS_4_4 = [
|
||||
"Summary/Cache directory",
|
||||
"Summary/Primary config",
|
||||
"Summary/Secondary config",
|
||||
"Summary/Uncacheable",
|
||||
"Summary/Misses/Direct",
|
||||
"Summary/Misses/Preprocessed",
|
||||
|
@ -946,10 +951,6 @@ class CCacheStats(object):
|
|||
"Errors/Could not find compiler",
|
||||
]
|
||||
|
||||
DIRECTORY_DESCRIPTION_4_4 = "Summary/Cache directory"
|
||||
PRIMARY_CONFIG_DESCRIPTION_4_4 = "Summary/Primary config"
|
||||
SECONDARY_CONFIG_DESCRIPTION_4_4 = "Summary/Secondary config"
|
||||
|
||||
ABSOLUTE_KEYS = {"cache_files", "cache_size", "cache_max_size"}
|
||||
FORMAT_KEYS = {"cache_size", "cache_max_size"}
|
||||
|
||||
|
@ -960,9 +961,6 @@ class CCacheStats(object):
|
|||
def __init__(self, output=None, is_version_4_4_or_newer=False):
|
||||
"""Construct an instance from the output of ccache -s."""
|
||||
self._values = {}
|
||||
self.cache_dir = ""
|
||||
self.primary_config = ""
|
||||
self.secondary_config = ""
|
||||
|
||||
if not output:
|
||||
return
|
||||
|
@ -996,13 +994,6 @@ class CCacheStats(object):
|
|||
subhead = ""
|
||||
|
||||
def _parse_line_4_4_plus(self, key, value):
|
||||
if key.startswith(self.DIRECTORY_DESCRIPTION_4_4):
|
||||
self.cache_dir = value
|
||||
elif key.startswith(self.PRIMARY_CONFIG_DESCRIPTION_4_4):
|
||||
self.primary_config = value
|
||||
elif key.startswith(self.SECONDARY_CONFIG_DESCRIPTION_4_4):
|
||||
self.secondary_config = value
|
||||
else:
|
||||
for seq in self.STATS_KEYS_4_4:
|
||||
stat_key = seq[0]
|
||||
stat_description = seq[1]
|
||||
|
@ -1019,9 +1010,7 @@ class CCacheStats(object):
|
|||
else:
|
||||
if key not in self.SKIP_KEYS_4_4:
|
||||
raise ValueError(
|
||||
"Failed to parse ccache stats output: '{}' '{}'".format(
|
||||
key, value
|
||||
)
|
||||
"Failed to parse ccache stats output: '{}' '{}'".format(key, value)
|
||||
)
|
||||
|
||||
def _parse_human_format(self, output):
|
||||
|
@ -1032,24 +1021,13 @@ class CCacheStats(object):
|
|||
|
||||
def _parse_line(self, line):
|
||||
line = six.ensure_text(line)
|
||||
if line.startswith(self.DIRECTORY_DESCRIPTION):
|
||||
self.cache_dir = self._strip_prefix(line, self.DIRECTORY_DESCRIPTION)
|
||||
elif line.startswith(self.PRIMARY_CONFIG_DESCRIPTION):
|
||||
self.primary_config = self._strip_prefix(
|
||||
line, self.PRIMARY_CONFIG_DESCRIPTION
|
||||
)
|
||||
elif line.startswith(self.SECONDARY_CONFIG_DESCRIPTION):
|
||||
self.secondary_config = self._strip_prefix(
|
||||
self._strip_prefix(line, self.SECONDARY_CONFIG_DESCRIPTION),
|
||||
"(readonly)",
|
||||
)
|
||||
else:
|
||||
for stat_key, stat_description in self.STATS_KEYS:
|
||||
if line.startswith(stat_description):
|
||||
raw_value = self._strip_prefix(line, stat_description)
|
||||
self._values[stat_key] = self._parse_value(raw_value)
|
||||
break
|
||||
else:
|
||||
if not line.startswith(self.SKIP_LINES):
|
||||
raise ValueError("Failed to parse ccache stats output: %s" % line)
|
||||
|
||||
@staticmethod
|
||||
|
@ -1113,7 +1091,6 @@ class CCacheStats(object):
|
|||
|
||||
def __sub__(self, other):
|
||||
result = CCacheStats()
|
||||
result.cache_dir = self.cache_dir
|
||||
|
||||
for k, prefix in self.STATS_KEYS:
|
||||
if k not in self._values and k not in other._values:
|
||||
|
@ -1133,11 +1110,6 @@ class CCacheStats(object):
|
|||
LEFT_ALIGN = 34
|
||||
lines = []
|
||||
|
||||
if self.cache_dir:
|
||||
lines.append(
|
||||
"%s%s" % (self.DIRECTORY_DESCRIPTION.ljust(LEFT_ALIGN), self.cache_dir)
|
||||
)
|
||||
|
||||
for stat_key, stat_description in self.STATS_KEYS:
|
||||
if stat_key not in self._values:
|
||||
continue
|
||||
|
|
|
@ -405,7 +405,6 @@ Uncacheable:
|
|||
|
||||
def test_parse_zero_stats_message(self):
|
||||
stats = CCacheStats(self.STAT0)
|
||||
self.assertEqual(stats.cache_dir, "/home/tlin/.ccache")
|
||||
self.assertEqual(stats.hit_rates(), (0, 0, 0))
|
||||
|
||||
def test_hit_rate_of_diff_stats(self):
|
||||
|
@ -435,7 +434,6 @@ Uncacheable:
|
|||
stats_diff = stat3 - stat2
|
||||
self.assertEqual(
|
||||
str(stat3),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 12004\n"
|
||||
"cache hit (preprocessed) 1786\n"
|
||||
"cache miss 26348\n"
|
||||
|
@ -454,7 +452,6 @@ Uncacheable:
|
|||
)
|
||||
self.assertEqual(
|
||||
str(stats_diff),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 10104\n"
|
||||
"cache hit (preprocessed) 1486\n"
|
||||
"cache miss 23748\n"
|
||||
|
@ -478,7 +475,6 @@ Uncacheable:
|
|||
stats_diff = stat5 - stat4
|
||||
self.assertEqual(
|
||||
str(stat4),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 21039\n"
|
||||
"cache hit (preprocessed) 2315\n"
|
||||
"cache miss 39370\n"
|
||||
|
@ -498,7 +494,6 @@ Uncacheable:
|
|||
)
|
||||
self.assertEqual(
|
||||
str(stat5),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 21039\n"
|
||||
"cache hit (preprocessed) 2315\n"
|
||||
"cache miss 39372\n"
|
||||
|
@ -518,7 +513,6 @@ Uncacheable:
|
|||
)
|
||||
self.assertEqual(
|
||||
str(stats_diff),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 0\n"
|
||||
"cache hit (preprocessed) 0\n"
|
||||
"cache miss 2\n"
|
||||
|
@ -544,7 +538,6 @@ Uncacheable:
|
|||
stats_diff = stat6 - stat3
|
||||
self.assertEqual(
|
||||
str(stat6),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 319287\n"
|
||||
"cache hit (preprocessed) 125987\n"
|
||||
"cache hit rate 37\n"
|
||||
|
@ -570,7 +563,6 @@ Uncacheable:
|
|||
)
|
||||
self.assertEqual(
|
||||
str(stat3),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 12004\n"
|
||||
"cache hit (preprocessed) 1786\n"
|
||||
"cache miss 26348\n"
|
||||
|
@ -589,7 +581,6 @@ Uncacheable:
|
|||
)
|
||||
self.assertEqual(
|
||||
str(stats_diff),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 307283\n"
|
||||
"cache hit (preprocessed) 124201\n"
|
||||
"cache hit rate 37\n"
|
||||
|
@ -618,7 +609,6 @@ Uncacheable:
|
|||
stat7 = CCacheStats(self.STAT7)
|
||||
self.assertEqual(
|
||||
str(stat7),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
"cache hit (direct) 27035\n"
|
||||
"cache hit (preprocessed) 13939\n"
|
||||
"cache hit rate 39\n"
|
||||
|
@ -642,7 +632,6 @@ Uncacheable:
|
|||
stat8 = CCacheStats(self.STAT8)
|
||||
self.assertEqual(
|
||||
str(stat8),
|
||||
"cache directory /home/psimonyi/.ccache\n"
|
||||
f"stats zero time {int(TIMESTAMP)}\n"
|
||||
f"stats zeroed {int(TIMESTAMP)}\n"
|
||||
"cache hit (direct) 571\n"
|
||||
|
@ -667,7 +656,6 @@ Uncacheable:
|
|||
stat9 = CCacheStats(self.STAT9)
|
||||
self.assertEqual(
|
||||
str(stat9),
|
||||
"cache directory /Users/tlin/.ccache\n"
|
||||
f"stats zero time {int(TIMESTAMP)}\n"
|
||||
f"stats zeroed {int(TIMESTAMP)}\n"
|
||||
f"stats updated {int(TIMESTAMP2)}\n"
|
||||
|
@ -702,7 +690,6 @@ Uncacheable:
|
|||
stat10 = CCacheStats(self.STAT10, True)
|
||||
self.assertEqual(
|
||||
str(stat10),
|
||||
"cache directory /home/suer/.ccache\n"
|
||||
f"stats updated {int(TIMESTAMP)}\n"
|
||||
"cache hit (direct) 197\n"
|
||||
"cache hit (preprocessed) 719\n"
|
||||
|
@ -726,7 +713,6 @@ Uncacheable:
|
|||
stat11 = CCacheStats(self.STAT11, True)
|
||||
self.assertEqual(
|
||||
str(stat11),
|
||||
"cache directory /home/suer/.ccache\n"
|
||||
f"stats updated {int(TIMESTAMP)}\n"
|
||||
"cache hit (direct) 0\n"
|
||||
"cache hit (preprocessed) 0\n"
|
||||
|
@ -741,7 +727,6 @@ Uncacheable:
|
|||
stat12 = CCacheStats(self.STAT12, True)
|
||||
self.assertEqual(
|
||||
str(stat12),
|
||||
"cache directory /home/suer/.ccache\n"
|
||||
"stats updated 0\n"
|
||||
"cache hit (direct) 0\n"
|
||||
"cache hit (preprocessed) 0\n"
|
||||
|
@ -756,7 +741,6 @@ Uncacheable:
|
|||
stat13 = CCacheStats(self.STAT13, True)
|
||||
self.assertEqual(
|
||||
str(stat13),
|
||||
"cache directory /Users/leebc/.ccache\n"
|
||||
f"stats updated {int(TIMESTAMP)}\n"
|
||||
"cache hit (direct) 280542\n"
|
||||
"cache hit (preprocessed) 0\n"
|
||||
|
|
Загрузка…
Ссылка в новой задаче