summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Schröter <adrian@suse.de>2012-10-10 14:29:01 +0200
committerAdrian Schröter <adrian@suse.de>2012-10-10 14:29:01 +0200
commitf67e5fbf939db77e496542f8fb588a70c38e1eeb (patch)
tree24084ee8350b4bfb5c39a8b7c22f67ee06a39bdb
parent17de8ce5d3816facc6739326925e38feeeab815b (diff)
downloadbuild-f67e5fbf939db77e496542f8fb588a70c38e1eeb.tar.gz
build-f67e5fbf939db77e496542f8fb588a70c38e1eeb.tar.bz2
build-f67e5fbf939db77e496542f8fb588a70c38e1eeb.zip
- basic support for collecting build statistics
-rwxr-xr-xbuild33
1 files changed, 33 insertions, 0 deletions
diff --git a/build b/build
index 5f42aa2..2c2ca93 100755
--- a/build
+++ b/build
@@ -603,6 +603,20 @@ vm_img_mkfs()
}
+background_monitor_process()
+{
+ max=0
+ while sleep 5; do
+
+ c=(`df -m $1 | tail -n 1`)
+
+ if [ ${c[2]} -gt $max ]; then
+ max="${c[2]}"
+ echo $max > /.build/_statistics.df
+ fi
+ done
+}
+
detect_vm_2nd_stage()
{
if ! test "$0" = "/.build/build" ; then
@@ -658,6 +672,9 @@ detect_vm_2nd_stage()
fi
HOST="$MYHOSTNAME"
+ # fork a process monitoring max filesystem fillment during build
+ background_monitor_process / >& /dev/null &
+
return 0
}
@@ -2340,6 +2357,22 @@ if test -n "$RPMS" \
fi
if test -n "$RUNNING_IN_VM" -a -n "$VM_SWAP"; then
+ echo "... saving built statistics"
+ echo "# statistics about used resources during build" > $TOPDIR/OTHER/_statistics
+ if [ -e /.build/_statistics.df ]; then
+ echo -n "MAX_mb_used_on_disk: " >> $TOPDIR/OTHER/_statistics
+ cat /.build/_statistics.df >> $TOPDIR/OTHER/_statistics
+ fi
+ mount -n sys /sys -t sysfs
+ device="sda"
+ [ -e /dev/vda ] && device="vda"
+ disk=(`cat /sys/block/${device}/stat`)
+ echo "IO_requests_read: ${disk[0]}" >> $TOPDIR/OTHER/_statistics
+ echo "IO_sectors_read: ${disk[2]}" >> $TOPDIR/OTHER/_statistics
+ echo "IO_requests_write: ${disk[4]}" >> $TOPDIR/OTHER/_statistics
+ echo "IO_sectors_write: ${disk[6]}" >> $TOPDIR/OTHER/_statistics
+ umount /sys
+
echo "... saving built packages"
swapoff "$VM_SWAP"
args="--padstart 512 --padend 512 -v"