]> AND Private Git Repository - loba.git/blob - Experimentations/rc_extract
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Move options at proper place in switch..case.
[loba.git] / Experimentations / rc_extract
1 #!/bin/bash
2
3 getval() {
4     zcat -f -- "$1" \
5     | grep -e '^\[main/' \
6     | awk '
7       /\| Load/ { total_load = $(NF - 4); load_dev = $NF; next; }
8       /\| Computation/ { comp_sum = $(NF - 4); next; }
9       /\| Data send amount/ { data_sum = $(NF - 4); next; }
10       /\| Ctrl send count/ { ctrl_sum = $(NF - 4); next; }
11       /\| Total simulated time/ { duration = $NF; next; }
12       /caught CTRL-C/ { interrupted = 1; nextfile; }
13       /Simulation succeeded/ { success = 1; next; }
14       END{
15         ok = success && !interrupted
16         if (ok)
17             print total_load, load_dev, comp_sum,
18                   data_sum, ctrl_sum, duration;
19         else
20             print "n/a", "n/a", "n/a", "n/a", "n/a", "n/a"
21         exit (ok? 0: 1);
22       }
23     '
24 }
25
26 format='%-75s %6s %11s %11s %11s %11s %9s\n'
27 printf "$format" \
28     "# Experimentation" \
29     "Total" "Stddev" "Comput." \
30     "Data amnt" "Ctrl mesg" "Duration"
31 for file; do
32     name=${file%%.gz}
33     name=${name%%.out}
34     if values=$(getval "$file"); then
35         printf "$format" "$name" $values
36     else
37         printf "$format" "#$name" $values
38     fi
39 done