From 41729bc51fe37cb5959e4e951e83b1895fe3e9cf Mon Sep 17 00:00:00 2001 From: Samir Mulani Date: Fri, 28 Jun 2024 14:27:28 +0530 Subject: [PATCH] Added support to run the lockstorm benchmark multiple times Added support to capture and run the lockstorm_benchmark multiple times. For this introduced new .yaml parameter test_iter. Signed-off-by: Samir Mulani --- cpu/lockstorm_benchmark.py | 30 ++++++++++--------- .../lockstorm.yaml | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cpu/lockstorm_benchmark.py b/cpu/lockstorm_benchmark.py index aae1f6959..d73a1e1b7 100644 --- a/cpu/lockstorm_benchmark.py +++ b/cpu/lockstorm_benchmark.py @@ -45,6 +45,7 @@ def setUp(self): self.cancel(f'{package} is needed for the test to be run') self.cpu_list = self.params.get("cpu_list", default=0) + self.test_iter = self.params.get("test_iter", default=5) url = "https://github.com/npiggin/lockstorm.git" git.get_repo(url, branch='master', destination_dir=self.workdir) @@ -57,8 +58,8 @@ def capture_dmesg_dump(self, smt_state): """ This function capture the spinlock performance stats from dmesg. - :param smt_state: Here we are passing the smt state that we are going to - change. + :param smt_state: Here we are passing the smt state that we are + going to change. """ cmd = "dmesg | tail -n 1" self.log.info(f"=================Dump data for \ @@ -76,19 +77,20 @@ def test(self): process.run('ppc64_cpu --cores-on=all', shell=True) process.run('ppc64_cpu --smt=on', shell=True) cpu_controller = ["2", "4", "6", "on", "off"] - for smt_mode in cpu_controller: - cmd = "ppc64_cpu --smt={}".format(smt_mode) - self.log.info(f"=======smt mode {smt_mode}=======") - process.run(cmd, shell=True) - cmd = "insmod ./lockstorm.ko" + " cpulist=%s" % \ - (self.cpu_list) + for test_run in range(self.test_iter): + self.log.info("Test iteration %s " % (test_run)) + for smt_mode in cpu_controller: + cmd = "ppc64_cpu --smt={}".format(smt_mode) + self.log.info(f"=======smt mode {smt_mode}=======") + process.run(cmd, shell=True) + cmd = "insmod ./lockstorm.ko" + " cpulist=%s" % \ + (self.cpu_list) - if self.cpu_list == 0: - cmd = "insmod ./lockstorm.ko" - - process.system(cmd, - ignore_status=True, shell=False, sudo=True) - self.capture_dmesg_dump(smt_mode) + if self.cpu_list == 0: + cmd = "insmod ./lockstorm.ko" + process.system(cmd, + ignore_status=True, shell=False, sudo=True) + self.capture_dmesg_dump(smt_mode) def tearDown(self): """ diff --git a/cpu/lockstorm_benchmark.py.data/lockstorm.yaml b/cpu/lockstorm_benchmark.py.data/lockstorm.yaml index 991a8b7d2..51b9dd370 100644 --- a/cpu/lockstorm_benchmark.py.data/lockstorm.yaml +++ b/cpu/lockstorm_benchmark.py.data/lockstorm.yaml @@ -1 +1,2 @@ cpu_list: +test_iter: