-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathccache-stats.patch
More file actions
66 lines (58 loc) · 2.86 KB
/
ccache-stats.patch
File metadata and controls
66 lines (58 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From e87d916d7f49ea4949973adf0f09e9e5bf891e03 Mon Sep 17 00:00:00 2001
From: "Brian J. Murrell" <brian@interlinx.bc.ca>
Date: Tue, 30 Jan 2024 11:03:12 -0500
Subject: [PATCH 1/2] Show ccache stats at the end of the build
Zero the ccache stats at the beginning of the build and then display the
ccache stats at the end of the build to see how effective ccache was.
Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
---
mock/py/mockbuild/plugins/ccache.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/mock/py/mockbuild/plugins/ccache.py b/mock/py/mockbuild/plugins/ccache.py
index 2666ad9fc..1080ffe68 100644
--- a/mock/py/mockbuild/plugins/ccache.py
+++ b/mock/py/mockbuild/plugins/ccache.py
@@ -35,6 +35,7 @@ def __init__(self, plugins, conf, buildroot):
buildroot.preexisting_deps.append("ccache")
plugins.add_hook("prebuild", self._ccacheBuildHook)
plugins.add_hook("preinit", self._ccachePreInitHook)
+ plugins.add_hook("postbuild", self._ccachePostBuildHook)
buildroot.mounts.add(
BindMountPoint(srcpath=self.ccachePath, bindpath=buildroot.make_chroot_path("/var/tmp/ccache")))
@@ -47,6 +48,9 @@ def __init__(self, plugins, conf, buildroot):
@traceLog()
def _ccacheBuildHook(self):
self.buildroot.doChroot(["ccache", "-M", str(self.ccache_opts['max_cache_size'])], shell=False)
+ # zero ccache stats
+ getLog().info("Zero ccache stats:")
+ self.buildroot.doChroot(["ccache", "--zero-stats"], printOutput=True, shell=False)
# set up the ccache dir.
# we also set a few variables used by ccache to find the shared cache.
@@ -61,3 +65,10 @@ def _ccachePreInitHook(self):
file_util.mkdirIfAbsent(self.buildroot.make_chroot_path('/var/tmp/ccache'))
file_util.mkdirIfAbsent(self.ccachePath)
self.buildroot.uid_manager.changeOwner(self.ccachePath, recursive=True)
+
+ # get some cache stats
+ def _ccachePostBuildHook(self):
+ # show the cache hit stats
+ getLog().info("ccache stats:")
+ self.buildroot.doChroot(["ccache", "--show-stats"], printOutput=True, shell=False)
++
From bfd3a7e1bb47d28ee60a94cb5985c1f66476475f Mon Sep 17 00:00:00 2001
From: "Brian J. Murrell" <brian@interlinx.bc.ca>
Date: Tue, 30 Jan 2024 11:17:48 -0500
Subject: [PATCH 2/2] Remove extraneous line
Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
---
mock/py/mockbuild/plugins/ccache.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/mock/py/mockbuild/plugins/ccache.py b/mock/py/mockbuild/plugins/ccache.py
index 1080ffe68..1a20846d3 100644
--- a/mock/py/mockbuild/plugins/ccache.py
+++ b/mock/py/mockbuild/plugins/ccache.py
@@ -71,4 +71,3 @@ def _ccachePostBuildHook(self):
# show the cache hit stats
getLog().info("ccache stats:")
self.buildroot.doChroot(["ccache", "--show-stats"], printOutput=True, shell=False)
-+