|
1
|
#!/bin/bash |
|
2
|
# -*- tcl -*- \ |
|
3
|
exec tclsh "$0" ${1+"$@"} |
|
4
|
|
|
5
|
package require csv |
|
6
|
foreach {in outbasic outmarker plot outbasicold} $argv break |
|
7
|
|
|
8
|
set in [open $in r] |
|
9
|
set ba [open $outbasic w] |
|
10
|
set mr [open $outmarker w] |
|
11
|
|
|
12
|
puts $ba "\# Time Memory MaxMemory" |
|
13
|
puts $mr "\# Time Memory" |
|
14
|
|
|
15
|
set k 0 |
|
16
|
while {![eof $in]} { |
|
17
|
gets $in line |
|
18
|
#puts -nonewline \r[incr k] |
|
19
|
|
|
20
|
if {[string match *|=|* $line]} { |
|
21
|
# Basic series |
|
22
|
regexp {^(.*)\|=\|} $line -> line |
|
23
|
foreach {x _ cba _ _ _ mba} $line break |
|
24
|
puts $ba [join [list $x $cba $mba] \t] |
|
25
|
continue |
|
26
|
} |
|
27
|
|
|
28
|
if {[string match *|@|* $line]} { |
|
29
|
# Marker series |
|
30
|
regexp {^(.*)\|@\|} $line -> line |
|
31
|
foreach {x _ cba} $line break |
|
32
|
puts $mr [join [list $x $cba] \t] |
|
33
|
continue |
|
34
|
} |
|
35
|
} |
|
36
|
|
|
37
|
puts "" |
|
38
|
close $in |
|
39
|
close $ba |
|
40
|
close $mr |
|
41
|
|
|
42
|
# Generate gnuplot control file for the series |
|
43
|
set f [open $plot w] |
|
44
|
puts $f "" |
|
45
|
puts $f "plot \"$outbasic\" using 1:2 title 'Memory' with steps, \\" |
|
46
|
puts $f " \"$outbasic\" using 1:3 title 'Max Memory' with steps" |
|
47
|
puts $f "pause -1" |
|
48
|
puts $f "" |
|
49
|
close $f |
|
50
|
|
|
51
|
# Generate gnuplot control file for comparison of series |
|
52
|
set f [open ${plot}-compare w] |
|
53
|
puts $f "" |
|
54
|
puts $f "plot \"$outbasicold\" using 1:2 title 'Memory Old' with steps, \\" |
|
55
|
puts $f " \"$outbasic\" using 1:2 title 'Memory New' with steps" |
|
56
|
puts $f "pause -1" |
|
57
|
puts $f "" |
|
58
|
close $f |
|
59
|
exit |
|
60
|
|
|
61
|
# Comparison to baseline |
|
62
|
plot "basic.dat" using 1:2 title 'Memory Base' with steps lt rgb "blue", \ |
|
63
|
"newbasic.dat" using 1:2 title 'Memory Current' with steps lt rgb "red", \ |
|
64
|
|
|
65
|
# Comparison to baseline via normalization - need math op (div) |
|
66
|
plot "basic.dat" using 1:2 title 'Memory Base' with steps lt rgb "blue", \ |
|
67
|
"newbasic.dat" using 1:2 title 'Memory Current' with steps lt rgb "red", \ |
|
68
|
|
|
69
|
|
|
70
|
|