From e16d128c4ca4baa7542eae5f92df00f320967a25 Mon Sep 17 00:00:00 2001 From: Jose Quaresma Date: Wed, 2 Sep 2026 10:24:28 +0100 Subject: [PATCH] ci/yocto-buildstats: add ccache report It is nice to have a report about the space used by ccache. This makes it easier to understand how the space is distributed among the components. The output will be similar to the one below: | Ccache size (0.81GB) [/sstate/ccache]: | 47% 0.38 gcc ######################################### | 18% 0.15 llvm-native ################# | 17% 0.14 glibc ############### | 16% 0.13 linux-yocto ############### [FIXME] du: cannot access '/sstate/ccache/qcs615_ride-qcom-linux/linux-qcom/1/6/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcs615_ride-qcom-linux/linux-qcom/1/6/stats.lock': No such file or directory du: cannot access '/sstate/ccache/iq_615_evk-qcom-linux/linux-qcom/d/stats.alive': No such file or directory du: cannot access '/sstate/ccache/iq_615_evk-qcom-linux/linux-qcom/d/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcom_armv8a-qcom-linux/linux-qcom/0/c/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcom_armv8a-qcom-linux/linux-qcom/0/c/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcom_armv8a-qcom-linux/linux-qcom/d/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcom_armv8a-qcom-linux/linux-qcom/d/stats.lock': No such file or directory du: cannot access '/sstate/ccache/shikra_evk-qcom-linux/linux-qcom/8/c/stats.alive': No such file or directory du: cannot access '/sstate/ccache/shikra_evk-qcom-linux/linux-qcom/8/c/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/f/d/stats.tmp.xPObrL.tmp': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/f/d/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/f/d/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/8/3/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/8/3/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/e/6/stats.tmp.lMaiMS.tmp': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/e/6/stats.lock': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/e/6/stats.alive': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/tmp/inode-cache-64.v2.tmp.9Uneyc.tmp': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/tmp/inode-cache-64.v2.tmp.xaXRCB.tmp': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/tmp/.nfs00000000028ea2f900001e98': No such file or directory du: cannot access '/sstate/ccache/qcs9100_ride_sx-qcom-linux/linux-qcom/tmp/inode-cache-64.v2.tmp.ypB1us.tmp': No such file or directory du: cannot access '/sstate/ccache/iq_615_evk-oe-linux/linux-qcom/c/8/stats.lock': No such file or directory du: cannot access '/sstate/ccache/iq_615_evk-oe-linux/linux-qcom/c/8/stats.tmp.3MtcGE.tmp': No such file or directory Signed-off-by: Jose Quaresma --- ci/yocto-buildstats.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ci/yocto-buildstats.sh b/ci/yocto-buildstats.sh index 942625f61..f4cb2d6eb 100755 --- a/ci/yocto-buildstats.sh +++ b/ci/yocto-buildstats.sh @@ -57,3 +57,22 @@ CMD="$CMD | tee buildstats.log" echo $CMD eval $CMD + +_ncdu(){ + du -sk $1/*/* | \ + sort -rn | \ + sed "s/^/$2 /" | \ + awk '{ \ + printf "%3s%% %6.2f", int(100*$2/$1), $2/(1024*1024); \ + n=split($3,recipe,"/"); printf " %-20s ", recipe[n]; \ + for(i=0; i<$2/10000; i++) printf "#"; print " " \ + }' +} + +CCACHE_TOP_DIR=$(bitbake-getvar --value CCACHE_TOP_DIR --ignore-undefined) +if [ -d "$CCACHE_TOP_DIR" ]; then + CCACHE_SIZE=$(du -sk $CCACHE_TOP_DIR | awk '{ print $1 }') + CCACHE_SIZE_GB=$(echo $CCACHE_SIZE | awk '{ printf "%.2f", $1/(1024*1024)}') + echo "Ccache size (${CCACHE_SIZE_GB}GB) [$CCACHE_TOP_DIR] ..." + _ncdu $CCACHE_TOP_DIR $CCACHE_SIZE | cat +fi