Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for lockstorm benchmark to dump data in special file. #2900

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions cpu/lockstorm_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from avocado.utils.software_manager.manager import SoftwareManager


def clear_dmesg():
process.run("dmesg -C ", sudo=True)


class lockstorm_benchmark(Test):
def setUp(self):
"""
Expand Down Expand Up @@ -61,10 +65,11 @@ def capture_dmesg_dump(self, smt_state):
:param smt_state: Here we are passing the smt state that we are
going to change.
"""
cmd = "dmesg | tail -n 1"
cmd = "dmesg | grep 'lockstorm: spinlock iterations'"
self.log.info(f"=================Dump data for \
SMT Mode: {smt_state} benchmark======================\n\n")
dump_data = process.run(cmd, shell=True)
return dump_data

def test(self):
"""
Expand All @@ -74,6 +79,8 @@ def test(self):
2.Running the lockstorm benchmark.
3. Capturing the benchmark stats.
"""
lockstorm_dir = self.logdir + "/lockstorm_benc"
os.makedirs(lockstorm_dir, exist_ok=True)
process.run('ppc64_cpu --cores-on=all', shell=True)
process.run('ppc64_cpu --smt=on', shell=True)
cpu_controller = ["2", "4", "6", "on", "off"]
Expand All @@ -85,12 +92,26 @@ def test(self):
process.run(cmd, shell=True)
cmd = "insmod ./lockstorm.ko" + " cpulist=%s" % \
(self.cpu_list)

clear_dmesg()
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)
lockstorm_data = self.capture_dmesg_dump(smt_mode)
stdout_output = lockstorm_data.stdout
lockstorm_log = lockstorm_dir + "/lockstorm.log"
with open(lockstorm_log, "a") as payload:
payload.write(
"==================Iteration {}=============\
\n".format(str(test_run)))
payload.write("============SMT mode: {}============= \
\n".format(smt_mode))
lines = stdout_output.splitlines()
for line in lines:
decoded_string = line.decode('utf-8')
cleaned_string = decoded_string.lstrip('\t')
payload.write(cleaned_string + '\n')
payload.write("\n")

def tearDown(self):
"""
Expand Down
Loading