ClangBuiltLinux / tc-build

A set of scripts to build LLVM and binutils
Apache License 2.0
219 stars 179 forks source link

Print total disc-usage in MiB #224

Open dileks opened 1 year ago

dileks commented 1 year ago

I wish to see at the end of my stage1-only or thinlto_pgo_optimized LLVM toolchain build a summary listing me the disc-usage of the single folder and if possible of the total build.

stage1-only:

python3 ./build-llvm.py --no-update --build-type Release -p clang;lld -t X86;BPF --clang-vendor dileks -B /home/dileks/src/llvm/build -I /opt/llvm --check-targets clang lld --build-stage1-only --install-stage1-only -D LLVM_PARALLEL_LINK_JOBS=1 --show-build-commands

thinlto_pgo_optimized:

python3 ./build-llvm.py --no-update --build-type Release -p clang;lld -t X86;BPF --clang-vendor dileks -B /home/dileks/src/llvm/build -I /opt/llvm --check-targets clang lld --lto thin --pgo kernel-defconfig -L /home/dileks/src/linux/git -D LLVM_PARALLEL_LINK_JOBS=1 --show-build-commands

As you can see I use build, install and linux folders - that I mean with singlefolder(s).

Preferrably: the sizes in MiB

Thanks.

dileks commented 1 year ago

Examples:

stage1-only:

3777    /home/dileks/src/llvm/build
1722    /opt/llvm
138     /mnt/sandisk/ccache/llvm

thinlto_pgo_optimized:

8321    /home/dileks/src/llvm/build
1872    /opt/llvm
799     /home/dileks/src/linux/git/out
nathanchance commented 1 year ago

I do not really see how this information is generally useful enough to belong in build-llvm.py directly vs. just placing few calls to du -sh in a wrapper script. The time printing is useful so that you know how much each stage took and how long the whole script took, which can be useful for future estimation or benchmarking, since time is a generally valuable resource to everyone. I do not think that disk usage has the same scarcity for most people so that information is just going to be noise for them, especially since the guidance is just going to be "build less code or upgrade the amount of space you have".

I am happy to hear opinions from other users of the script though!

dileks commented 1 year ago

Numbers talk - Bullshit walks. Linus Torvalds

Unfortunately, I kept the statistics together with my tarball in the same archives directory. Removed them with every LLVM major upgrade.

Comparison reasons?

Here some numbers of LLVM-11.0.3-rc3:

[ build-time_disc-usage_llvmorg-11.0.0-rc3-0b56e5490dc3-thinlto_pgo_optimized.txt ]

[ BUILD-TIME ]

install:
total 28K
drwxr-xr-x 11 dileks dileks 4.0K Aug 29 20:56 ..
drwxr-xr-x  2 dileks dileks 4.0K Aug 29 20:32 bin
drwxr-xr-x  6 dileks dileks 4.0K Aug 29 20:32 .
-rw-r--r--  1 dileks dileks    1 Aug 29 20:32 .gitignore
drwxr-xr-x  4 dileks dileks 4.0K Aug 29 20:32 lib
drwxr-xr-x  4 dileks dileks 4.0K Aug 29 20:32 share
drwxr-xr-x  7 dileks dileks 4.0K Aug 29 20:32 include

build:
total 26M
drwxr-xr-x 11 dileks dileks 4.0K Aug 29 20:56 ..
drwxr-xr-x 14 dileks dileks 4.0K Aug 29 20:32 stage3
drwxr-xr-x  5 dileks dileks 4.0K Aug 29 11:31 .
-rw-r--r--  1 dileks dileks  26M Aug 29 11:31 profdata.prof
drwxr-xr-x 15 dileks dileks 4.0K Aug 29 08:35 stage2
drwxr-xr-x 12 dileks dileks 4.0K Aug 29 08:33 stage1

NOTE: profdata.prof is 26M big (vs. Clang-PGO approx. 6.5M).

[ DISC-USAGE ]

540  /home/dileks/src/linux-kernel/git/out
7939 /home/dileks/src/llvm-toolchain/build
1343 /home/dileks/src/llvm-toolchain/install

[ HISTORY ]

-dileks // 02-Feb-2021: Clean-up; Split into BUILD-TIME and DISC-USAGE; Note profdata.prof file-size
-dileks // 29-Aug-2020: Initial release

Today, the profdata.prof is 48 MiB.

For the records with the disc-usage of git. What do you have now...

LLVM 15.0.7 thinlto_pgo_optimized:

8321    /home/dileks/src/llvm/build
1872    /opt/llvm
799     /home/dileks/src/linux/git/out
3907    /home/dileks/src/llvm/git (tc-build + llvm-project)

... a new number: 14899 MiB <--- target: X86+BPF || 3-stages compilation + install etc.

Plus tar.zst tarballs of build and install directories:

$ du -s -m ~/src/llvm/archives/dileks-llvm-toolchain-15.0.7-5-g2c432a3d6ea8-thinlto_pgo_optimized-KCFI /opt/archives/ccOK_dileks-llvm-toolchain-15.0.7-5-g2c432a3d6ea8-thinlto_pgo_optimized-KCFI.tar.zst
2317    /home/dileks/src/llvm/archives/dileks-llvm-toolchain-15.0.7-5-g2c432a3d6ea8-thinlto_pgo_optimized-KCFI
653     /opt/archives/ccOK_dileks-llvm-toolchain-15.0.7-5-g2c432a3d6ea8-thinlto_pgo_optimized-KCFI.tar.zst

Man, 18 GiB disc-usage! WOW, that's a number.

dileks commented 1 year ago

Corrections:

$ du -s -m ~/src/llvm/git
3853    /home/dileks/src/llvm/git

I had binutils-2.40, build+install not removed.