test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Liu, Yong" <yong.liu@intel.com>
To: "Ding, HengX" <hengx.ding@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Ding, HengX" <hengx.ding@intel.com>
Subject: Re: [dts] [PATCH] l3fwd: enable rfc2544 test as a performance case.
Date: Wed, 23 Dec 2015 07:29:16 +0000	[thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10F94682@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1450773176-18622-1-git-send-email-hengx.ding@intel.com>

Hi Heng,
Two comments for make performance data more clear and readable.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Ding Heng
> Sent: Tuesday, December 22, 2015 4:33 PM
> To: dts@dpdk.org
> Cc: Ding, HengX
> Subject: [dts] [PATCH] l3fwd: enable rfc2544 test as a performance case.
> 
> Add RFC2544 test as a case in l3fwd. Made some change to framework.py to
> fix
> the run time not work issue.
> 
> Signed-off-by: Ding Heng <hengx.ding@intel.com>
> 
> diff --git a/framework/tester.py b/framework/tester.py
> index 210d54f..4dea0e3 100644
> --- a/framework/tester.py
> +++ b/framework/tester.py
> @@ -445,7 +445,7 @@ class Tester(Crb):
>          Run loss performance test on specified ports.
>          """
>          if self.check_port_list(portList, 'ixia'):
> -            return self.ixia_packet_gen.loss(portList, ratePercent)
> +            return self.ixia_packet_gen.loss(portList, ratePercent, delay)
>          elif not self.check_port_list(portList):
>              self.logger.warning("exception by mixed port types")
>              return None
> diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py
> index 0e09256..cd9c7cf 100644
> --- a/tests/TestSuite_l3fwd.py
> +++ b/tests/TestSuite_l3fwd.py
> @@ -227,7 +227,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>              for core in cores:
>                  core_ydata = []
>                  for row in data:
> -                    if row[5] == mode and row[2] == core:
> +                    if row[1] == mode and row[2] == core:
>                          core_ydata.append(float(row[4]))
Number is hard to understood, could you try to use variable replace of integer. 
It will be like below.
	mod_col=1
	Core_col = 2
	if raw[mode] == mode and row[core_col] == core:

> 
>                  mode_ydata.append(core_ydata)
> @@ -255,7 +255,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>              for frame_size in TestL3fwd.frame_sizes:
>                  for row in data:
>                      if row[2] == core and row[0] == frame_size and \
> -                            row[5] == mode:
> +                            row[1] == mode:
>                          mode_ydata.append(float(row[4]))
> 
>              ydata.append(mode_ydata)
> @@ -521,7 +521,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>          L3fwd main 2 ports.
>          """
> 
> -        header_row = ["Frame", "Ports", "S/C/T", "Mpps", "% linerate",
> "mode"]
> +        header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate"]
>          self.l3fwd_test_results['header'] = header_row
>          dts.results_table_add_header(header_row)
>          self.l3fwd_test_results['data'] = []
> @@ -533,7 +533,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>                  HEADER_SIZE['ip'] - HEADER_SIZE['eth']
>              for _port in range(2):
>                  dmac = self.dut.get_mac_address(valports[_port])
> -                flows = ['Ether(dst=%s)/%s/("X"*%d)' % (dmac, flow,
> payload_size) for flow in self.flows()[_port *2:(_port +1)*2]]
> +                flows = ['Ether(dst="%s")/%s/("X"*%d)' % (dmac, flow,
> payload_size) for flow in self.flows()[_port *2:(_port +1)*2]]
>                  self.tester.scapy_append('wrpcap("dst%d.pcap",
> [%s])' %(valports[_port],string.join(flows,',')))
>              self.tester.scapy_execute()
> 
> @@ -611,13 +611,113 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>                      # Stop l3fwd
>                      self.dut.send_expect("^C", "#")
> 
> -                    data_row = [frame_size, 2, cores, str(pps), str(pct),
> mode]
> +                    data_row = [frame_size, mode, cores, str(pps),
> str(pct)]
>                      dts.results_table_add_row(data_row)
>                      self.l3fwd_test_results['data'].append(data_row)
> 
>          self.plot_2_ports()
>          dts.results_table_print()
> 
> +    def test_perf_rfc2544(self):
> +
> +        header_row = ["Frame", "mode", "S/C/T", "LR_tx_pkts(1min)",
> "LR_rx_pkts(1min)", "LR_loss_pkts(1min)", "% zero_loss_rate"]
> +        self.l3fwd_test_results['header'] = header_row
> +        dts.results_table_add_header(header_row)
> +        self.l3fwd_test_results['data'] = []
> +
> +        for frame_size in TestL3fwd.frame_sizes:
> +
> +            # Prepare traffic flow
> +            payload_size = frame_size -  \
> +                HEADER_SIZE['ip'] - HEADER_SIZE['eth']
> +            for _port in range(2):
> +                dmac = self.dut.get_mac_address(valports[_port])
> +                flows = ['Ether(dst="%s")/%s/("X"*%d)' % (dmac, flow,
> payload_size) for flow in self.flows()[_port *2:(_port +1)*2]]
> +                self.tester.scapy_append('wrpcap("dst%d.pcap",
> [%s])' %(valports[_port],string.join(flows,',')))
> +            self.tester.scapy_execute()
> +
> +            dts.report("Flows for 2 ports, %d frame size.\n" %
> (frame_size),
> +                       annex=True)
> +            dts.report("%s" % string.join(flows, '\n'),
> +                       frame=True, annex=True)
> +
> +
> +            # Prepare the command line
> +            global corelist
> +            pat = re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")
> +
> +            pat2 = re.compile("C\{\d")
> +            repl1 = "C{" + str(self.port_socket)
> +
> +            coreMask = {}
> +            rtCmdLines = dict(TestL3fwd.test_cases_2_ports)
> +            for key in rtCmdLines.keys():
> +                corelist = []
> +                while pat.search(rtCmdLines[key]):
> +                    # Change the socket to the NIC's socket
> +                    if key.find('1S')>=0:
> +                        rtCmdLines[key] = pat2.sub(repl1, rtCmdLines[key])
> +                    rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
> +
> +                self.logger.info("%s\n" % str(corelist))
> +                coreMask[key] = dts.create_mask(set(corelist))
> +
> +            # measure by two different mode
> +            for mode in TestL3fwd.methods:
> +
> +                # start l3fwd
> +                index = 0
> +                subtitle = []
> +                for cores in rtCmdLines.keys():
> +
> +                    #in order to save time, only some of the cases will
> be run.
> +                    if mode == "lpm" and (cores == "1S/1C/1T" or cores ==
> "1S/4C/1T"):
> +                        info = "Executing l3fwd using %s mode, 2
> ports, %s and %d frame size.\n" % (
> +                               mode, cores, frame_size)
> +
> +                        self.logger.info(info)
> +                        dts.report(info, annex=True)
> +
> +                        subtitle.append(cores)
> +                        cmdline = rtCmdLines[cores] % (TestL3fwd.path +
> "l3fwd_" + mode, coreMask[cores],
> +
> self.dut.get_memory_channels(), dts.create_mask(valports[:2]))
> +
> +                        dts.report(cmdline + "\n", frame=True, annex=True)
> +
> +                        out = self.dut.send_expect(cmdline, "L3FWD:", 120)
> +
> +                        # Measure test
> +                        tgenInput = []
> +                        for rxPort in range(2):
> +                            # No use on rx/tx limitation
> +                            if rxPort % 2 == 0:
> +                                txIntf =
> self.tester.get_local_port(valports[rxPort + 1])
> +                            else:
> +                                txIntf =
> self.tester.get_local_port(valports[rxPort - 1])
> +
> +                            rxIntf =
> self.tester.get_local_port(valports[rxPort])
> +                            if rxPort % 2 == 0:
> +                                tgenInput.append((txIntf, rxIntf,
> "dst%d.pcap" %valports[rxPort+1]))
> +                            else:
> +                                tgenInput.append((txIntf, rxIntf,
> "dst%d.pcap" %valports[rxPort-1]))
> +
> +                        zero_loss_rate, tx_pkts, rx_pkts =
> self.tester.run_rfc2544(tgenInput, delay=60)
> +                        loss_pkts = tx_pkts - rx_pkts
> +                        self.dut.send_expect("^C", "#")

Better to add one function human_read_number() in framework/utils.py,  translate number to more readable format.
If tx_pkts > 1000000, return value will be xxx.xxxM.
If tx_pts > 1000 and < 1000000, return value will be xxx.xxxK
It tx_pkts < 1000, return value just xxx.
> +
> +                        tx_pkts /= 1000000
> +                        rx_pkts /= 1000000
> +
> +                        data_row = [frame_size, mode, cores,
> str(tx_pkts)+"M", str(rx_pkts)+"M", loss_pkts, zero_loss_rate]
> +                        dts.results_table_add_row(data_row)
> +                        self.l3fwd_test_results['data'].append(data_row)
> +                    else:
> +                        pass
> +
> +                    index += 1
> +
> +        dts.results_table_print()
> +
>      def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,
> version, flags, ihl, ttl, id):
>          self.add_tcl_cmd("protocol config -name ip")
>          self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src)
> --
> 1.9.3

      reply	other threads:[~2015-12-23  7:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  8:32 Ding Heng
2015-12-23  7:29 ` Liu, Yong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86228AFD5BCD8E4EBFD2B90117B5E81E10F94682@SHSMSX103.ccr.corp.intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    --cc=hengx.ding@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).