dodb.cr/bin/stats.sh

43 lines
962 B
Bash
Raw Normal View History

2024-05-12 16:47:53 +02:00
#!/bin/sh
2024-05-23 22:58:57 +02:00
# .raw -> bad format -> .summary (great format)
raw2sum="./bin/raw-to-summary.sh"
# .summary (with too much data) -> truncated data (.t)
truncate_data="./bin/summary-to-truncated-data.sh"
# ./bin/extract-data-*.sh: .t -> data/XXX.d (paste an index + *.t)
2024-05-12 16:47:53 +02:00
if [ $# -ne 1 ]
then
echo "usage: $0 result-directory"
exit 0
fi
dir="$1"
2024-05-23 22:58:57 +02:00
$raw2sum "${dir}"
2024-05-12 16:47:53 +02:00
# List raw files with the number of iterations as a prefix so they can then be sorted.
sort_summary_files() {
for i in $dir/*.summary ; do f $i ; done | sort -n
}
f() {
echo $* | sed "s/[_./]/ /g" | xargs echo "$* " | awk '{ printf "%s %s/%s_%s %s\n", $4, $2, $3, $5, $1 }'
}
fill() {
2024-05-23 22:58:57 +02:00
# Remove previous computations.
rm ${dir}/*.d
2024-05-12 16:47:53 +02:00
while read LINE; do
nb_it=$(echo $LINE | awk '{ print $1 }')
target=$(echo $LINE | awk '{ print $2 }')
fname=$(echo $LINE | awk '{ print $3 }')
cat $fname | xargs echo "$nb_it " >> $target.d
done
}
sort_summary_files | fill
2024-05-23 22:58:57 +02:00
$truncate_data "${dir}"