X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_plots.py;h=dd0093941508e6bfcd742bf41e72481fdae8ad00;hp=815f45884f8e6c90b05de9aea5f5237f546591ab;hb=4bc1e70ad02b198a7b9ea32b72da3ae98978e8c5;hpb=98a94315dae63bd19c7bc16ce50b3219386aa34c diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py index 815f45884f..dd00939415 100644 --- a/resources/tools/presentation/generator_plots.py +++ b/resources/tools/presentation/generator_plots.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -77,7 +77,8 @@ def generate_plots(spec, data): u"plot_tsa_name": plot_tsa_name, u"plot_http_server_perf_box": plot_http_server_perf_box, u"plot_nf_heatmap": plot_nf_heatmap, - u"plot_hdrh_lat_by_percentile": plot_hdrh_lat_by_percentile + u"plot_hdrh_lat_by_percentile": plot_hdrh_lat_by_percentile, + u"plot_hdrh_lat_by_percentile_x_log": plot_hdrh_lat_by_percentile_x_log } logging.info(u"Generating the plots ...") @@ -172,14 +173,10 @@ def plot_hdrh_lat_by_percentile(plot, input_data): for color, graph in enumerate(graphs): for idx, direction in enumerate((u"direction1", u"direction2")): - xaxis = [0.0, ] - yaxis = [0.0, ] - hovertext = [ - f"{desc[graph]}
" - f"Direction: {(u'W-E', u'E-W')[idx % 2]}
" - f"Percentile: 0.0%
" - f"Latency: 0.0uSec" - ] + previous_x = 0.0 + xaxis = list() + yaxis = list() + hovertext = list() try: decoded = hdrh.histogram.HdrHistogram.decode( test[u"latency"][graph][direction][u"hdrh"] @@ -192,16 +189,25 @@ def plot_hdrh_lat_by_percentile(plot, input_data): for item in decoded.get_recorded_iterator(): percentile = item.percentile_level_iterated_to - if percentile > 99.9: + if percentile > 99.9999999: continue + xaxis.append(previous_x) + yaxis.append(item.value_iterated_to) + hovertext.append( + f"{desc[graph]}
" + f"Direction: {(u'W-E', u'E-W')[idx % 2]}
" + f"Percentile: {previous_x:.5f}-{percentile:.5f}%
" + f"Latency: {item.value_iterated_to}uSec" + ) xaxis.append(percentile) yaxis.append(item.value_iterated_to) hovertext.append( f"{desc[graph]}
" f"Direction: {(u'W-E', u'E-W')[idx % 2]}
" - f"Percentile: {percentile:.5f}%
" + f"Percentile: {previous_x:.5f}-{percentile:.5f}%
" f"Latency: {item.value_iterated_to}uSec" ) + previous_x = percentile fig.add_trace( plgo.Scatter( x=xaxis, @@ -212,7 +218,8 @@ def plot_hdrh_lat_by_percentile(plot, input_data): showlegend=bool(idx), line=dict( color=COLORS[color], - dash=u"dash" if idx % 2 else u"solid" + dash=u"solid", + width=1 if idx % 2 else 2 ), hovertext=hovertext, hoverinfo=u"text" @@ -332,6 +339,8 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data): for color, graph in enumerate(graphs): for idx, direction in enumerate((u"direction1", u"direction2")): + previous_x = 0.0 + prev_perc = 0.0 xaxis = list() yaxis = list() hovertext = list() @@ -349,14 +358,25 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data): percentile = item.percentile_level_iterated_to if percentile > 99.9999999: continue - xaxis.append(100.0 / (100.0 - percentile)) + xaxis.append(previous_x) + yaxis.append(item.value_iterated_to) + hovertext.append( + f"{desc[graph]}
" + f"Direction: {(u'W-E', u'E-W')[idx % 2]}
" + f"Percentile: {prev_perc:.5f}-{percentile:.5f}%
" + f"Latency: {item.value_iterated_to}uSec" + ) + next_x = 100.0 / (100.0 - percentile) + xaxis.append(next_x) yaxis.append(item.value_iterated_to) hovertext.append( f"{desc[graph]}
" f"Direction: {(u'W-E', u'E-W')[idx % 2]}
" - f"Percentile: {percentile:.5f}%
" + f"Percentile: {prev_perc:.5f}-{percentile:.5f}%
" f"Latency: {item.value_iterated_to}uSec" ) + previous_x = next_x + prev_perc = percentile fig.add_trace( plgo.Scatter( x=xaxis, @@ -367,7 +387,8 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data): showlegend=not(bool(idx)), line=dict( color=COLORS[color], - dash=u"dash" if idx % 2 else u"solid" + dash=u"solid", + width=1 if idx % 2 else 2 ), hovertext=hovertext, hoverinfo=u"text"