Skip to content

Commit

Permalink
Added support to run cpu folding workload for specific time
Browse files Browse the repository at this point in the history
Here to run the CPU fold workload for a specific duration added runtime parameter using .yaml

Signed-off-by: Samir Mulani <[email protected]>
  • Loading branch information
SamirMulani committed Sep 3, 2024
1 parent 486aa8b commit 1d2d43c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion workload/cpu_fold.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,22 @@ def setUp(self):
for pkg in ['util-linux', 'powerpc-utils', 'numactl']:
if not sm.check_installed(pkg) and not sm.install(pkg):
self.cancel("%s is required to continue..." % pkg)
self.runtime = self.params.get('runtime', default='')

def test_cpu_start(self):
"""
Start the CPU Workload
"""
relative_path = 'cpu_fold.py.data/cpu.sh'
absolute_path = os.path.abspath(relative_path)
cpu_folding = "bash " + absolute_path + " &> /tmp/cpu_folding.log &"
cpu_folding = ""
if self.runtime == "":
cpu_folding = "bash " + absolute_path + \
" &> /tmp/cpu_folding.log &"
else:
cpu_folding = "timeout " + str(self.runtime) + "m" + " bash " + \
absolute_path + " &> /tmp/cpu_folding.log &"

process.run(cpu_folding, ignore_status=True, sudo=True, shell=True)
self.log.info("CPU Workload started--!!")

Expand Down
1 change: 1 addition & 0 deletions workload/cpu_fold.py.data/cpu_fold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: 1 # min

0 comments on commit 1d2d43c

Please sign in to comment.