diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/state/state_metadata.go | 2 | ||||
-rw-r--r-- | pkg/sentry/state/state_unsafe.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pkg/sentry/state/state_metadata.go b/pkg/sentry/state/state_metadata.go index b6d3dbcb4..afa21672a 100644 --- a/pkg/sentry/state/state_metadata.go +++ b/pkg/sentry/state/state_metadata.go @@ -28,7 +28,7 @@ const ( ) func addSaveMetadata(m map[string]string) { - t, err := cpuTime() + t, err := CPUTime() if err != nil { log.Warningf("Error getting cpu time: %v", err) } diff --git a/pkg/sentry/state/state_unsafe.go b/pkg/sentry/state/state_unsafe.go index 53814ef70..3ff7d24c8 100644 --- a/pkg/sentry/state/state_unsafe.go +++ b/pkg/sentry/state/state_unsafe.go @@ -23,7 +23,8 @@ import ( "gvisor.googlesource.com/gvisor/pkg/abi/linux" ) -func cpuTime() (time.Duration, error) { +// CPUTime returns the CPU time usage by Sentry and app. +func CPUTime() (time.Duration, error) { var ts syscall.Timespec _, _, errno := syscall.RawSyscall(syscall.SYS_CLOCK_GETTIME, uintptr(linux.CLOCK_PROCESS_CPUTIME_ID), uintptr(unsafe.Pointer(&ts)), 0) if errno != 0 { |