Skip to content

Commit

Permalink
old changes
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Oct 22, 2023
1 parent 13cd899 commit 7dd553e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def graph(myitems, out_name):
params['with'] = "points ls %i" % (i+1)
if k:
params['title'] = k
print i, len(v)
l.append(Gnuplot.Data(v, **params))
if l:
g.plot(*l)
g.close()
while not os.path.exists(tmp_name):
time.sleep(1)
os.rename(tmp_name, out_name)
Expand Down
63 changes: 63 additions & 0 deletions graph_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os
import random
import time

import Gnuplot

def graph(myitems, out_name):
tmp_name = out_name+".tmp"+str(random.randrange(2**24))
g = Gnuplot.Gnuplot(debug=1)
g("set terminal png size 1200,800 nocrop x000000 xA9A9A9 xA9A9A9 xFF0000 x00FF00 x0000FF")
g("set border 3")
g("set xtics 31556952")
g("set ytics nomirror")
g.set_string("output", tmp_name)
g.xlabel('Time')
g.ylabel('Max GB/$');
g("set style line 1 lc 1")
g("set style line 2 lc 2")
g("set style line 3 lc 3")
g("set style line 4 lc 4")
l = []
for i, (k, v) in enumerate(myitems):
if v:
params = {}
params['with'] = "points ls %i" % (i+1)
if k:
params['title'] = k
l.append(Gnuplot.Data(v, **params))
g.plot(*l)
while not os.path.exists(tmp_name):
time.sleep(1)
os.rename(tmp_name, out_name)

fixes = {
'enclosure 2.5"': 'enclosure 2.5 inch',
'enclosure 3.5"': 'enclosure 3.5 inch',
'enclosure 2.5in': 'enclosure 2.5 inch',
'enclosure 3.5in': 'enclosure 3.5 inch',
'ssd enterprise': 'ssd Enterprise',
'sata': 'hdd',
'satas': 'laptop_hdd',
'sata 3.5in': 'hdd',
'sata 2.5in': 'laptop_hdd',
'flash microSD': 'flash MicroSD',

'enclosure': 'enclosure 2.5 inch',
'ssd': 'ssd Normal',
}

data = {}
for line in open('result/record.txt'):
line = eval(line)
assert line[2] is not None
if line[3] is None: continue
if line[3] > 40: continue
name = line[0].lower() + (' ' + line[1] if line[1] is not None else '')
name = fixes.get(name, name)
data.setdefault(name, []).append((line[2], line[3]))
for a, b in data.items():
if len(b) < 100:
data.pop(a)
print a, (min(x[0] for x in b), max(x[0] for x in b)), (min(x[1] for x in b), max(x[1] for x in b))
graph(data.items(), "time.png")

0 comments on commit 7dd553e

Please sign in to comment.