From a317deccae6a49fa62a623fee3e2f8d0b709d2b5 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 5 Sep 2019 14:54:54 +0200 Subject: [PATCH] Improve code --- scripts/Makefile | 14 +++----------- scripts/parse_lib.sh | 11 +++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/Makefile b/scripts/Makefile index 86ae5f4..97fd9ff 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,16 +1,8 @@ SHELL := /bin/bash -.SILENT: test -test: - echo "run,conf,latency" - . parse_lib.sh && \ - get_xp tor_bw_small | while read r; do \ - for i in 0 1 2 3; do \ - extract_us $$r $$i | while read l; do \ - echo $$r,$$i,$$l;\ - done; \ - done; \ - done; +tor_bw_small_parse: + @. parse_lib.sh && \ + parse_latency tor_bw_small 3 tor_bw_small: ./run-3 \ diff --git a/scripts/parse_lib.sh b/scripts/parse_lib.sh index c99a314..9002b1d 100644 --- a/scripts/parse_lib.sh +++ b/scripts/parse_lib.sh @@ -5,3 +5,14 @@ get_xp() { extract_us() { grep -Po '\d+µs' ./out/$1-$2/res/*.csv | grep -Po '\d+' } + +parse_latency() { + echo "run,conf,latency" + get_xp $1 | while read r; do + for i in $(seq 0 1 $2); do + extract_us $r $i | while read l; do + echo $r,$i,$l; + done + done + done +}