// Copyright 2026 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build unix package main import ( "syscall" "time" ) // cpuTime returns the user and system CPU time used by this process. func cpuTime() (time.Duration, bool) { var ru syscall.Rusage if err := syscall.Getrusage(syscall.RUSAGE_SELF, &ru); err != nil { return 0, false } return time.Duration(ru.Utime.Nano() + ru.Stime.Nano()), true }