Skip to content

Commit 2eaad8c

Browse files
authored
Fixes on alias evaluation (#210)
1 parent 71f9f91 commit 2eaad8c

13 files changed

+70
-53
lines changed

evaluation/benchmarks/aliases/select/1.tomp3.sh evaluation/benchmarks/aliases/1.tomp3.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# tag: wav-to-mp3
44
set -e
55

6-
IN=${WAV:-$PASH_TOP/evaluation/benchmarks/aliases/meta/wav}
7-
OUT=${OUT:-PASH_TOP/evaluation/benchmarks/aliases/meta/out}
6+
IN=${WAV:-$PASH_TOP/evaluation/benchmarks/aliases/input/wav}
7+
OUT=${OUT:-$PASH_TOP/evaluation/benchmarks/aliases/input/out}
88

99
find $IN -name '*.wav' |
1010
xargs -n1 basename |
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
#tag: rtf-to-txt
4+
set -e
5+
IN=${RTF:-$PASH_TOP/evaluation/benchmarks/aliases/input/rtf}
6+
OUT=${OUT:-PASH_TOP/evaluation/benchmarks/aliases/input/out}
7+
find $IN -name '*.rtf' | xargs -I {} unrtf {} --text > /dev/null

evaluation/benchmarks/aliases/select/3.resiz.sh evaluation/benchmarks/aliases/3.resiz.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
set -e
55

66

7-
IN=${JPG:-$PASH_TOP/evaluation/benchmarks/aliases/meta/jpg}
8-
OUT=${OUT:-PASH_TOP/evaluation/benchmarks/aliases/meta/out}
7+
IN=${JPG:-$PASH_TOP/evaluation/benchmarks/aliases/input/jpg}
8+
OUT=${OUT:-PASH_TOP/evaluation/benchmarks/aliases/input/out}
99

1010
find $IN -name "*.jpg" |
1111
xargs -n1 basename |

evaluation/benchmarks/aliases/select/4.gitkernel.sh evaluation/benchmarks/aliases/4.gitkernel.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# First command is almost always a generator
33
set -e
4-
IN=${GIT:-$PASH_TOP/evaluation/benchmarks/aliases/meta/linux}
4+
IN=${GIT:-$PASH_TOP/evaluation/benchmarks/aliases/input/linux}
55

66
#FIXME define a complex expression
77
COMPLEX=""
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
# fetch hit count for each ip ?
33
set -e
4-
IN=${IN:-$PASH_TOP/evaluation/benchmarks/aliases/meta/}
4+
IN=${IN:-$PASH_TOP/evaluation/benchmarks/aliases/input/}
55

66
# 405 original
77
# cat ${IN}/apache.log | grep "\->" | grep -o "from [^ ]*" | cut -d ' ' -f2 | sort | uniq -c | sort -nr | less
88
# FIXME need apache error logs ..
9-
cat ${IN}/apache.log | grep -o "from [^ ]*" | cut -d ' ' -f2 | sort | uniq -c | sort -nr
9+
cat ${IN}apache.log | grep -o "from [^ ]*" | cut -d ' ' -f2 | sort | uniq -c | sort -nr

evaluation/benchmarks/aliases/select/6.msg.sh evaluation/benchmarks/aliases/6.msg.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# First command is almost always a generator
33
set -e
4-
OUT=${OUT:-$PASH_TOP/evaluation/benchmarks/aliases/meta/out}
4+
OUT=${OUT:-$PASH_TOP/evaluation/benchmarks/aliases/input/out}
55

66

77
# grep -iv ': starting\|kernel: .*: Power Button\|watching system buttons\|Stopped Cleaning Up\|Started Crash recovery kernel' /var/log/messages /var/log/syslog /var/log/* 2> /dev/null | grep -iw 'recover[a-z]*\|power[a-z]*\|shut[a-z ]*down\|rsyslogd\|ups' > /tmp/__shutdown.log && echo 'File written to /tmp__shutdown.log'
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# fetch hit count for each ip ?
33
set -e
4-
IN=${IN:-${PASH_TOP}/evaluation/benchmarks/aliases/meta}
4+
IN=${IN:-${PASH_TOP}/evaluation/benchmarks/aliases/input}
55
# original command tail -10000 /var/log/nginx/access.log | cut -d "" "" -f1 | sort | uniq -c | sort -n | tail -n 30 | sort -nrk 1 | awk
66
cat ${IN}/access.log | cut -d ' ' -f1 | sort | uniq -c | sort -n | tail -n 30 | sort -nrk 1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# install dependencies
22
pkgs='ffmpeg unrtf imagemagick'
33
if ! dpkg -s $pkgs >/dev/null 2>&1; then
4-
sudo apt-get install $pkgs
4+
sudo apt-get install $pkgs -y
55
fi
66

evaluation/benchmarks/aliases/meta/setup.sh evaluation/benchmarks/aliases/input/setup.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
set -e
55

66

7-
IN=$PASH_TOP/evaluation/benchmarks/aliases/meta/
8-
OUT=$PASH_TOP/evaluation/benchmarks/aliases/meta/out
7+
IN=$PASH_TOP/evaluation/benchmarks/aliases/input/
8+
OUT=$PASH_TOP/evaluation/benchmarks/aliases/input/out
99
if [[ "$1" == "-c" ]]; then
1010
rm -rf ${IN}/jpg
1111
rm -rf ${IN}/rtf

evaluation/benchmarks/aliases/meta/notes.txt

-8
This file was deleted.

evaluation/benchmarks/aliases/select/2.unrtf.sh

-7
This file was deleted.

evaluation/benchmarks/run.seq.sh

+51-26
Original file line numberDiff line numberDiff line change
@@ -252,34 +252,59 @@ poets(){
252252

253253

254254
aliases(){
255-
cd aliases/
256-
if [ -e ./seq.res ]; then
257-
echo "skipping $(basename $(pwd))/seq.res"
255+
seq_times_file="seq.res"
256+
outputs_suffix="seq.out"
257+
outputs_dir="outputs"
258+
if [ -e "aliases/${seq_times_file}" ]; then
259+
echo "skipping aliases/${seq_times_file}"
258260
return 0
259261
fi
260262

261-
cd meta/
263+
cd aliases/
264+
265+
cd input/
262266
./setup.sh
267+
./install-deps.sh
263268
cd ..
264-
echo '' > seq.res
265-
echo executing aliases $(date) | tee -a ./seq.res
266-
cd select
267-
export WAV=$PASH_TOP/evaluation/benchmarks/aliases/meta/wav
268-
export JPG=$PASH_TOP/evaluation/benchmarks/aliases/meta/jpg
269-
export RTF=$PASH_TOP/evaluation/benchmarks/aliases/meta/rtf
270-
export GIT=$PASH_TOP/evaluation/benchmarks/aliases/meta/linux
271-
export IN=$PASH_TOP/evaluation/benchmarks/aliases/meta/
272-
export OUT=$PASH_TOP/evaluation/benchmarks/aliases/meta/out
273-
echo tomp3: $({ time ./1.tomp3.sh > /dev/null; } 2>&1) | tee -a ../seq.res
274-
echo unrtf: $({ time ./2.unrtf.sh > /dev/null; } 2>&1) | tee -a ../seq.res
275-
echo convertjpg: $({ time ./3.resiz.sh > /dev/null; } 2>&1) | tee -a ../seq.res
276-
#echo gitkernel: $({ time ./4.gitkernel.sh > /dev/null; } 2>&1) | tee -a ../seq.res FIXME need complex grep command
277-
echo apachelog: $({ time ./5.apachelog.sh > /dev/null; } 2>&1) | tee -a ../seq.res
278-
echo msg: $({ time ./6.msg.sh > /dev/null; } 2>&1) | tee -a ../seq.res
279-
echo nginx: $({ time ./7.nginx.sh > /dev/null; } 2>&1) | tee -a ../seq.res
280-
echo varlog: $({ time ./8.varlog.sh > /dev/null; } 2>&1) | tee -a ../seq.res
281-
}
282269

270+
mkdir -p "$outputs_dir"
271+
272+
names_scripts=(
273+
#"tomp3;1.tomp3"
274+
#"unrtf;2.unrtf"
275+
#"convertjpg;3.resiz"
276+
# "gitkernel;4.gitkernel" # needs complex grep command
277+
"apachelog;5.apachelog"
278+
"msg;6.msg"
279+
"nginx;7.nginx"
280+
"varlog;8.varlog"
281+
)
282+
283+
touch "$seq_times_file"
284+
echo executing aliases $(date) | tee -a "$seq_times_file"
285+
echo '' >> "$seq_times_file"
286+
287+
export WAV=$PASH_TOP/evaluation/benchmarks/aliases/input/wav
288+
export JPG=$PASH_TOP/evaluation/benchmarks/aliases/input/jpg
289+
export RTF=$PASH_TOP/evaluation/benchmarks/aliases/input/rtf
290+
export GIT=$PASH_TOP/evaluation/benchmarks/aliases/input/linux
291+
export IN=$PASH_TOP/evaluation/benchmarks/aliases/input/
292+
export OUT=$PASH_TOP/evaluation/benchmarks/aliases/input/out
293+
for name_script in ${names_scripts[@]}
294+
do
295+
IFS=";" read -r -a name_script_parsed <<< "${name_script}"
296+
name="${name_script_parsed[0]}"
297+
script="${name_script_parsed[1]}"
298+
printf -v pad %30s
299+
padded_script="${name}.sh:${pad}"
300+
padded_script=${padded_script:0:30}
301+
302+
outputs_file="${outputs_dir}/${script}.${outputs_suffix}"
303+
304+
echo "${padded_script}" $({ time ./${script}.sh > "$outputs_file"; } 2>&1) | tee -a "$seq_times_file"
305+
done
306+
cd ..
307+
}
283308

284309
bio() {
285310
cd bio
@@ -369,8 +394,8 @@ posh() {
369394

370395

371396

372-
posh
397+
#posh
373398
#poets
374-
#aliases
375-
dgsh
376-
399+
aliases
400+
#dgsh
401+
#

0 commit comments

Comments
 (0)