Advertisement
xSkynet

Untitled

May 5th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import matplotlib.pyplot as plt
  4. import math
  5.  
  6. TIMEOUT_THD = 60
  7. FONTSIZE = 13
  8. plt.style.use('ieee')
  9. x = [80, 90, 100, 110, 120, 130, 140, 150, 160, 170]
  10. y_ms = [math.inf, math.inf, 63000, 45000, 30500, 20500, 9250, 2350, 0, 0] #assuming 1min timeout threshold
  11. y = [elem/1000 for elem in y_ms]
  12. #print(y)
  13.  
  14. y_right_ms = [math.inf, math.inf, math.inf, 69000, 57000, 43000, 29000, 21000, 4000, 100]
  15. y_right = [elem/1000 for elem in y_right_ms]
  16.  
  17. x_BR = [100, 110, 120]
  18. y_BR=[63000, 45000, 30500]
  19.  
  20. #original 101.5
  21. #higher heap 118
  22.  
  23. stable_region_x = [80, 90, 100, 101.5]
  24. stable_region_y = [TIMEOUT_THD] * len(stable_region_x)
  25.  
  26. stable_region_x_right = [80, 90, 100, 110, 117.3]
  27. stable_region_y_right = [TIMEOUT_THD] * len(stable_region_x)
  28.  
  29. ax = plt.gca()
  30. ax.set_xlim([x[0], x[-1]])
  31. ax.set_ylim([0, TIMEOUT_THD])
  32.  
  33. plt.plot(x, y, "--")
  34. plt.plot(x, y_right, color = 'black')
  35.  
  36. plt.fill_between(x, y, color='orange')
  37. plt.fill_between(x, y, TIMEOUT_THD, color='red')
  38. plt.fill_between(stable_region_x, stable_region_y, color='skyblue')
  39. #plt.fill_between(x, y, y_right, color='red', hatch=r'//', edgecolor='orange')
  40.  
  41. #plt.fill_between(x_BR, y_BR, )
  42. #Blue and Orange
  43. stable_range_x = [101.5, 117.3]
  44. stable_range_y = [60, 34.8875]
  45. stable_range_max_y = [60, 60]
  46.  
  47. plt.rcParams["hatch.linewidth"] = 4
  48. plt.fill_between(stable_range_x, stable_range_y,hatch=r"//", color = "skyblue", edgecolor="orange")
  49. plt.fill_between(stable_range_x, stable_range_y, stable_range_max_y ,hatch=r"//", color = "skyblue", edgecolor="red")
  50.  
  51.  
  52. vulnerable_range_x = [117.3, 170]
  53. vulnerable_range_y = [34.8875, 0]
  54. vulnerable_range_max_y = [60, 60]
  55.  
  56. x = [117.3, 120, 130, 140, 150, 160, 170]
  57. y_right_ms = [ 60000, 57000, 43000, 29000, 21000, 4000, 100]
  58. y_right = [elem/1000 for elem in y_right_ms]
  59.  
  60.  
  61. y_ms = [ 34887.5, 30500, 20500, 9250, 2350, 0, 0] #assuming 1min timeout threshold
  62. y = [elem/1000 for elem in y_ms]
  63. print(y)
  64. plt.fill_between(x, y, y_right , hatch=r"//", color = "red", edgecolor="orange")
  65. #plt.fill_between(vulnerable_range_x, vulnerable_range_y, vulnerable_range_max_y ,hatch=r"//", color = "skyblue", edgecolor="red")
  66.  
  67.  
  68.  
  69. plt.xlabel('Requests per second', fontsize = 9)
  70. plt.ylabel('Trigger duration (s)',fontsize = 9)
  71.  
  72. t0= plt.text(82.5, TIMEOUT_THD/2, 'Stable\nregion', weight = 'bold')
  73. t0.set_bbox(dict(facecolor='skyblue', alpha=0.6, edgecolor='skyblue'))
  74.  
  75. t1= plt.text(135, 0.75*TIMEOUT_THD, 'Metastable failure\nregion', weight = 'bold')
  76.  
  77. t2= plt.text(103, 5, 'Vulnerable region', weight = 'bold')
  78. t2.set_bbox(dict(facecolor='orange', alpha=0.6, edgecolor='orange'))
  79.  
  80.  
  81. figure = plt.gcf()
  82. figure.set_size_inches(4, 2.2)
  83. plt.savefig("test.png", dpi = 400)
  84.  
  85. t3 = plt.text(135, 6, "Max heap size: 384MB", rotation = -41.5 ,color = "white" , weight='bold')
  86. t3.set_bbox(dict(facecolor='black', alpha=0.4, edgecolor='black'))
  87.  
  88. t4= plt.text(110, 7, "Max heap size: 256MB", weight='bold', rotation = -41.5 , color = "white")
  89. t4.set_bbox(dict(facecolor='black', alpha=0.4, edgecolor='black'))
  90.  
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement