2 # -*- tab-width: 4; indent-tabs-mode: t -*-
4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # Generate a list of files included by the C++ compiler during the build
12 # sorted by the total bytes an included file contributed to preprocessor input.
13 # usage: first do a full build with "make check", then run this from $BUILDDIR
15 # NOTE: by default gbuild does not generate dependencies for system headers
16 # (in particular the C++ standard library), so those will NOT be counted
19 cmd =
"find workdir/Dep/CxxObject/ -name *.d | xargs cat"
20 while ((cmd
| getline) > 0) {
26 # GCC emits 2 per line if short enough!
35 for (inc in includes
) {
37 if ((cmd
| getline) < 0)
38 print "ERROR on: " cmd
39 sizes
[inc
] = $
1 # $0 is wc -c output, $1 is size
40 totals
[inc
] = $
1 * includes
[inc
]
41 totalsize
+= totals
[inc
]
44 PROCINFO
["sorted_in"] =
"@val_num_desc"
45 print "sum total bytes included (excluding system headers): " totalsize
47 print totals
[inc
], sizes
[inc
], includes
[inc
], inc
51 # vim: set noet sw=4 ts=4: