blob: b044bd7b15cae9aaf6a68f459d55fca79a14e47a [file] [log] [blame]
"""Test Module to perform an extra execution of the benchmark in the AIX
hpmcount tool."""
from litsupport import shellcommand
from litsupport import testplan
from litsupport.modules import run_under
import os
def _mutateCommandLine(context, commandline):
context.profilefile = context.tmpBase + ".hpmcount_data"
# Storing profile file in context allows other modules to be aware of it.
cmd = shellcommand.parse(commandline)
cmd.wrap("hpmcount", ["-o", context.profilefile])
if cmd.stdout is None:
cmd.stdout = os.devnull
else:
cmd.stdout += ".hpmcount"
if cmd.stderr is None:
cmd.stderr = os.devnull
else:
cmd.stderr += ".hpmcount"
return cmd.toCommandline()
def mutatePlan(context, plan):
script = context.parsed_runscript
if context.config.run_under:
script = testplan.mutateScript(context, script, run_under.mutateCommandLine)
script = testplan.mutateScript(context, script, _mutateCommandLine)
plan.profilescript += script
plan.metric_collectors.append(lambda context: {"profile": context.profilefile})