66 "fmt"
77 "time"
88
9- containertypes "github.com/docker/docker/api/types/container"
9+ "github.com/docker/docker/api/types/container"
1010 libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
1111 "github.com/docker/go-units"
1212)
@@ -26,27 +26,27 @@ import (
2626// task manager does and use the private working set as the memory counter.
2727// We could return more info for those who really understand how memory
2828// management works in Windows if we introduced a "raw" stats (above).
29- func (daemon * Daemon ) ContainerTop (name string , psArgs string ) (* containertypes. ContainerTopOKBody , error ) {
29+ func (daemon * Daemon ) ContainerTop (name string , psArgs string ) (* container. TopResponse , error ) {
3030 // It's not at all an equivalent to linux 'ps' on Windows
3131 if psArgs != "" {
3232 return nil , errors .New ("Windows does not support arguments to top" )
3333 }
3434
35- container , err := daemon .GetContainer (name )
35+ ctr , err := daemon .GetContainer (name )
3636 if err != nil {
3737 return nil , err
3838 }
3939
4040 task , err := func () (libcontainerdtypes.Task , error ) {
41- container .Lock ()
42- defer container .Unlock ()
41+ ctr .Lock ()
42+ defer ctr .Unlock ()
4343
44- task , err := container .GetRunningTask ()
44+ task , err := ctr .GetRunningTask ()
4545 if err != nil {
4646 return nil , err
4747 }
48- if container .Restarting {
49- return nil , errContainerIsRestarting (container .ID )
48+ if ctr .Restarting {
49+ return nil , errContainerIsRestarting (ctr .ID )
5050 }
5151 return task , nil
5252 }()
@@ -55,8 +55,9 @@ func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes.
5555 if err != nil {
5656 return nil , err
5757 }
58- procList := & containertypes.ContainerTopOKBody {}
59- procList .Titles = []string {"Name" , "PID" , "CPU" , "Private Working Set" }
58+ procList := & container.TopResponse {
59+ Titles : []string {"Name" , "PID" , "CPU" , "Private Working Set" },
60+ }
6061
6162 for _ , j := range s {
6263 d := time .Duration ((j .KernelTime_100Ns + j .UserTime_100Ns ) * 100 ) // Combined time in nanoseconds
0 commit comments