-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.rb
26 lines (18 loc) · 794 Bytes
/
demo.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
$LOAD_PATH << "./lib"
require 'matplotlib.rb'
ours_way_data = [53.9, 112.74, 170.46, 228.49, 284.84, 342.16, 403.48, 467.28, 523.62, 587.62]
trad_way_data = [109.47, 226.04, 339.01, 455.16, 572.44, 683.66, 818.47, 941.26, 1064.93, 1189.95]
sizes = [5242880, 10485760, 15728640, 20971520, 26214400, 31457280, 36700160, 41943040, 47185920, 52428800]
fig, ax = Plot.subplots
ax.plot! sizes, ours_way_data, 'ro--', label: "Ours Way"
ax.plot! sizes, trad_way_data, 'o-', label: "Tranditional Way"
ax.set_xticks sizes
ax.set_xlim sizes.minmax
ax.set_xticklabels sizes.map {|x| x/1024/1024 }
ax.grid
ax.legend! loc: "upper left"
Plot.title "Client Resp Time(sec) v.s. File Size(MB)"
Plot.xlabel "File Size (MB)"
Plot.ylabel "Client Resp Time (sec)"
# Plot.savefig "client_resp.png"
Plot.show