From 6716e51e3a27cfd2850a399c9ccc2818c2038eaf Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Mon, 27 Jan 2020 15:24:08 +0100 Subject: [PATCH] PAL: Add latency by percentile graph Change-Id: I38c03e089fd709afc848ecec55474d5c6925a58e Signed-off-by: Tibor Frank --- .../test_environment_sut_calib_tsh.rst | 2 + resources/tools/presentation/generator_plots.py | 152 ++++++++++++++++++++- resources/tools/presentation/input_data_parser.py | 4 +- resources/tools/presentation/specification.yaml | 91 ++++++++++++ 4 files changed, 245 insertions(+), 4 deletions(-) diff --git a/docs/report/introduction/test_environment_sut_calib_tsh.rst b/docs/report/introduction/test_environment_sut_calib_tsh.rst index 139d30fd50..00447b9fd9 100644 --- a/docs/report/introduction/test_environment_sut_calib_tsh.rst +++ b/docs/report/introduction/test_environment_sut_calib_tsh.rst @@ -78,3 +78,5 @@ System-level Core Jitter 160022 169610 9588 160044 160022 173162 2580611072 3204390608 28 160022 169254 9232 160044 160022 173162 1492189184 3204399760 29 160022 169386 9364 160046 160022 173162 403767296 3204417762 30 + +.. include:: ../introduction/test_environment_sut_meltspec_tsh.rst diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py index ba10ea6da6..da015ddf10 100644 --- a/resources/tools/presentation/generator_plots.py +++ b/resources/tools/presentation/generator_plots.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 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: @@ -60,7 +60,8 @@ def generate_plots(spec, data): u"plot_http_server_perf_box": plot_http_server_perf_box, u"plot_nf_heatmap": plot_nf_heatmap, u"plot_lat_hdrh_bar_name": plot_lat_hdrh_bar_name, - u"plot_lat_hdrh_percentile": plot_lat_hdrh_percentile + u"plot_lat_hdrh_percentile": plot_lat_hdrh_percentile, + u"plot_hdrh_lat_by_percentile": plot_hdrh_lat_by_percentile } logging.info(u"Generating the plots ...") @@ -183,6 +184,153 @@ def plot_lat_hdrh_percentile(plot, input_data): logging.error(f" Finished with error: {repr(err)}") +def plot_hdrh_lat_by_percentile(plot, input_data): + """Generate the plot(s) with algorithm: plot_hdrh_lat_by_percentile + specified in the specification file. + + :param plot: Plot to generate. + :param input_data: Data to process. + :type plot: pandas.Series + :type input_data: InputData + """ + + # Transform the data + logging.info( + f" Creating the data set for the {plot.get(u'type', u'')} " + f"{plot.get(u'title', u'')}." + ) + data = input_data.filter_tests_by_name( + plot, params=[u"latency", u"throughput", u"parent", u"tags", u"type"]) + if data is None or len(data[0][0]) == 0: + logging.error(u"No data.") + return + + graphs = [ + u"LAT0", + u"PDR10", + u"PDR50", + u"PDR90", + u"NDR", + u"PDR" + ] + + for test in data[0][0]: + try: + if test[u"type"] not in (u"NDRPDR",): + logging.warning(f"Invalid test type: {test[u'type']}") + continue + name = re.sub(REGEX_NIC, u"", test[u"parent"]. + replace(u'-ndrpdr', u'').replace(u'2n1l-', u'')) + + logging.info(f" Generating the graph: {name}") + + pdr = test[u"throughput"][u"PDR"][u"LOWER"] + ndr = test[u"throughput"][u"NDR"][u"LOWER"] + + desc = { + u"LAT0": u"No load", + u"PDR10": f"10% PDR background traffic ({(pdr*1e-7):.2f}Mpps)", + u"PDR50": f"50% PDR background traffic ({(pdr*5e-7):.2f}Mpps)", + u"PDR90": f"90% PDR background traffic ({(pdr*9e-7):.2f}Mpps)", + u"PDR": f"100% PDR background traffic ({(pdr*1e-6):.2f}Mpps)", + u"NDR10": f"10% NDR background traffic ({(ndr*1e-7):.2f}Mpps)", + u"NDR50": f"50% NDR background traffic ({(ndr*5e-7):.2f}Mpps)", + u"NDR90": f"90% NDR background traffic ({(ndr*9e-7):.2f}Mpps)", + u"NDR": f"100% NDR background traffic ({(ndr*1e-6):.2f}Mpps)" + } + + fig = make_subplots( + rows=1, + cols=2, + column_widths=[0.5, 0.5], + shared_xaxes=True, + subplot_titles=( + u"Direction: W-E", + u"Direction: E-W" + ), + specs=[[{"type": "scatter"}, {"type": "scatter"}], ] + ) + layout = deepcopy(plot[u"layout"]) + + for color, graph in enumerate(graphs): + for idx, direction in enumerate((u"direction1", u"direction2")): + xaxis = list() + yaxis = list() + hovertext = list() + decoded = hdrh.histogram.HdrHistogram.decode( + test[u"latency"][graph][direction][u"hdrh"] + ) + for item in decoded.get_recorded_iterator(): + percentile = item.percentile_level_iterated_to + xaxis.append((100.0 / (100.0 - percentile)) + if percentile != 100.0 else 1e6) + yaxis.append(item.value_iterated_to) + hovertext.append( + f"{desc[graph]}
" + f"Percentile: {percentile:.5f}%
" + f"Latency: {item.value_iterated_to}uSec" + ) + fig.add_trace( + plgo.Scatter( + x=xaxis, + y=yaxis, + name=desc[graph], + mode=u"lines", + legendgroup=desc[graph], + showlegend=bool(idx), + line=dict( + color=COLORS[color] + ), + hovertext=hovertext, + hoverinfo=u"text" + ), + row=1, + col=idx + 1, + ) + fig.update_xaxes( + row=1, + col=idx + 1, + **layout[u"xaxis"] + ) + fig.update_yaxes( + row=1, + col=idx + 1, + **layout[u"yaxis"] + ) + try: + del layout[u"xaxis"] + except KeyError: + pass + try: + del layout[u"yaxis"] + except KeyError: + pass + + layout[u"title"][u"text"] = f"Latency: {name}" + fig.update_layout(layout) + + # Create plot + file_name = (f"{plot[u'output-file']}-" + f"{name}" + f"{plot.get(u'output-file-type', u'.html')}") + logging.info(f" Writing file {file_name}") + + try: + # Export Plot + ploff.plot(fig, show_link=False, auto_open=False, + filename=file_name) + except PlotlyError as err: + logging.error(f" Finished with error: {repr(err)}") + + except hdrh.codec.HdrLengthException as err: + logging.warning(repr(err)) + continue + + except (ValueError, KeyError) as err: + logging.warning(repr(err)) + continue + + def plot_lat_hdrh_bar_name(plot, input_data): """Generate the plot(s) with algorithm: plot_lat_hdrh_bar_name specified in the specification file. diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py index eeabaa8557..574f4950de 100644 --- a/resources/tools/presentation/input_data_parser.py +++ b/resources/tools/presentation/input_data_parser.py @@ -654,9 +654,9 @@ class ExecutionChecker(ResultVisitor): }, } - groups = re.search(self.REGEX_NDRPDR_LAT, msg) + groups = re.search(self.REGEX_NDRPDR_LAT_LONG, msg) if groups is None: - groups = re.search(self.REGEX_NDRPDR_LAT_LONG, msg) + groups = re.search(self.REGEX_NDRPDR_LAT, msg) if groups is None: return latency, u"FAIL" diff --git a/resources/tools/presentation/specification.yaml b/resources/tools/presentation/specification.yaml index 910d1e9a4d..ad6c3ed289 100644 --- a/resources/tools/presentation/specification.yaml +++ b/resources/tools/presentation/specification.yaml @@ -1605,6 +1605,63 @@ paper_bgcolor: "white" plot_bgcolor: "white" + plot-hdrh-latency-by-percentile: + title: + text: "Latency by Percentile Distribution" + xanchor: "center" + x: 0.5 + font: + size: 18 + showlegend: True + legend: + traceorder: "normal" + orientation: "h" + font: + size: 16 + xanchor: "left" + yanchor: "top" + x: 0 + y: -0.2 + bgcolor: "rgba(255, 255, 255, 0)" + bordercolor: "rgba(255, 255, 255, 0)" + xaxis: + type: "log" + title: "Percentile [%]" + titlefont: + size: 14 + autorange: False + fixedrange: False + range: [1e-6, 3] + gridcolor: "rgb(230, 230, 230)" + linecolor: "rgb(220, 220, 220)" + linewidth: 1 + showgrid: True + showline: True + showticklabels: True + tickcolor: "rgb(220, 220, 220)" + tickvals: [1, 2, 1e1, 20, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8] + tickangle: 315 + ticktext: [0, 50, 90, 95, 99, 99.9, 99.99, 99.999, 99.9999, 99.99999, 99.999999] + tickfont: + size: 14 + yaxis: + title: "Packet Latency [uSec]" + titlefont: + size: 14 + gridcolor: "rgb(230, 230, 230)" + linecolor: "rgb(220, 220, 220)" + linewidth: 1 + showgrid: True + showline: True + showticklabels: True + tickcolor: "rgb(220, 220, 220)" + tickfont: + size: 14 + width: 700 + height: 700 + paper_bgcolor: "white" + plot_bgcolor: "white" + - type: "static" src-path: "{DIR[RST]}" dst-path: "{DIR[WORKING,SRC]}" @@ -22611,3 +22668,37 @@ - "tests.dpdk.perf.2n1l-10ge2p1x710-ethip4-ip4base-l3fwd-ndrpdr.64b-8t4c-ethip4-ip4base-l3fwd-ndrpdr" layout: layout: "plot-hdrh-latency-percentile" + +- type: "plot" + title: "Latency by percentile: 2n-skx-xxv710" + algorithm: "plot_hdrh_lat_by_percentile" + output-file: "{DIR[STATIC,VPP]}/2n-skx-xxv710-hdrh-lat-percentile" + data: "plot-vpp-hdrh-lat-2n-skx" + include: + - "Tests.Vpp.Perf.Ip4.2N1L-25Ge2P1Xxv710-Dot1Q-Ip4Base-Ndrpdr.64B-2t1c-dot1q-ip4base-ndrpdr" + - "Tests.Vpp.Perf.Ip4.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Base-Ndrpdr.64B-2t1c-ethip4-ip4base-ndrpdr" + - "Tests.Vpp.Perf.Ip4.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Scale20K-Ndrpdr.64B-2t1c-ethip4-ip4scale20k-ndrpdr" + - "Tests.Vpp.Perf.Ip4.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Scale200K-Ndrpdr.64B-2t1c-ethip4-ip4scale200k-ndrpdr" + - "Tests.Vpp.Perf.Ip4.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Scale2M-Ndrpdr.64B-2t1c-ethip4-ip4scale2m-ndrpdr" + - "Tests.Vpp.Perf.Container Memif.2N1L-25Ge2P1Xxv710-Eth-L2Xcbase-Eth-2Memif-1Dcr-Ndrpdr.64B-2t1c-eth-l2xcbase-eth-2memif-1dcr-ndrpdr" + - "Tests.Vpp.Perf.Container Memif.2N1L-25Ge2P1Xxv710-Dot1Q-L2Bdbasemaclrn-Eth-2Memif-1Dcr-Ndrpdr.64B-2t1c-dot1q-l2bdbasemaclrn-eth-2memif-1dcr-ndrpdr" + - "Tests.Vpp.Perf.Container Memif.2N1L-25Ge2P1Xxv710-Eth-L2Bdbasemaclrn-Eth-2Memif-1Dcr-Ndrpdr.64B-2t1c-eth-l2bdbasemaclrn-eth-2memif-1dcr-ndrpdr" + - "Tests.Vpp.Perf.Container Memif.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Base-Eth-2Memif-1Dcr-Ndrpdr.64B-2t1c-ethip4-ip4base-eth-2memif-1dcr-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Avf-Eth-L2Xcbase-Ndrpdr.64B-2t1c-avf-eth-l2xcbase-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Avf-Dot1Q-L2Bdbasemaclrn-Ndrpdr.64B-2t1c-avf-dot1q-l2bdbasemaclrn-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Avf-Eth-L2Bdbasemaclrn-Ndrpdr.64B-2t1c-avf-eth-l2bdbasemaclrn-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Dot1Q-L2Bdbasemaclrn-Ndrpdr.64B-2t1c-dot1q-l2bdbasemaclrn-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Eth-L2Bdbasemaclrn-Ndrpdr.64B-2t1c-eth-l2bdbasemaclrn-ndrpdr" + - "Tests.Vpp.Perf.L2.2N1L-10Ge2P1X710-Eth-L2Bdscale1Mmaclrn-Ndrpdr.64B-2t1c-eth-l2bdscale1mmaclrn-ndrpdr" + - "Tests.Vpp.Perf.L2.25Ge2P1Xxv710-Eth-L2Bdbasemaclrn-Ndrpdr.64B-2t1c-eth-l2bdbasemaclrn-ndrpdr" + - "Tests.Vpp.Perf.Vm Vhost.2N1L-25Ge2P1Xxv710-Eth-L2Xcbase-Eth-2Vhostvr1024-1Vm-Ndrpdr.64B-2t1c-eth-l2xcbase-eth-2vhostvr1024-1vm-ndrpdr" + - "Tests.Vpp.Perf.Vm Vhost.2N1L-25Ge2P1Xxv710-Dot1Q-L2Bdbasemaclrn-Eth-2Vhostvr1024-1Vm-Ndrpdr.64B-2t1c-dot1q-l2bdbasemaclrn-eth-2vhostvr1024-1vm-ndrpdr" + - "Tests.Vpp.Perf.Vm Vhost.2N1L-25Ge2P1Xxv710-Eth-L2Bdbasemaclrn-Eth-2Vhostvr1024-1Vm-Ndrpdr.64B-2t1c-eth-l2bdbasemaclrn-eth-2vhostvr1024-1vm-ndrpdr" + - "Tests.Vpp.Perf.Vm Vhost.2N1L-25Ge2P1Xxv710-Ethip4-Ip4Base-Eth-2Vhostvr1024-1Vm-Ndrpdr.64B-2t1c-ethip4-ip4base-eth-2vhostvr1024-1vm-ndrpdr" + - "Tests.Vpp.Perf.Ip6.2N1L-25Ge2P1Xxv710-Dot1Q-Ip6Base-Ndrpdr.78B-2t1c-dot1q-ip6base-ndrpdr" + - "Tests.Vpp.Perf.Ip6.2N1L-25Ge2P1Xxv710-Ethip6-Ip6Base-Ndrpdr.78B-2t1c-ethip6-ip6base-ndrpdr" + - "Tests.Vpp.Perf.Ip6.2N1L-25Ge2P1Xxv710-Ethip6-Ip6Scale20K-Ndrpdr.78B-2t1c-ethip6-ip6scale20k-ndrpdr" + - "Tests.Vpp.Perf.Ip6.2N1L-25Ge2P1Xxv710-Ethip6-Ip6Scale200K-Ndrpdr.78B-2t1c-ethip6-ip6scale200k-ndrpdr" + - "Tests.Vpp.Perf.Ip6.2N1L-25Ge2P1Xxv710-Ethip6-Ip6Scale2M-Ndrpdr.78B-2t1c-ethip6-ip6scale2m-ndrpdr" + layout: + layout: "plot-hdrh-latency-by-percentile" -- 2.16.6