From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C3EFA0613 for ; Fri, 30 Aug 2019 10:42:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 695811E8B2; Fri, 30 Aug 2019 10:42:12 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id F13B51E8AD for ; Fri, 30 Aug 2019 10:42:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2019 01:42:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,446,1559545200"; d="scan'208";a="197992377" Received: from unknown (HELO dpdk-zengxx-tester.localdomain) ([10.240.176.145]) by fmsmga001.fm.intel.com with ESMTP; 30 Aug 2019 01:42:08 -0700 From: Xiaoxiao Zeng To: dts@dpdk.org Cc: Xiaoxiao Zeng Date: Sat, 31 Aug 2019 04:42:08 +0800 Message-Id: <20190830204208.7111-1-xiaoxiaox.zeng@intel.com> X-Mailer: git-send-email 2.17.0 Subject: [dts] [PATCH V1] tests/TestSuite_multiprocess: add case test_perf_multiprocess_performance X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" add testcase test_perf_multiprocess_performance *.according to testplan, add test_perf_multiprocess_performance code Signed-off-by: Xiaoxiao Zeng --- tests/TestSuite_multiprocess.py | 127 ++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 24 deletions(-) diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py index b690d81..4a4743e 100644 --- a/tests/TestSuite_multiprocess.py +++ b/tests/TestSuite_multiprocess.py @@ -37,6 +37,7 @@ Multi-process Test. import utils import time import os + executions = [] from test_case import TestCase from pktgen import PacketGeneratorHelper @@ -68,16 +69,17 @@ class TestMultiprocess(TestCase): executions.append({'nprocs': 4, 'cores': '1S/2C/2T', 'pps': 0}) executions.append({'nprocs': 4, 'cores': '1S/4C/1T', 'pps': 0}) executions.append({'nprocs': 8, 'cores': '1S/4C/2T', 'pps': 0}) - self.dut.alt_session.send_expect("cd dpdk","# ",5) + self.dut.alt_session.send_expect("cd dpdk", "# ", 5) # start new session to run secondary self.session_secondary = self.dut.new_session() + # get dts output path if self.logger.log_path.startswith(os.sep): self.output_path = self.logger.log_path else: cur_path = os.path.dirname( - os.path.dirname(os.path.realpath(__file__))) + os.path.dirname(os.path.realpath(__file__))) self.output_path = os.sep.join([cur_path, self.logger.log_path]) # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() @@ -95,23 +97,28 @@ class TestMultiprocess(TestCase): # Send message from secondary to primary cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100) + self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), + "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") - self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), "Finished Process Init", 100) + self.session_secondary.send_expect( + "./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), "Finished Process Init", + 100) self.session_secondary.send_expect("send hello_primary", ">") out = self.dut.get_session_output() self.session_secondary.send_expect("quit", "# ") - self.dut.send_expect("quit","# ") + self.dut.send_expect("quit", "# ") self.verify("Received 'hello_primary'" in out, "Message not received on primary process") # Send message from primary to secondary cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary " % (self.target, coremask), "Finished Process Init", 100) + self.session_secondary.send_expect( + "./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary " % (self.target, coremask), "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") - self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), "Finished Process Init", 100) + self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), + "Finished Process Init", 100) self.session_secondary.send_expect("send hello_secondary", ">") out = self.dut.get_session_output() self.session_secondary.send_expect("quit", "# ") @@ -127,10 +134,12 @@ class TestMultiprocess(TestCase): cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100) + self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), + "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") - self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), "Finished Process Init", 100) + self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=secondary" % (self.target, coremask), + "Finished Process Init", 100) stringsSent = 0 for line in open('/usr/share/dict/words', 'r').readlines(): line = line.split('\n')[0] @@ -151,11 +160,13 @@ class TestMultiprocess(TestCase): # Send message from secondary to primary (auto process type) cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - out = self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto " % (self.target, coremask), "Finished Process Init", 100) + out = self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto " % (self.target, coremask), + "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly") time.sleep(20) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") - out = self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) + out = self.session_secondary.send_expect( + "./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: SECONDARY" in out, "The type of process (SECONDARY) was not detected properly") @@ -168,13 +179,15 @@ class TestMultiprocess(TestCase): # Send message from primary to secondary (auto process type) cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - out = self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) + out = self.session_secondary.send_expect( + "./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly") time.sleep(20) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") - out = self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) + out = self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), + "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: SECONDARY" in out, "The type of process (SECONDARY) was not detected properly") - self.session_secondary.send_expect("send hello_secondary", ">",100) + self.session_secondary.send_expect("send hello_secondary", ">", 100) out = self.dut.get_session_output() self.session_secondary.send_expect("quit", "# ") self.dut.send_expect("quit", "# ") @@ -189,7 +202,8 @@ class TestMultiprocess(TestCase): cores = self.dut.get_core_list('1S/2C/1T') coremask = utils.create_mask(cores) - self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s -m 64" % (self.target, coremask), "Finished Process Init", 100) + self.session_secondary.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s -m 64" % (self.target, coremask), + "Finished Process Init", 100) coremask = hex(int(coremask, 16) * 0x10).rstrip("L") out = self.dut.send_expect("./examples/multi_process/simple_mp/%s/simple_mp -n 1 -c %s" % (self.target, coremask), "# ", 100) @@ -198,6 +212,66 @@ class TestMultiprocess(TestCase): self.session_secondary.send_expect("quit", "# ") + def test_perf_multiprocess_performance(self): + """ + Benchmark Multiprocess performance. + """ + packet_count = 16 + self.dut.kill_all() + self.dut.send_expect("fg", "# ") + dutPorts = self.dut.get_ports() + txPort = self.tester.get_local_port(dutPorts[0]) + rxPort = self.tester.get_local_port(dutPorts[1]) + mac = self.tester.get_mac(txPort) + dmac = self.dut.get_mac_address(dutPorts[0]) + tgenInput = [] + + for i in range(packet_count): + package = r'flows = [Ether(src="%s", dst="%s")/IP(src="192.168.1.%d", dst="192.168.1.%d")/("X"*26)]' % (mac, dmac, i + 1, i + 2) + self.tester.scapy_append(package) + pcap = os.sep.join([self.output_path, "test_%d.pcap"%i]) + self.tester.scapy_append('wrpcap("%s", flows)' % pcap) + tgenInput.append([txPort, rxPort, pcap]) + self.tester.scapy_execute() + + validExecutions = [] + for execution in executions: + if len(self.dut.get_core_list(execution['cores'])) == execution['nprocs']: + validExecutions.append(execution) + + portMask = utils.create_mask([dutPorts[0], dutPorts[1]]) + + for n in range(len(validExecutions)): + execution = validExecutions[n] + coreList = self.dut.get_core_list(execution['cores']) + coreMask = utils.create_mask(self.dut.get_core_list(execution['cores'])) + time.sleep(5) + self.dut_session = self.dut.new_session() + self.dut_session.send_expect( + "./examples/multi_process/symmetric_mp/%s/symmetric_mp -c %s --proc-type=auto -- -p %s --num-procs=%d --proc-id=%d" % ( + self.target, coreMask, portMask, execution['nprocs'], n), "Finished Process Init") + # clear streams before add new streams + self.tester.pktgen.clear_streams() + # run packet generator + streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, + None, self.tester.pktgen) + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) + + execution['pps'] = pps + #self.dut.kill_all() + time.sleep(5) + + for n in range(len(executions)): + self.verify(executions[n]['pps'] is not 0, "No traffic detected") + + self.result_table_create(['Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)']) + + for execution in validExecutions: + self.result_table_add( + [execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)]) + + self.result_table_print() + def test_perf_multiprocess_client_serverperformance(self): """ Benchmark Multiprocess client-server performance. @@ -227,14 +301,16 @@ class TestMultiprocess(TestCase): coreMask = utils.create_mask(self.dut.get_core_list('1S/1C/1T')) portMask = utils.create_mask([dutPorts[0], dutPorts[1]]) - self.dut.send_expect("./examples/multi_process/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d" % (self.target, self.dut.get_memory_channels(), "0xA0", portMask, execution['nprocs']), "Finished Process Init", 20) + self.dut.send_expect("./examples/multi_process/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d" % ( + self.target, self.dut.get_memory_channels(), "0xA0", portMask, execution['nprocs']), "Finished Process Init", 20) self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") for n in range(execution['nprocs']): time.sleep(5) coreMask = utils.create_mask([coreList[n]]) - self.dut.send_expect("./examples/multi_process/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d" % (self.target, self.dut.get_memory_channels(), coreMask, n), "Finished Process Init") + self.dut.send_expect("./examples/multi_process/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d" % ( + self.target, self.dut.get_memory_channels(), coreMask, n), "Finished Process Init") self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") @@ -245,7 +321,7 @@ class TestMultiprocess(TestCase): self.tester.pktgen.clear_streams() # run packet generator streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, - None, self.tester.pktgen) + None, self.tester.pktgen) _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) execution['pps'] = pps @@ -255,20 +331,23 @@ class TestMultiprocess(TestCase): for n in range(len(executions)): self.verify(executions[n]['pps'] is not 0, "No traffic detected") - self.result_table_create(['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)']) + self.result_table_create( + ['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', + 'Packet Rate(mpps)']) for execution in validExecutions: - self.result_table_add([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)]) + self.result_table_add([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), + execution['pps'] / float(1000000)]) self.result_table_print() def set_fields(self): ''' set ip protocol field behavior ''' fields_config = { - 'ip': { - 'src': {'range': 64, 'action': 'inc'}, - 'dst': {'range': 64, 'action': 'inc'}, - },} + 'ip': { + 'src': {'range': 64, 'action': 'inc'}, + 'dst': {'range': 64, 'action': 'inc'}, + }, } return fields_config -- 2.17.0