summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-07-10 21:47:57 +0200
committerMichael Stahl <mstahl@redhat.com>2015-07-10 23:25:22 +0200
commit2302a5ae5625c2ed3a5e7286940d32c7c176d1d2 (patch)
tree579fc30ac4ff26d9a804725fc2625d02acad3498 /bin
parent6a6b91da20e936abcc9f527f69aff48d2c23a94e (diff)
add script bin/includebloat
Change-Id: I086052c9a4dd2a216e0af153c43e98eec85a4600
Diffstat (limited to 'bin')
-rwxr-xr-xbin/includebloat.awk34
1 files changed, 34 insertions, 0 deletions
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
+ }
+}