blockages.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. from matplotlib.lines import Line2D
  4. fig, (axs, axs1) = plt.subplots(2, 4, figsize=(24, 12))
  5. fig.suptitle("Checking for Blockage and Migration to new Bridges for" +
  6. " Percentage of Bridges Blocked")
  7. columns = ["Percent", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  8. "ReTstdev", "ResponseHT", "RHTstdev"]
  9. df = pd.read_csv("check_blockage.csv", usecols=columns)
  10. df1 = pd.read_csv("migration.csv", usecols=columns)
  11. fig.supxlabel('Blocked Bridges (%)')
  12. axs[0].set_ylabel('Request Time (ms)')
  13. axs[0].set_ylim([0,70])
  14. l1 = axs[0].plot(df.Percent, df.RequestT, color='#CC4F1B',
  15. label='Request Time for Percentage of Bridges Blocked')
  16. axs[0].fill_between(df.Percent, df.RequestT-df.Rtstdev, df.RequestT+df.Rtstdev,
  17. alpha=0.5, edgecolor='#CC4F1B', facecolor='#FF9848')
  18. axs1[0].set_ylabel('Request Time (ms)')
  19. axs1[0].set_ylim([0,70])
  20. axs1[0].plot(df1.Percent, df1.RequestT, color='#1B2ACC',
  21. label='Request Time for Percentage of Bridges Blocked')
  22. axs1[0].fill_between(df1.Percent, df1.RequestT-df1.Rtstdev,
  23. df1.RequestT+df1.Rtstdev, alpha=0.2, edgecolor='#1B2ACC',
  24. facecolor='#089FFF')
  25. axs[1].set_ylabel('Response Time (ms)')
  26. axs[1].plot(df.Percent, df.ResponseT, color='#CC4F1B',
  27. label='Response Time for Percentage of Bridges Blocked')
  28. axs[1].fill_between(df.Percent, df.ResponseT-df.ReTstdev,
  29. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B',
  30. facecolor='#FF9848')
  31. axs1[1].set_ylabel('Response Time (ms)')
  32. axs1[1].set_ylim([0,70])
  33. axs1[1].plot(df1.Percent, df1.ResponseT, color='#1B2ACC',
  34. label='Response Time for Percentage of Bridges Blocked')
  35. axs1[1].fill_between(df1.Percent, df1.ResponseT-df1.ReTstdev,
  36. df1.ResponseT+df1.ReTstdev, alpha=0.2, edgecolor='#1B2ACC',
  37. facecolor='#089FFF')
  38. axs[2].set_ylabel('Response Size (ms)')
  39. axs[2].plot(df.Percent, df.ResponseS, color='#CC4F1B',
  40. label='Response Size for Percentage of Bridges Blocked')
  41. axs1[2].set_ylabel('Response Size (ms)')
  42. axs1[2].plot(df1.Percent, df1.ResponseS, color='#1B2ACC',
  43. label='Response Size for Percentage of Bridges Blocked')
  44. axs[3].set_ylabel('Response Handling Time (ms)')
  45. axs[3].plot(df.Percent, df.ResponseHT, color='#CC4F1B',
  46. label='Response Handling Time for Percentage of Bridges Blocked')
  47. axs[3].fill_between(df.Percent, df.ResponseHT-df.RHTstdev,
  48. df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#CC4F1B',
  49. facecolor='#FF9848')
  50. axs1[3].set_ylabel('Response Handling Time (ms)')
  51. axs1[3].set_ylim([0,70])
  52. axs1[3].plot(df1.Percent, df1.ResponseHT, color='#1B2ACC',
  53. label='Response Handling Time for Percentage of Bridges Blocked')
  54. axs1[3].fill_between(df1.Percent, df1.ResponseHT-df1.RHTstdev,
  55. df1.ResponseHT+df1.RHTstdev, alpha=0.2, edgecolor='#1B2ACC',
  56. facecolor='#089FFF')
  57. legend_elements = [Line2D([0], [0], color='#CC4F1B', label="Check Blockage Protocol"), Line2D([0], [0], color='#1B2ACC', label="Blockage Migration Protocol")]
  58. fig.legend(handles=legend_elements, loc='lower right')
  59. fig.savefig("Performance.pdf")