master
go 41 lines 739 Bytes
Raw
1 //go:build windows
2
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 package ndexec
6
7 import (
8 "os"
9 "time"
10 )
11
12 // ResourceUsage captures OS-reported resource counters for a completed process.
13 type ResourceUsage struct {
14 User time.Duration
15 System time.Duration
16 MaxRSSBytes int64
17 ReadBytes int64
18 WriteBytes int64
19 }
20
21 func (u ResourceUsage) totalCPU() time.Duration {
22 return u.User + u.System
23 }
24
25 func extractUsage(ps *os.ProcessState) ResourceUsage {
26 // Windows doesn't expose POSIX rusage fields; return zeroed usage.
27 return ResourceUsage{}
28 }
29
30 func convertMaxRSS(raw int64) int64 {
31 return raw
32 }
33
34 const blockSize = 512
35
36 func blocksToBytes(blocks int64) int64 {
37 if blocks <= 0 {
38 return 0
39 }
40 return blocks * blockSize
41 }