From 1a60faf70e303ab9d0aa5dc1a993616a220313b6 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 1 Jun 2024 03:22:22 +0200 Subject: [PATCH] bin/ --- bin/extract-data-benchmark-cars.sh | 16 ++++++++++++ bin/rsum2line.awk | 39 +++++++++++++++++++++++++++ bin/stats.sh | 42 ++++++++++++++++++++++++++++++ bin/summary-to-truncated-data.sh | 16 ++++++++++++ bin/summary.r | 14 ++++++++++ 5 files changed, 127 insertions(+) create mode 100755 bin/extract-data-benchmark-cars.sh create mode 100755 bin/rsum2line.awk create mode 100755 bin/stats.sh create mode 100755 bin/summary-to-truncated-data.sh create mode 100644 bin/summary.r diff --git a/bin/extract-data-benchmark-cars.sh b/bin/extract-data-benchmark-cars.sh new file mode 100755 index 0000000..b976d61 --- /dev/null +++ b/bin/extract-data-benchmark-cars.sh @@ -0,0 +1,16 @@ +#!/bin/sh +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +d=$1 + +awk '{ print $1 }' < $d/ram_index.d | sort -n | uniq > it +mkdir data + +echo "from truncated data (.t) to graphed data data/XXX.d" +paste it $d/ram_index.t $d/cached_index.t $d/fifo_index.t $d/semi_index.t $d/uncached_index.t > ./data/index.d +paste it $d/ram_partitions.t $d/cached_partitions.t $d/fifo_partitions.t $d/semi_partitions.t $d/uncached_partitions.t > ./data/partitions.d +paste it $d/ram_tags.t $d/cached_tags.t $d/fifo_tags.t $d/semi_tags.t $d/uncached_tags.t > ./data/tags.d diff --git a/bin/rsum2line.awk b/bin/rsum2line.awk new file mode 100755 index 0000000..e62528d --- /dev/null +++ b/bin/rsum2line.awk @@ -0,0 +1,39 @@ +#!/usr/bin/awk -f + +BEGIN { + FOUND_95pct = 0 + FOUND_mean = 0 +} + +FOUND_95pct == 1 { + pct_min = $1 + pct_max = $2 + FOUND_95pct = 0 +} + +FOUND_mean == 1 { + mean = $1 + print pct_min, median, mean, pct_max, t, df, pvalue + FOUND_mean = 0 +} + +/^t = / { + gsub(",", "", $3) + t = $3 + gsub(",", "", $6) + df = $6 + pvalue = $9 +} + +/mean of x/ { + FOUND_mean = 1 +} + +/Median/ { + gsub(":", "") + median = $2 +} + +/95 percent confidence/ { + FOUND_95pct = 1 +} diff --git a/bin/stats.sh b/bin/stats.sh new file mode 100755 index 0000000..4a660dd --- /dev/null +++ b/bin/stats.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# .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) + +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +dir="$1" + +$raw2sum "${dir}" + +# 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() { + # Remove previous computations. + rm ${dir}/*.d + 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 + +$truncate_data "${dir}" diff --git a/bin/summary-to-truncated-data.sh b/bin/summary-to-truncated-data.sh new file mode 100755 index 0000000..f01885e --- /dev/null +++ b/bin/summary-to-truncated-data.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +dir=$1 + +echo "from data (.d) to truncated data (.t)" +for i in $dir/*.d +do + fname=$(echo $i | sed "s/[.]d$/.t/") + awk '{ print $2, $3, $5 }' < $i > $fname +done diff --git a/bin/summary.r b/bin/summary.r new file mode 100644 index 0000000..a3f18a3 --- /dev/null +++ b/bin/summary.r @@ -0,0 +1,14 @@ +# Rscript summary handshake-duration.txt + +require(grDevices) # for colours + +tbl <- read.table(file=commandArgs(TRUE)[1]) +val <- tbl[1] + +summary(val) +# standarddeviation=sd(unlist(val)) +sd(unlist(val)) +# print (standarddeviation, zero.print="standard deviation: ") + +# confint.default (val) +t.test (val)