@@ -1447,15 +1447,18 @@ def get_digest(experiment):
14471447 digests [experiment ] = digest
14481448 return digest
14491449
1450- def start_slowdown_plot (title , max_y , x_experiment , size = 10 ,
1450+ def start_plot_vs_msg_length (title , y_range , x_experiment , size = 10 ,
14511451 show_top_label = True , show_bot_label = True , figsize = [6 ,4 ],
14521452 y_label = "Slowdown" , show_upper_x_axis = True ):
14531453 """
1454- Create a pyplot graph that will be used for slowdown data. Returns the
1455- Axes object for the plot.
1454+ Create a pyplot graph that will be used to display some value as a
1455+ function of message size, with the x-axis scaled so that distance
1456+ corresponds to cumulative number of messages.
14561457
14571458 title: Title for the plot; may be empty
1458- max_y: Maximum y-coordinate
1459+ y_range: Either a single value giving maximum y-coordinate
1460+ (min will be 1) or a list containing min and max
1461+ values. The y-axis will be log-scale.
14591462 x_experiment: Name of experiment whose rtt distribution will be used to
14601463 label the x-axis of the plot. None means don't label the
14611464 x-axis (caller will presumably invoke cdf_xaxis to do it).
@@ -1473,11 +1476,16 @@ def start_slowdown_plot(title, max_y, x_experiment, size=10,
14731476 ax .set_title (title , size = size )
14741477 ax .set_xlim (0 , 1.0 )
14751478 ax .set_yscale ("log" )
1476- ax .set_ylim (1 , max_y )
1479+ if isinstance (y_range , list ):
1480+ min_y , max_y = y_range
1481+ else :
1482+ min_y = 1
1483+ max_y = y_range
1484+ ax .set_ylim (min_y , max_y )
14771485 ax .tick_params (right = True , which = "both" , direction = "in" , length = 5 )
14781486 ticks = []
14791487 labels = []
1480- y = 1
1488+ y = 10 ** ( math . ceil ( math . log10 ( min_y )))
14811489 while y <= max_y :
14821490 ticks .append (y )
14831491 labels .append ("%d" % (y ))
@@ -1607,7 +1615,7 @@ def plot_slowdown(ax, experiment, percentile, label, **kwargs):
16071615
16081616 ax: matplotlib Axes object: info will be plotted here.
16091617 experiment: Name of the experiment whose data should be graphed.
1610- percentile: While percentile of slowdown to graph: must be "p50", "p99",
1618+ percentile: Which percentile of slowdown to graph: must be "p50", "p99",
16111619 or "p999"
16121620 label: Text to display in the graph legend for this curve
16131621 kwargs: Additional keyword arguments to pass through to plt.plot
@@ -1628,6 +1636,23 @@ def plot_slowdown(ax, experiment, percentile, label, **kwargs):
16281636 % (percentile ))
16291637 ax .plot (x , y , label = label , ** kwargs )
16301638
1639+ def plot_histogram (ax , experiment , metric , label , ** kwargs ):
1640+ """
1641+ Add a histogram to a plot created by start_plot_vs_msg_length().
1642+
1643+ ax: matplotlib Axes object: info will be plotted here.
1644+ experiment: Name of the experiment whose data should be graphed.
1645+ percentile: Metric from experiment to graph, such as "p50" for 50th
1646+ percentile latency or "slow_99" for 99th percentile
1647+ slowdown
1648+ label: Text to display in the graph legend for this curve
1649+ kwargs: Additional keyword arguments to pass through to plt.plot
1650+ """
1651+ digest = get_digest (experiment )
1652+ x , y = make_histogram (digest ["cum_frac" ], digest [metric ],
1653+ init = [0 , digest [metric ][0 ]], after = False )
1654+ ax .plot (x , y , label = label , ** kwargs )
1655+
16311656def start_cdf_plot (title , min_x , max_x , min_y , x_label , y_label ,
16321657 figsize = [5 , 4 ], size = 10 , xscale = "log" , yscale = "log" ):
16331658 """
0 commit comments