Skip to content
Snippets Groups Projects
Commit 390de018 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

simple-command: add support for dropping fs caches

parent 567b718b
No related tags found
1 merge request!41abiklity to drop fs cache
Pipeline #94774 failed
......@@ -187,6 +187,10 @@
self._data["simple-command"]["acceptable-return-codes"] = (
new_return_codes
)
dfsc = variants[selected].get("drop-fs-caches")
if dfsc is not None:
self._data["simple-command"]["drop-fs-caches"] = dfsc
@property
def all_dimensions(self):
......@@ -212,5 +216,6 @@
cmd.apply_data_env(data_env)
prepare = self.get_var("simple-command.prepare-run")
drop_fs_caches = self.get_var("simple-command.drop-fs-caches")
r = self._time_command(
......@@ -215,6 +220,11 @@
r = self._time_command(
bin_env_path, data_env_path, cmd, prepare, debug=debug
bin_env_path,
data_env_path,
cmd,
prepare=prepare,
drop_fs_caches=drop_fs_caches,
debug=debug,
)
res = {}
# we should store more
......@@ -227,7 +237,13 @@
return res
def _time_command(
self, bin_env_path, data_env_path, cmd, prepare=None, debug=False
self,
bin_env_path,
data_env_path,
cmd,
prepare=None,
drop_fs_caches=False,
debug=False,
):
bin_env_path = os.path.abspath(bin_env_path)
data_env_path = os.path.abspath(data_env_path)
......@@ -257,6 +273,12 @@
# If there are non-zero status codes, we will check them in
# post-processing.
time_cmd.append("--ignore-failure")
if drop_fs_caches:
drop_invocation = "sync && echo 3 > /proc/sys/vm/drop_caches"
if prepare is None:
prepare = drop_invocation
else:
prepare = f"{prepare};{drop_invocation}"
if debug:
time_cmd.append("--runs")
......
......@@ -22,6 +22,10 @@
/// Ignore command failure when running benchmark
accept_failure: Boolean = false
/// Whether to drop filesystem caches before each run.
/// This is done at the benchmark level, for all variants
drop_fs_caches: Boolean = false
///////////////////////////////////////////////////////////////////////////////
/// rendering as toml /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
......@@ -31,6 +35,9 @@
when (prepare_run != null) {
["prepare-run"] = prepare_run
}
when (drop_fs_caches) {
["drop-fs-caches"] = drop_fs_caches
}
when (accept_failure) {
["accept-failure"] = accept_failure
}
......@@ -103,6 +110,9 @@
/// return code that should be considered a success
acceptable_return_codes: Listing<Int>?
/// Whether to drop filesystem caches before each run.
drop_fs_caches: Boolean?
/// additional constraint on when this variant can be used
constraints: Constraints?
......@@ -123,6 +133,9 @@
when (acceptable_return_codes != null) {
["acceptable-return-codes"] = acceptable_return_codes
}
when (drop_fs_caches != null) {
["drop-fs-caches"] = drop_fs_caches
}
when (constraints != null) {
["constraints"] = constraints.as_v0
}
......
......@@ -371,5 +371,12 @@
}
}
}
["fs-caches"] {
default_key = "keep"
cases {
["keep"] {drop_fs_caches = false}
["drop"] {drop_fs_caches = true}
}
}
}
......@@ -105,3 +105,10 @@
[simple-command.variants.dimensions.range.from-1000th-tiprev]
extend-command = " --rev -1000"
[simple-command.variants.dimensions.fs-caches.keep]
default = true
drop-fs-caches = false
[simple-command.variants.dimensions.fs-caches.drop]
drop-fs-caches = true
......@@ -55,6 +55,6 @@
["from-1000th-tiprev"] {extend_command = " --rev -1000"}
}
}
["fs-caches"] = v.simple_command["fs-caches"]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment