forked from adamlaska/moby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtop_windows.go
More file actions
32 lines (25 loc) · 863 Bytes
/
top_windows.go
File metadata and controls
32 lines (25 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package daemon
import (
"errors"
"strconv"
"github.com/docker/engine-api/types"
)
// ContainerTop is a minimal implementation on Windows currently.
// TODO Windows: This needs more work, but needs platform API support.
// All we can currently return (particularly in the case of Hyper-V containers)
// is a PID and the command.
func (daemon *Daemon) ContainerTop(containerID string, psArgs string) (*types.ContainerProcessList, error) {
// It's really not an equivalent to linux 'ps' on Windows
if psArgs != "" {
return nil, errors.New("Windows does not support arguments to top")
}
s, err := daemon.containerd.Summary(containerID)
if err != nil {
return nil, err
}
procList := &types.ContainerProcessList{}
for _, v := range s {
procList.Titles = append(procList.Titles, strconv.Itoa(int(v.Pid))+" "+v.Command)
}
return procList, nil
}