[dts][PATCH V1] tests/vm2vm_virtio_pmd_*: perf top command optimization

Dukai Yuan dukaix.yuan at intel.com
Mon May 29 18:00:26 CEST 2023


Using the command perf top -p <pid> > <log_file> can monitor only the specified PID process and record its output to a file, 
which can avoid mixing information from other processes in the output file 
and enable us to better monitor the performance of the specified process.

Signed-off-by: Dukai Yuan <dukaix.yuan at intel.com>
---
 tests/TestSuite_dpdk_gro_lib_cbdma.py     | 3 ++-
 tests/TestSuite_vm2vm_virtio_pmd_cbdma.py | 3 ++-
 tests/TestSuite_vm2vm_virtio_pmd_dsa.py   | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/TestSuite_dpdk_gro_lib_cbdma.py b/tests/TestSuite_dpdk_gro_lib_cbdma.py
index 23a55686..0ce250ef 100644
--- a/tests/TestSuite_dpdk_gro_lib_cbdma.py
+++ b/tests/TestSuite_dpdk_gro_lib_cbdma.py
@@ -155,7 +155,8 @@ class TestDPDKGROLibCbdma(TestCase):
 
     def get_and_verify_func_name_of_perf_top(self, func_name_list):
         self.dut.send_expect("rm -fr perf_top.log", "# ", 120)
-        self.dut.send_expect("perf top > perf_top.log", "", 120)
+        pid = self.dut.send_expect("pidof dpdk-testpmd", "# ", 120)
+        self.dut.send_expect("perf top -p %s > perf_top.log" % pid, "", 120)
         time.sleep(10)
         self.dut.send_expect("^C", "#")
         out = self.dut.send_expect("cat perf_top.log", "# ", 120)
diff --git a/tests/TestSuite_vm2vm_virtio_pmd_cbdma.py b/tests/TestSuite_vm2vm_virtio_pmd_cbdma.py
index 0507e9ca..76508939 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd_cbdma.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd_cbdma.py
@@ -165,7 +165,8 @@ class TestVM2VMVirtioPmdCBDMA(TestCase):
 
     def get_and_verify_func_name_of_perf_top(self, func_name_list):
         self.dut.send_expect("rm -fr perf_top.log", "# ", 120)
-        self.dut.send_expect("perf top > perf_top.log", "", 120)
+        pid = self.dut.send_expect("pidof dpdk-testpmd", "# ", 120)
+        self.dut.send_expect("perf top -p %s > perf_top.log" % pid, "", 120)
         time.sleep(10)
         self.dut.send_expect("^C", "#")
         out = self.dut.send_expect("cat perf_top.log", "# ", 120)
diff --git a/tests/TestSuite_vm2vm_virtio_pmd_dsa.py b/tests/TestSuite_vm2vm_virtio_pmd_dsa.py
index 6ae9f165..34d62ada 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd_dsa.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd_dsa.py
@@ -208,7 +208,8 @@ class TestVM2VMVirtioPmdDsa(TestCase):
     def get_and_verify_func_name_of_perf_top(self, func_name_list):
         time.sleep(10)
         self.dut.send_expect("rm -fr perf_top.log", "# ", 120)
-        self.dut.send_expect("perf top > perf_top.log", "", 120)
+        pid = self.dut.send_expect("pidof dpdk-testpmd", "# ", 120)
+        self.dut.send_expect("perf top -p %s > perf_top.log" % pid, "", 120)
         time.sleep(30)
         self.dut.send_expect("^C", "#")
         out = self.dut.send_expect("cat perf_top.log", "# ", 120)
-- 
2.31.1



More information about the dts mailing list