2
2
import matplotlib .pyplot as plt
3
3
from matplotlib .ticker import FormatStrFormatter
4
4
5
- inputFile = "jmh-result.csv"
6
- outputFile = "flow-flatten-merge.svg"
5
+ input_file = "jmh-result.csv"
6
+ output_file = "flow-flatten-merge.svg"
7
7
elements = 100000
8
- benchmarkName = "benchmarks.flow.FlowFlattenMergeBenchmark.flattenMerge"
8
+ benchmark_name = "benchmarks.flow.FlowFlattenMergeBenchmark.flattenMerge"
9
+ csv_columns = ["Benchmark" , "Score" , "Score Error (99.9%)" , "Unit" , "Param: concurrency" , "Param: flows" ]
10
+ rename_columns = {"Benchmark" : "benchmark" , "Score" : "score" , "Score Error (99.9%)" : "score_error" , "Unit" : "unit" ,
11
+ "Param: concurrency" : "concurrency" , "Param: flows" : "flows" }
9
12
10
13
markers = ['.' , 'v' , '^' , '1' , '2' , '8' , 'p' , 'P' , 'x' , 'D' , 'd' , 's' ]
11
14
colours = ['black' , 'silver' , 'red' , 'gold' , 'sienna' , 'olivedrab' , 'lightseagreen' , 'navy' , 'blue' , 'm' , 'crimson' , 'yellow' , 'orangered' , 'slateblue' , 'aqua' ]
@@ -23,27 +26,27 @@ def next_marker():
23
26
i += 1
24
27
25
28
def draw (data , plt ):
26
- data = data [(data .benchmark == benchmarkName )]
27
-
28
29
plt .xscale ('log' , basex = 2 )
29
30
plt .gca ().xaxis .set_major_formatter (FormatStrFormatter ('%0.f' ))
30
31
plt .grid (linewidth = '0.5' , color = 'lightgray' )
31
32
plt .ylabel (data .unit .unique ()[0 ])
32
33
plt .xlabel ('concurrency' )
33
34
plt .xticks (data .concurrency .unique ())
34
35
35
- colourGen = next_colour ()
36
- markerGen = next_marker ()
36
+ colour_gen = next_colour ()
37
+ marker_gen = next_marker ()
37
38
for flows in data .flows .unique ():
38
- genColour = next (colourGen )
39
- genMarker = next (markerGen )
39
+ gen_colour = next (colour_gen )
40
+ gen_marker = next (marker_gen )
40
41
res = data [(data .flows == flows )]
41
- plt .plot (res .concurrency , res .score * elements , label = "flows={}" .format (flows ), color = genColour , marker = genMarker )
42
- plt .errorbar (x = res .concurrency , y = res .score * elements , yerr = res .scoreError * elements , solid_capstyle = 'projecting' , capsize = 5 )
42
+ plt .plot (res .concurrency , res .score * elements , label = "flows={}" .format (flows ), color = gen_colour , marker = gen_marker )
43
+ plt .errorbar (x = res .concurrency , y = res .score * elements , yerr = res .score_error * elements , solid_capstyle = 'projecting' , capsize = 5 )
43
44
44
- data = pd .read_table (inputFile , sep = "," , skiprows = 1 , names = ["benchmark" ,"mode" ,"threads" ,"samples" ,"score" ,"scoreError" ,"unit" ,"concurrency" ,"flows" ])
45
+ data = pd .read_table (input_file , sep = "," )
46
+ data = data [csv_columns ].rename (columns = rename_columns )
47
+ data = data [(data .benchmark == benchmark_name )]
45
48
plt .figure (figsize = (20 , 20 ))
46
49
draw (data , plt )
47
50
plt .legend (loc = 'upper center' , borderpad = 0 , ncol = 4 , frameon = False , borderaxespad = 4 , prop = {'size' : 8 })
48
51
plt .tight_layout (pad = 12 , w_pad = 2 , h_pad = 1 )
49
- plt .savefig (outputFile , bbox_inches = 'tight' )
52
+ plt .savefig (output_file , bbox_inches = 'tight' )
0 commit comments