Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import matplotlib.pyplot as plt
- import math
- TIMEOUT_THD = 60
- FONTSIZE = 13
- plt.style.use('ieee')
- x = [80, 90, 100, 110, 120, 130, 140, 150, 160, 170]
- y_ms = [math.inf, math.inf, 63000, 45000, 30500, 20500, 9250, 2350, 0, 0] #assuming 1min timeout threshold
- y = [elem/1000 for elem in y_ms]
- #print(y)
- y_right_ms = [math.inf, math.inf, math.inf, 69000, 57000, 43000, 29000, 21000, 4000, 100]
- y_right = [elem/1000 for elem in y_right_ms]
- x_BR = [100, 110, 120]
- y_BR=[63000, 45000, 30500]
- #original 101.5
- #higher heap 118
- stable_region_x = [80, 90, 100, 101.5]
- stable_region_y = [TIMEOUT_THD] * len(stable_region_x)
- stable_region_x_right = [80, 90, 100, 110, 117.3]
- stable_region_y_right = [TIMEOUT_THD] * len(stable_region_x)
- ax = plt.gca()
- ax.set_xlim([x[0], x[-1]])
- ax.set_ylim([0, TIMEOUT_THD])
- plt.plot(x, y, "--")
- plt.plot(x, y_right, color = 'black')
- plt.fill_between(x, y, color='orange')
- plt.fill_between(x, y, TIMEOUT_THD, color='red')
- plt.fill_between(stable_region_x, stable_region_y, color='skyblue')
- #plt.fill_between(x, y, y_right, color='red', hatch=r'//', edgecolor='orange')
- #plt.fill_between(x_BR, y_BR, )
- #Blue and Orange
- stable_range_x = [101.5, 117.3]
- stable_range_y = [60, 34.8875]
- stable_range_max_y = [60, 60]
- plt.rcParams["hatch.linewidth"] = 4
- plt.fill_between(stable_range_x, stable_range_y,hatch=r"//", color = "skyblue", edgecolor="orange")
- plt.fill_between(stable_range_x, stable_range_y, stable_range_max_y ,hatch=r"//", color = "skyblue", edgecolor="red")
- vulnerable_range_x = [117.3, 170]
- vulnerable_range_y = [34.8875, 0]
- vulnerable_range_max_y = [60, 60]
- x = [117.3, 120, 130, 140, 150, 160, 170]
- y_right_ms = [ 60000, 57000, 43000, 29000, 21000, 4000, 100]
- y_right = [elem/1000 for elem in y_right_ms]
- y_ms = [ 34887.5, 30500, 20500, 9250, 2350, 0, 0] #assuming 1min timeout threshold
- y = [elem/1000 for elem in y_ms]
- print(y)
- plt.fill_between(x, y, y_right , hatch=r"//", color = "red", edgecolor="orange")
- #plt.fill_between(vulnerable_range_x, vulnerable_range_y, vulnerable_range_max_y ,hatch=r"//", color = "skyblue", edgecolor="red")
- plt.xlabel('Requests per second', fontsize = 9)
- plt.ylabel('Trigger duration (s)',fontsize = 9)
- t0= plt.text(82.5, TIMEOUT_THD/2, 'Stable\nregion', weight = 'bold')
- t0.set_bbox(dict(facecolor='skyblue', alpha=0.6, edgecolor='skyblue'))
- t1= plt.text(135, 0.75*TIMEOUT_THD, 'Metastable failure\nregion', weight = 'bold')
- t2= plt.text(103, 5, 'Vulnerable region', weight = 'bold')
- t2.set_bbox(dict(facecolor='orange', alpha=0.6, edgecolor='orange'))
- figure = plt.gcf()
- figure.set_size_inches(4, 2.2)
- plt.savefig("test.png", dpi = 400)
- t3 = plt.text(135, 6, "Max heap size: 384MB", rotation = -41.5 ,color = "white" , weight='bold')
- t3.set_bbox(dict(facecolor='black', alpha=0.4, edgecolor='black'))
- t4= plt.text(110, 7, "Max heap size: 256MB", weight='bold', rotation = -41.5 , color = "white")
- t4.set_bbox(dict(facecolor='black', alpha=0.4, edgecolor='black'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement