-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtadapt.rb
executable file
·72 lines (63 loc) · 1.55 KB
/
tadapt.rb
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env ruby
require 'terminal-table'
$BENCH = {
sunflow:"sunflow",
# jython:"jython",
# xalan:"xalan",
# findbugs:"findbugs",
# pagerank:"pagerank"
}
$DIR = "tadapt_run"
$RUNS = ["run_ld_tent.txt","run_ld_tjava.txt"]
$LABELS = ["'Ent'","'Unadaptive Ent'"]
# Build table for energy consumed for each run
consumedtable = {}
$BENCH.each do |bench, path|
energy = []
$RUNS.each do |run|
m = File.open("./#{path}/#{$DIR}/#{run}").read().match(/Energy:(.*)$/)
energies = m[1].strip().split()
energy << energies[2]
end
consumedtable[bench] = energy
end
# Build table for runtime for each run
#timetable = {}
#$BENCH.each do |bench, path|
# times = []
# $RUNS.each do |run|
# m = File.open("./#{path}/#{$DIR}/#{run}").read().match(/Time:(.*)$/)
# times << m[1].strip().split()[0]
# end
# timetable[bench] = times
#end
$BENCH.each do |bench, path|
tempsdat = File.open("dat/tadapt_#{bench}_temps.dat", "w+")
temptable = {}
temps = []
$RUNS.each do |run|
m = File.open("./#{path}/#{$DIR}/#{run}").read().scan(/Temperature:(.*)$/)
points = []
m.each do |t|
points << t[0]
end
temps << points
end
for i in 0...temps[0].length
tempsdat.write("#{i} ")
for j in 0...temps.length
tempsdat.write("#{temps[j][i]} ")
end
tempsdat.write("\n")
end
end
j = 0
consumedtable.each do |bench, results|
consumeddat = File.open("dat/tadapt_#{bench}_consumed.dat", "w+")
i = 0
results.each do |run|
consumeddat.write("#{j} #{$LABELS[i]} #{run}\n")
i += 1
j += 1
end
end