Skip to content

Commit

Permalink
Bug fix. Lists of string were passed to merge_intervals(). New code p…
Browse files Browse the repository at this point in the history
…asses lists of floats. The sorting on list of Strings and list of floats are totally different.
  • Loading branch information
yinyanlong committed Mar 17, 2014
1 parent e3444c8 commit b1250e1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
7 changes: 4 additions & 3 deletions src/analysis/global_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ def analyze_multiple_interval_csv(csvs):
total_io_time_nonoverlap = 0.0
for io_rate_csv in csvs:
#print io_rate_csv
tmp_interval_list = []
with open(os.path.join(sig._out_path, io_rate_csv), 'Ur') as f:
tmp_interval_list = list(tuple(rec) for rec in csv.reader(f, delimiter=','))
tmp_interval_list = list((float(rec['Begin']), float(rec['End'])) for rec in csv.DictReader(f, delimiter=','))
if len(tmp_interval_list) <= 1:
continue
total_io_count += len(tmp_interval_list) - 1
total_io_time += sum([float(interval[1]) for interval in tmp_interval_list[1:]]) - sum([float(interval[0]) for interval in tmp_interval_list[1:]])
io_intervals += tmp_interval_list[1:]
total_io_time += sum([float(interval[1]) for interval in tmp_interval_list]) - sum([float(interval[0]) for interval in tmp_interval_list])
io_intervals += tmp_interval_list
io_intervals.sort()
io_intervals = list(merge_intervals(io_intervals))

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/ior.rw.png.wide.plt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set key autotitle columnhead
#set ylabel "Bandwidth (MB\/s)"
set xrange [0: ]
set yrange [0: ]
print trace.'.read.rate.csv'
#print trace.'.read.rate.csv'
plot trace.'.read.rate.csv' ls 1 title 'Read' with steps

# plot write data
Expand All @@ -31,7 +31,7 @@ set style line 2 lt 1 lc rgb "blue"
#set ylabel "Bandwidth (MB\/s)"
set xrange [0: ]
set yrange [0: ]
print trace.'write.dat'
#print trace.'write.dat'
plot trace.'.write.rate.csv' ls 2 title 'Write' with steps

unset multiplot
Expand Down
26 changes: 14 additions & 12 deletions src/analysis/single_trace_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def detectSignature(filename):
## save to list
op = words[op_index].upper();
acc = Access(words)
accList.append(acc)
if acc.size >= 1:
accList.append(acc)

if op.count('READ')>0 or op == 'R':
debugPrint("one READ")
Expand Down Expand Up @@ -184,17 +185,18 @@ def generateCSVs(single_trace_filename):
op = words[op_index].upper();
acc = Access(words)

if op.count('READ')>0 or op == 'R':
debugPrint("one READ")
rlist.append(acc)
total_read_count += 1
total_read_time += acc.endTime - acc.startTime

if op.count('WRITE')>0 or op == 'W':
debugPrint("one WRITE")
wlist.append(acc)
total_write_count += 1
total_write_time += acc.endTime - acc.startTime
if acc.size >= 1:
if op.count('READ')>0 or op == 'R':
debugPrint("one READ")
rlist.append(acc)
total_read_count += 1
total_read_time += acc.endTime - acc.startTime

if op.count('WRITE')>0 or op == 'W':
debugPrint("one WRITE")
wlist.append(acc)
total_write_count += 1
total_write_time += acc.endTime - acc.startTime
# finish reading a batch of 5000 lines of the trace file

# Generate all kinds of CSV files using the rlist and wlist
Expand Down

0 comments on commit b1250e1

Please sign in to comment.