summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/state/state_unsafe.go
diff options
context:
space:
mode:
authorZhaozhong Ni <nzz@google.com>2018-09-27 10:41:28 -0700
committerShentubot <shentubot@google.com>2018-09-27 12:52:25 -0700
commit234f36b6f2cb0db74d119079e5244619d6ea38ad (patch)
tree5047824f7ab217f1eb887dbdf27c2f389a9ab482 /pkg/sentry/state/state_unsafe.go
parentb514ab05897bca53c1d4f71c912f2977b3134daf (diff)
sentry: export cpuTime function.
PiperOrigin-RevId: 214798278 Change-Id: Id59d1ceb35037cda0689d3a1c4844e96c6957615
Diffstat (limited to 'pkg/sentry/state/state_unsafe.go')
-rw-r--r--pkg/sentry/state/state_unsafe.go3
1 files changed, 2 insertions, 1 deletions
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 {