From 2302a5ae5625c2ed3a5e7286940d32c7c176d1d2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 10 Jul 2015 21:47:57 +0200 Subject: add script bin/includebloat Change-Id: I086052c9a4dd2a216e0af153c43e98eec85a4600 --- bin/includebloat.awk | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bin/includebloat.awk (limited to 'bin') diff --git a/bin/includebloat.awk b/bin/includebloat.awk new file mode 100755 index 000000000000..5a1bdaaaf481 --- /dev/null +++ b/bin/includebloat.awk @@ -0,0 +1,34 @@ +#!/usr/bin/gawk -f + +BEGIN { + cmd = "find workdir/Dep/CxxObject/ -name *.d | xargs cat" + while ((cmd | getline) > 0) { + if ($0 ~ /^ .*\\$/) { + gsub(/^ /, ""); + gsub(/ *\\$/, ""); + includes[$1]++ + if ($2) { + # GCC emits 2 per line if short enough! + includes[$2]++ + } + } + } + exit +} + +END { + for (inc in includes) { + cmd = "wc -c " inc + if ((cmd | getline) < 0) + print "ERROR on: " cmd + sizes[inc] = $1 # $0 is wc -c output, $1 is size + totals[inc] = $1 * includes[inc] + totalsize += totals[inc] + close(cmd) + } + PROCINFO["sorted_in"] = "@val_num_desc" + print "sum total bytes included: " totalsize + for (inc in totals) { + print totals[inc], sizes[inc], includes[inc], inc + } +} -- cgit