Exemple #1
0
    def plot_gossip_rate(self):
        sequences = analysis.gossip_events(self.events)
        for i in xrange(len(sequences)):
            # don't want to bucket by address
            sequences[i] = [t for t,src,dst in sequences[i]]

        legend = self.leaf_projections
        
        scalar = 1./len(self.unique_addresses)
        xyvals = [analysis.frequency_count(self, 
                                           sequence, 
                                           subdivisions=5, 
                                           bucket_scalar = scalar)  
                  for sequence in sequences]

        ylabel = "Fraction of nodes initiating gossip"
        xlabel = "Time (rounds)"
        ipython.analysis_plot_2d_multiple(xyvals, xlabel, ylabel, legend)
Exemple #2
0
    def plot_notable_events(self, ne_suffix):
        import matplotlib.pyplot as plt
        import numpy as np

        ne_categories = {}  # key -> sequence

        for key, timestamp, address in self.notable_events(ne_suffix):
            if key not in ne_categories:
                ne_categories[key] = []
            ne_categories[key].append(timestamp)
        
        notable_sequences = sorted(ne_categories.items())

        xlabel =  "Round"
        ylabel = "Rate (%s events per round)" % ne_suffix
        legend_labels = []
        xyvals = []

        for key, sequence in notable_sequences:
            legend_labels += [key]
            xy = analysis.frequency_count(self, sequence, subdivisions=5)
            xyvals += [xy]

        ipython.analysis_plot_2d_multiple(xyvals, xlabel, ylabel, legend_labels)