def main(): scp_log = "scp-loss-test.log" filesize, delay, scp_points = common.parse_log(scp_log) scp_x, scp_y, scp_yerr = common.get_statistics(scp_points) print "got statistics for scp" tor_log = "tor-loss-test.log" filesize, delay, tor_points = common.parse_log(tor_log) tor_x, tor_y, tor_yerr = common.get_statistics(tor_points) print "got statistics for tornado" scp_x = [100 * x for x in scp_x] tor_x = [100 * x for x in tor_x] print scp_yerr print tor_yerr plt.errorbar(scp_x, scp_y, yerr=scp_yerr, linewidth=3, label="scp") print "plot scp" plt.errorbar(tor_x, tor_y, yerr=tor_yerr, linewidth=3, label="tornado") print "plot tor" # plt.plot(*zip(*scp_points), ls='--', marker='o', ms=15, mew=3, \ # fillstyle='none',linewidth=3, label='scp') # plt.plot(*zip(*tor_points), ls='--', marker='^', ms=15, mew=3, \ # fillstyle='none',linewidth=3, label='tornado') plt.xlabel("Link loss %") plt.ylabel("Completion time (seconds)") plt.title("Filesize : %d MBytes\nLink delay %d ms, bandwidth 12 Mbits/s" % (int(filesize), int(delay)), fontsize=20) plt.legend(loc="best") plt.xlim(-0.5, 5.5) plt.tight_layout() plt.savefig("loss-plot.pdf")
def endElement(self, name): if name == "desc": self.index += 1 self.indesc = False assert len(self.seqs) == 1 assert len(self.date) == 1 assert len(self.desc) == 1 seqs = self.seqs.pop() date = self.date.pop() desc = self.desc.pop() quarter = get_quarter(date) stat = get_statistics(desc) stat_criteria = get_criteria_one(desc) if not statistics.has_key(quarter): statistics[quarter] = [] for i in range(len(VULNERABILITY)): statistics[quarter].append(0) statistics[quarter][stat] += 1 if not statistics_compare.has_key(quarter): statistics_compare[quarter] = [] for i in range(len(CRITERIA)): statistics_compare[quarter].append(0) statistics_compare[quarter][stat_criteria] += 1 print "[{}] {} [{},{}] - {} - {}".format( self.index, quarter, seqs, date, statistics[quarter], statistics_compare[quarter])
def endElement(self, name): if name == "desc": self.index += 1 self.indesc = False assert len(self.seqs) == 1 assert len(self.date) == 1 assert len(self.desc) == 1 seqs = self.seqs.pop() date = self.date.pop() desc = self.desc.pop() quarter = get_quarter(date) stat = get_statistics(desc) stat_criteria = get_criteria_one(desc) if not statistics.has_key(quarter): statistics[quarter] = [] for i in range(len(VULNERABILITY)): statistics[quarter].append(0) statistics[quarter][stat] += 1 if not statistics_compare.has_key(quarter): statistics_compare[quarter] = [] for i in range(len(CRITERIA)): statistics_compare[quarter].append(0) statistics_compare[quarter][stat_criteria] += 1 print "[{}] {} [{},{}] - {} - {}".format(self.index, quarter, seqs,date, statistics[quarter], statistics_compare[quarter])
def main(): scp_log = "scp-delay-test.log" filesize, loss, scp_points = common.parse_log(scp_log) scp_x, scp_y, scp_yerr = common.get_statistics(scp_points) tor_log = "tor-delay-test.log" filesize, loss, tor_points = common.parse_log(tor_log) tor_x, tor_y, tor_yerr = common.get_statistics(tor_points) plt.errorbar(scp_x, scp_y, yerr=scp_yerr, linewidth=3, label='scp') plt.errorbar(tor_x, tor_y, yerr=tor_yerr, linewidth=3, label='tornado') #plt.plot(*zip(*scp_points), ls='--', marker='o', ms=15, mew=3, \ # fillstyle='none',linewidth=3, label='scp') #plt.plot(*zip(*tor_points), ls='--', marker='^', ms=15, mew=3, \ # fillstyle='none',linewidth=3, label='tornado') plt.xlabel('Link delay (ms)') plt.ylabel('Completion time (s)') plt.xlim(-10, 110) plt.title('Filesize %d MBytes\nLink loss %.2f%%, bandwidth 12 Mbits/s' % (int(filesize), loss*100), fontsize=20) plt.legend(loc='best') plt.tight_layout() plt.savefig('delay-plot.pdf')
def endElement(self, name): if name == "vuln:published-datetime": self.indate = False if name == "vuln:summary": self.index += 1 self.indesc = False if len(self.date) > 1: print self.date del self.date[-1] raw_input("analyze pls") assert len(self.seqs) == 1 assert len(self.date) == 1 assert len(self.desc) == 1 seqs = self.seqs.pop() date = self.date.pop() desc = self.desc.pop() quarter = get_quarter(date) stat = get_statistics(desc) stat_criteria = get_criteria_one(desc) if not statistics.has_key(quarter): statistics[quarter] = [] for i in range(len(VULNERABILITY)): statistics[quarter].append(0) statistics[quarter][stat] += 1 if not statistics_compare.has_key(quarter): statistics_compare[quarter] = [] for i in range(len(CRITERIA)): statistics_compare[quarter].append(0) statistics_compare[quarter][stat_criteria] += 1 print "[{}] {} [{},{}] - {} - {}".format( self.index, quarter, seqs, date, statistics[quarter], statistics_compare[quarter])
def endElement(self, name): if name == "vuln:published-datetime": self.indate = False if name == "vuln:summary": self.index += 1 self.indesc = False if len(self.date) > 1: print self.date del self.date[-1] raw_input("analyze pls") assert len(self.seqs) == 1 assert len(self.date) == 1 assert len(self.desc) == 1 seqs = self.seqs.pop() date = self.date.pop() desc = self.desc.pop() quarter = get_quarter(date) stat = get_statistics(desc) stat_criteria = get_criteria_one(desc) if not statistics.has_key(quarter): statistics[quarter] = [] for i in range(len(VULNERABILITY)): statistics[quarter].append(0) statistics[quarter][stat] += 1 if not statistics_compare.has_key(quarter): statistics_compare[quarter] = [] for i in range(len(CRITERIA)): statistics_compare[quarter].append(0) statistics_compare[quarter][stat_criteria] += 1 print "[{}] {} [{},{}] - {} - {}".format(self.index, quarter, seqs,date, statistics[quarter], statistics_compare[quarter])