summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/harness/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/benchmarks/harness/util.go')
-rw-r--r--test/benchmarks/harness/util.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/benchmarks/harness/util.go b/test/benchmarks/harness/util.go
index eda2eeffb..bc551c582 100644
--- a/test/benchmarks/harness/util.go
+++ b/test/benchmarks/harness/util.go
@@ -36,3 +36,11 @@ func WaitUntilServing(ctx context.Context, machine Machine, server net.IP, port
}, "sh", "-c", cmd)
return err
}
+
+// DropCaches drops caches on the provided machine. Requires root.
+func DropCaches(machine Machine) error {
+ if out, err := machine.RunCommand("/bin/sh", "-c", "sync | sysctl vm.drop_caches=3"); err != nil {
+ return fmt.Errorf("failed to drop caches: %v logs: %s", err, out)
+ }
+ return nil
+}