mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-24 06:27:39 +00:00
metrics: Add env files for FIO
This PR adds the env files for FIO for kata metrics. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
parent
a45900324d
commit
6177a0db3e
9
tests/metrics/storage/fio-k8s/pkg/env/Makefile
vendored
Normal file
9
tests/metrics/storage/fio-k8s/pkg/env/Makefile
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2021 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
gomod:
|
||||||
|
GO111MODULE=on go mod edit -replace=github.com/kata-containers/tests/metrics/exec=../exec
|
||||||
|
GO111MODULE=on go mod tidy
|
39
tests/metrics/storage/fio-k8s/pkg/env/env.go
vendored
Normal file
39
tests/metrics/storage/fio-k8s/pkg/env/env.go
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (c) 2021 Intel Corporation
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
package env
|
||||||
|
|
||||||
|
import (
|
||||||
|
exec "github.com/kata-containers/tests/metrics/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
//logger interface for pkg
|
||||||
|
var log logger
|
||||||
|
var Debug bool = false
|
||||||
|
|
||||||
|
type logger interface {
|
||||||
|
Infof(string, ...interface{})
|
||||||
|
Debugf(string, ...interface{})
|
||||||
|
Errorf(string, ...interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetLogger(l logger) {
|
||||||
|
log = l
|
||||||
|
}
|
||||||
|
|
||||||
|
var sysDropCachesPath = "/proc/sys/vm/drop_caches"
|
||||||
|
|
||||||
|
func DropCaches() (err error) {
|
||||||
|
log.Infof("drop caches")
|
||||||
|
_, err = exec.ExecCmd("sync", Debug)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = exec.ExecCmd("echo 3 | sudo tee "+sysDropCachesPath, Debug)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user