Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3e71209

Browse files
wjtraceySkia Commit-Bot
authored andcommitted
[infra] Add ccache for mac default builds.
Also add pre and post build ccache stats reporting to provide insight for cache size, hit rate, etc. Bug: skia:9887 Change-Id: I3786fb661ef9f14bdc9fcc7cbcecd1f1a588479f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269370 Commit-Queue: Weston Tracey <westont@google.com> Reviewed-by: Eric Boren <borenet@google.com>
1 parent cdf2491 commit 3e71209

File tree

30 files changed

+1125
-14
lines changed

30 files changed

+1125
-14
lines changed

infra/bots/gen_tasks_logic/gen_tasks_logic.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,8 @@ func (b *builder) compile(name string, parts map[string]string) string {
12171217
Name: "xcode",
12181218
Path: "cache/Xcode.app",
12191219
})
1220+
task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("ccache_mac"))
1221+
b.usesCCache(task, name)
12201222
if strings.Contains(name, "CommandBuffer") {
12211223
timeout(task, 2*time.Hour)
12221224
}

infra/bots/recipe_modules/build/default.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def compile_fn(api, checkout_root, out_dir):
9696
win_toolchain = str(api.vars.slave_dir.join('win_toolchain'))
9797
moltenvk = str(api.vars.slave_dir.join('moltenvk'))
9898

99-
cc, cxx = None, None
99+
cc, cxx, ccache = None, None, None
100100
extra_cflags = []
101101
extra_ldflags = []
102102
args = {'werror': 'true'}
@@ -143,17 +143,26 @@ def compile_fn(api, checkout_root, out_dir):
143143
args['skia_generate_workarounds'] = 'true'
144144

145145
# ccache + clang-tidy.sh chokes on the argument list.
146-
if api.vars.is_linux and 'Tidy' not in extra_tokens:
147-
args['cc_wrapper'] = '"%s"' % api.vars.slave_dir.join('ccache_linux', 'bin', 'ccache')
146+
if (api.vars.is_linux or os == 'Mac') and 'Tidy' not in extra_tokens:
147+
if api.vars.is_linux:
148+
ccache = api.vars.slave_dir.join('ccache_linux', 'bin', 'ccache')
149+
# As of 2020-02-07, the sum of each Debian9-Clang-x86
150+
# non-flutter/android/chromebook build takes less than 75G cache space.
151+
env['CCACHE_MAXSIZE'] = '75G'
152+
else:
153+
ccache = api.vars.slave_dir.join('ccache_mac', 'bin', 'ccache')
154+
# As of 2020-02-10, the sum of each Build-Mac-Clang- non-android build
155+
# takes ~30G cache space.
156+
env['CCACHE_MAXSIZE'] = '50G'
157+
158+
args['cc_wrapper'] = '"%s"' % ccache
159+
148160
env['CCACHE_DIR'] = api.vars.cache_dir.join('ccache')
161+
env['CCACHE_MAXFILES'] = '0'
149162
# Compilers are unpacked from cipd with bogus timestamps, only contribute
150163
# compiler content to hashes. If Ninja ever uses absolute paths to changing
151164
# directories we'll also need to set a CCACHE_BASEDIR.
152165
env['CCACHE_COMPILERCHECK'] = 'content'
153-
# As of 2020-02-07, the sum of each Debian9-Clang-x86
154-
# non-flutter/android/chromebook build takes less than 75G cache space.
155-
env['CCACHE_MAXSIZE'] = '75G'
156-
env['CCACHE_MAXFILES'] = '0'
157166

158167
if compiler == 'Clang' and api.vars.is_linux:
159168
cc = clang_linux + '/bin/clang'
@@ -335,9 +344,13 @@ def compile_fn(api, checkout_root, out_dir):
335344
infra_step=True)
336345

337346
with api.env(env):
347+
if ccache:
348+
api.run(api.step, 'ccache stats-start', cmd=[ccache, '-s'])
338349
api.run(api.step, 'gn gen',
339350
cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
340351
api.run(api.step, 'ninja', cmd=['ninja', '-C', out_dir])
352+
if ccache:
353+
api.run(api.step, 'ccache stats-end', cmd=[ccache, '-s'])
341354

342355

343356
def copy_build_products(api, src, dst):

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-Coverage.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-MSAN.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-OpenCL.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-SK_CPU_LIMIT_SSE41.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-SafeStack.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-SkVM.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-SkVM_ASAN.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"infra_step": true,
3232
"name": "fetch-gn"
3333
},
34+
{
35+
"cmd": [
36+
"[START_DIR]/ccache_linux/bin/ccache",
37+
"-s"
38+
],
39+
"cwd": "[START_DIR]/cache/work/skia",
40+
"env": {
41+
"CCACHE_COMPILERCHECK": "content",
42+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
43+
"CCACHE_MAXFILES": "0",
44+
"CCACHE_MAXSIZE": "75G",
45+
"CHROME_HEADLESS": "1",
46+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
47+
},
48+
"name": "ccache stats-start"
49+
},
3450
{
3551
"cmd": [
3652
"[START_DIR]/cache/work/skia/bin/gn",
@@ -66,6 +82,22 @@
6682
},
6783
"name": "ninja"
6884
},
85+
{
86+
"cmd": [
87+
"[START_DIR]/ccache_linux/bin/ccache",
88+
"-s"
89+
],
90+
"cwd": "[START_DIR]/cache/work/skia",
91+
"env": {
92+
"CCACHE_COMPILERCHECK": "content",
93+
"CCACHE_DIR": "[START_DIR]/cache/ccache",
94+
"CCACHE_MAXFILES": "0",
95+
"CCACHE_MAXSIZE": "75G",
96+
"CHROME_HEADLESS": "1",
97+
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
98+
},
99+
"name": "ccache stats-end"
100+
},
69101
{
70102
"cmd": [
71103
"python",

0 commit comments

Comments
 (0)