top_windows.go 863 B

1234567891011121314151617181920212223242526272829303132
  1. package daemon
  2. import (
  3. "errors"
  4. "strconv"
  5. "github.com/docker/engine-api/types"
  6. )
  7. // ContainerTop is a minimal implementation on Windows currently.
  8. // TODO Windows: This needs more work, but needs platform API support.
  9. // All we can currently return (particularly in the case of Hyper-V containers)
  10. // is a PID and the command.
  11. func (daemon *Daemon) ContainerTop(containerID string, psArgs string) (*types.ContainerProcessList, error) {
  12. // It's really not an equivalent to linux 'ps' on Windows
  13. if psArgs != "" {
  14. return nil, errors.New("Windows does not support arguments to top")
  15. }
  16. s, err := daemon.containerd.Summary(containerID)
  17. if err != nil {
  18. return nil, err
  19. }
  20. procList := &types.ContainerProcessList{}
  21. for _, v := range s {
  22. procList.Titles = append(procList.Titles, strconv.Itoa(int(v.Pid))+" "+v.Command)
  23. }
  24. return procList, nil
  25. }