File: mstats.awk

package info (click to toggle)
tinyos 2.1.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 47,476 kB
  • ctags: 36,607
  • sloc: ansic: 63,646; cpp: 14,974; java: 10,358; python: 5,215; makefile: 1,724; sh: 902; asm: 597; xml: 392; perl: 74; awk: 46
file content (52 lines) | stat: -rw-r--r-- 1,658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function line_filter() { 
  gsub(/[^0-9]/," "); 
  gsub(/ +/," "); 
  sub(/^ /,"");
}

BEGIN { FS="[<|>| ]"; skip=1; cnt=0; }
/<benchidx>/ { 
  if ($3 == benchmark) {
    bidx=$3;
    statstr=profstr=timerstr="";
    skip = 0;
  } else 
    skip = 1;
}

/<pre_runtime>/ { pre_runtime = $3; }
/<runtime>/ { runtime = $3; }
/<post_runtime>/ { post_runtime = $3; }
/<ack>On<\/ack>/ { ack=1; }
/<ack>Off<\/ack>/ { ack=0; }
/<bcast>On<\/bcast>/ { bcast=1; }
/<bcast>Off<\/bcast>/ { bcast=0; }

/<timer.*oneshot="yes"/ { if (!skip) { line_filter(); timerstr=sprintf("%s;[ %d %d %d]",timerstr,1,$2,$3);} }
/<timer.*oneshot="no"/ { if (!skip) { line_filter(); timerstr=sprintf("%s;[ %d %d %d]",timerstr,0,$2,$3);} }

/<stat idx/ { if (!skip) { line_filter(); statstr=sprintf("%s;%s",statstr,$0); } }
/<profile idx/ { if (!skip) { line_filter(); profstr=sprintf("%s;%s",profstr,$0); } }
/<error>/ { if ($3!="") skip=1; }

/<\/testresult>/ { if (!skip) {
  if (svn) {
    printf "RES.stats(:,:,%d,%d) = [%s];\n",++cnt,svn,statstr;
    printf "RES.profiles(:,:,%d,%d) = [%s];\n",cnt,svn,profstr;
    printf "RES.timers(:,:,%d,%d) = [%s];\n",cnt,svn,timerstr;
  } else {
    printf "RES.stats(:,:,%d) = [%s];\n",++cnt,statstr;
    printf "RES.profiles(:,:,%d) = [%s];\n",cnt,profstr;
    printf "RES.timers(:,:,%d) = [%s];\n",cnt,timerstr;
  }
}}

END {
  printf "RES.config.bidx = %d;\n",bidx;
  printf "RES.config.pre_runtime = %d;\n",pre_runtime;
  printf "RES.config.runtime = %d;\n",runtime;
  printf "RES.config.post_runtime = %d;\n",post_runtime;
  printf "RES.config.bcast = %d;\n",bcast;
  printf "RES.config.ack = %d;\n",ack;
  printf "RES.name = 'RES';\n";
}