Commit 2d15ea88 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

historical experiment: record ccache stats and hits

parent 19a70510
...@@ -27,6 +27,8 @@ class HistoricalCompilation(Experiment, ClangHashHelper): ...@@ -27,6 +27,8 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
} }
outputs = { outputs = {
"stats": File("summary.dict"), "stats": File("summary.dict"),
"ccache_stats": File("ccache.stats"),
"clang_hash_stats": File("clang-hash.stats"),
} }
def build_parent(self, commit, from_scratch = False): def build_parent(self, commit, from_scratch = False):
...@@ -88,6 +90,9 @@ class HistoricalCompilation(Experiment, ClangHashHelper): ...@@ -88,6 +90,9 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
"commit-hash": self.metadata["project-hash"], "commit-hash": self.metadata["project-hash"],
'builds': []} 'builds': []}
if self.mode.value == "ccache-clang-hash":
os.environ["CLANG_HASH_LOGFILE"] = self.clang_hash_stats.path
with self.project as src_path: with self.project as src_path:
(commits, _) = shell("cd %s; git log --no-merges --oneline --topo-order --format='%%H %%P %%s'", src_path) (commits, _) = shell("cd %s; git log --no-merges --oneline --topo-order --format='%%H %%P %%s'", src_path)
# [0] is hash. [1] is parent, [2] rest # [0] is hash. [1] is parent, [2] rest
...@@ -145,6 +150,9 @@ class HistoricalCompilation(Experiment, ClangHashHelper): ...@@ -145,6 +150,9 @@ class HistoricalCompilation(Experiment, ClangHashHelper):
with open(self.stats.path, "w+") as fd: with open(self.stats.path, "w+") as fd:
fd.write(repr(self.build_info)) fd.write(repr(self.build_info))
if "ccache" in self.mode.value:
shell("ccache -s > %s", self.ccache_stats.path)
def variant_name(self): def variant_name(self):
return "%s-%s"%(self.project_name(), self.metadata['mode']) return "%s-%s"%(self.project_name(), self.metadata['mode'])
......
...@@ -30,6 +30,8 @@ class ClangHashHelper: ...@@ -30,6 +30,8 @@ class ClangHashHelper:
cache_dir = os.path.join(self.tmp_directory.path, "ccache") cache_dir = os.path.join(self.tmp_directory.path, "ccache")
os.mkdir(cache_dir) os.mkdir(cache_dir)
os.environ["CCACHE_DIR"] = cache_dir os.environ["CCACHE_DIR"] = cache_dir
os.environ["CCACHE_LOGFILE"] = "/tmp/lua.ccache.log"
if self.mode.value == "normal": if self.mode.value == "normal":
CC = os.path.join(clang_path, "build/wrappers/clang-normal") CC = os.path.join(clang_path, "build/wrappers/clang-normal")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment