Skip to content

Commit

Permalink
Add plugin order setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Bechberger committed Aug 2, 2019
1 parent 9216300 commit 320f412
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
7 changes: 7 additions & 0 deletions doc/temci_exec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ flags are of the schema ``--SETTING/--no-SETTING``):
runs: Int()
default: -1
# Order in which the plugins are used, plugins that do not appear in this list are used before all others
plugin_order: ListOrTuple(Str())
default: ["drop_fs_caches", "sync", "sleep", "preheat", "flush_cpu_caches"]
# If not empty, recipient of a mail after the benchmarking finished.
send_mail: Str()
Expand Down Expand Up @@ -731,6 +735,9 @@ plugins already available:
:ref:`sync`
Synchronizes cached writes of the file system to a persistent storage
The order in which the plugins are used (and called) is defined by the ``run/plugin_order``, see
:ref:`common-options`.
cpu_governor
~~~~~~~~~~~~
Sets the CPU governor of all CPU cores.
Expand Down
12 changes: 10 additions & 2 deletions temci/run/run_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,10 @@ def _match_return_code(self, error_messages: _Err, cmd: str, err: str, exptected
// Description("Enable other plugins by default: {}".format("; ".join("{} = {} ({})".format(k, *t) for k, t in PRESET_PLUGIN_MODES.items()))),
"parse_output": Bool() // Default(False) // Description("Parse the program output as a YAML dictionary of "
"that gives for a specific property a measurement. "
"Not all runners support it.")
"Not all runners support it."),
"plugin_order": ListOrTuple(Str()) // Default(["drop_fs_caches", "sync", "sleep", "preheat", "flush_cpu_caches"])
// Description("Order in which the plugins are used, plugins that do not "
"appear in this list are used before all others")
}, unknown_keys=True))
class ExecRunDriver(AbstractRunDriver):
"""
Expand Down Expand Up @@ -770,12 +773,17 @@ def get_used_plugins(self) -> t.List[str]:
for plugin in PRESET_PLUGIN_MODES[self.misc_settings["preset"]][0].split(","):
if plugin not in used and plugin is not "":
used.append(plugin)
order = self.misc_settings["plugin_order"]
used = sorted(used, key=lambda plugin: order.index(plugin) if plugin in order else -1)
return used


@register(RunDriverRegistry, "shell", Dict({
"preset": ExactEither(*PRESET_PLUGIN_MODES.keys()) // Default("none")
// Description("Enable other plugins by default: {}".format("; ".join("{} = {} ({})".format(k, *t) for k, t in PRESET_PLUGIN_MODES.items())))
// Description("Enable other plugins by default: {}".format("; ".join("{} = {} ({})".format(k, *t) for k, t in PRESET_PLUGIN_MODES.items()))),
"plugin_order": ListOrTuple(Str()) // Default(["drop_fs_caches", "sync", "sleep", "preheat", "flush_cpu_caches"])
// Description("Order in which the plugins are used, plugins that do not "
"appear in this list are used before all others")
}, unknown_keys=True))
class ShellRunDriver(ExecRunDriver):
"""
Expand Down
4 changes: 2 additions & 2 deletions temci/run/run_driver_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ class FlushCPUCaches(AbstractRunDriverPlugin):
needs_root_privileges = True

def setup_block_run(self, block: RunProgramBlock):
setup.exec("cpu_cache/flush", "insmod flush_cache.ko")
setup.exec("cpu_cache/flush", "rmmod flush_cache.ko")
block["cmd_prefix"].append("insmod {c}/flush_cache.ko; rmmod {c}/flush_cache.ko"
.format(c=setup.script_relative("cpu_cache/flush")))


@register(ExecRunDriver, "cpu_governor", Dict({
Expand Down

0 comments on commit 320f412

Please sign in to comment.