[yocto-autobuilder-helper,3/4] collect-results: collect "host_stats" files generated by collect-data template

Submitted by Sakib Sajal on April 13, 2021, 5:02 p.m. | Patch ID: 179622

Details

Message ID 20210413170210.72845-3-sakib.sajal@windriver.com
State New
Headers show

Commit Message

Sakib Sajal April 13, 2021, 5:02 p.m.
collect-data template generates host_stats files which are collected.
All files are published, file names are determined by the contents:
    - Files that contain "top" output are named host_stats_<number>_top.txt
    - host_stats_<number>.txt otherwise

Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
---
 scripts/collect-results | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch hide | download patch | download mbox

diff --git a/scripts/collect-results b/scripts/collect-results
index 5db43fb..7474e36 100755
--- a/scripts/collect-results
+++ b/scripts/collect-results
@@ -17,3 +17,22 @@  if [ -e $WORKDIR/buildhistory ]; then
         $WORKDIR/../scripts/buildhistory-diff -p $WORKDIR/buildhistory ab-fetchrev > $DEST/$target/buildhistory.txt
     fi
 fi
+
+HSFILE=$WORKDIR/tmp/buildstats/*/host_stats
+d=`date +%Y-%m-%d--%H-%M`
+
+mkdir -p $DEST/$target/$d
+
+step=0
+for f in $HSFILE; do
+	if [ -e $f ]; then
+	    cp $f $DEST/$target/$d
+	    grep -m 1 "^top -" $f
+	    if [ $? -eq 0 ]; then
+		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step}_top.txt
+	    else
+		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step}.txt
+	    fi
+	    step=$((step+1))
+	fi
+done