sentry: export cpuTime function.

PiperOrigin-RevId: 214798278
Change-Id: Id59d1ceb35037cda0689d3a1c4844e96c6957615
This commit is contained in:
Zhaozhong Ni
2018-09-27 12:52:25 -07:00
committed by Shentubot
parent b514ab0589
commit 234f36b6f2
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -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)
}
+2 -1
View File
@@ -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 {