From b3b46a268903d2cb09430d29957bf13b0cb06e4c Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Fri, 6 Sep 2019 15:57:52 +0000 Subject: [PATCH] Have autoninja use -d stats when NINJA_SUMMARIZE_BUILD=1 The NINJA_SUMMARIZE_BUILD already triggers two types of build performance data - setting NINJA_STATUS to give more details during the build and running post_build_ninja_summary.py after the build. One of the most common causes of slow builds is when CreateProcess becomes slow, usually due to anti-virus overhead. Neither of these reports make this problem easily visible, but ninja -d stats does. In particular the StartEdge data is an excellent summary of CreateProcess timing. If the StartEdge average (avg) is more than about 6,000 us (6.0 ms) it might be worth investigating why. Therefore this change makes it so that autoninja.py adds -d stats to the command line when NINJA_SUMMARIZE_BUILD is set to 1. Change-Id: I1b6b990708c784a2cd71d153713b422f090775e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1788399 Reviewed-by: Dirk Pranke Commit-Queue: Bruce Dawson --- autoninja.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoninja.py b/autoninja.py index 52b506a0c..5aad538e3 100755 --- a/autoninja.py +++ b/autoninja.py @@ -141,4 +141,7 @@ for i in range(len(args)): if (i == 0 and sys.platform.startswith('win')) or ' ' in args[i]: args[i] = '"%s"' % args[i].replace('"', '\\"') +if os.environ.get('NINJA_SUMMARIZE_BUILD', '0') == '1': + args += ['-d', 'stats'] + print(' '.join(args))