diff options
author | John Howard <jhoward@microsoft.com> | 2019-03-12 17:49:05 -0700 |
---|---|---|
committer | John Howard <jhoward@microsoft.com> | 2019-03-12 18:41:55 -0700 |
commit | 2f27332836afbd114f942458459751e278a8ac25 (patch) | |
tree | 5a5ba3aa9141be71d77dcda4285c4ef9af708f81 /libcontainerd | |
parent | 8de5db1c00cb810936b757193e6eb18a07bcdf21 (diff) | |
download | docker-2f27332836afbd114f942458459751e278a8ac25.tar.gz |
Windows: Implement docker top for containerd
Signed-off-by: John Howard <jhoward@microsoft.com>
Diffstat (limited to 'libcontainerd')
-rw-r--r-- | libcontainerd/local/local_windows.go | 12 | ||||
-rw-r--r-- | libcontainerd/remote/client_windows.go | 14 | ||||
-rw-r--r-- | libcontainerd/types/types_windows.go | 4 |
3 files changed, 21 insertions, 9 deletions
diff --git a/libcontainerd/local/local_windows.go b/libcontainerd/local/local_windows.go index 7bbf7c87ca..ce7eae7d0b 100644 --- a/libcontainerd/local/local_windows.go +++ b/libcontainerd/local/local_windows.go @@ -1138,7 +1138,17 @@ func (c *client) Summary(_ context.Context, containerID string) ([]libcontainerd pl := make([]libcontainerdtypes.Summary, len(p)) for i := range p { - pl[i] = libcontainerdtypes.Summary(p[i]) + pl[i] = libcontainerdtypes.Summary{ + ImageName: p[i].ImageName, + CreatedAt: p[i].CreateTimestamp, + KernelTime_100Ns: p[i].KernelTime100ns, + MemoryCommitBytes: p[i].MemoryCommitBytes, + MemoryWorkingSetPrivateBytes: p[i].MemoryWorkingSetPrivateBytes, + MemoryWorkingSetSharedBytes: p[i].MemoryWorkingSetSharedBytes, + ProcessID: p[i].ProcessId, + UserTime_100Ns: p[i].UserTime100ns, + ExecID: "", + } } return pl, nil } diff --git a/libcontainerd/remote/client_windows.go b/libcontainerd/remote/client_windows.go index 2d9cdf9fdc..d6885622f9 100644 --- a/libcontainerd/remote/client_windows.go +++ b/libcontainerd/remote/client_windows.go @@ -6,8 +6,9 @@ import ( "os" "path/filepath" + "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" "github.com/containerd/containerd/cio" - "github.com/containerd/containerd/windows/hcsshimtypes" + libcontainerdtypes "github.com/docker/docker/libcontainerd/types" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" @@ -17,16 +18,17 @@ const runtimeName = "io.containerd.runhcs.v1" func summaryFromInterface(i interface{}) (*libcontainerdtypes.Summary, error) { switch pd := i.(type) { - case *hcsshimtypes.ProcessDetails: + case *options.ProcessDetails: return &libcontainerdtypes.Summary{ - CreateTimestamp: pd.CreatedAt, ImageName: pd.ImageName, - KernelTime100ns: pd.KernelTime_100Ns, + CreatedAt: pd.CreatedAt, + KernelTime_100Ns: pd.KernelTime_100Ns, MemoryCommitBytes: pd.MemoryCommitBytes, MemoryWorkingSetPrivateBytes: pd.MemoryWorkingSetPrivateBytes, MemoryWorkingSetSharedBytes: pd.MemoryWorkingSetSharedBytes, - ProcessId: pd.ProcessID, - UserTime100ns: pd.UserTime_100Ns, + ProcessID: pd.ProcessID, + UserTime_100Ns: pd.UserTime_100Ns, + ExecID: pd.ExecID, }, nil default: return nil, errors.Errorf("Unknown process details type %T", pd) diff --git a/libcontainerd/types/types_windows.go b/libcontainerd/types/types_windows.go index 8f8982275b..3b521f1342 100644 --- a/libcontainerd/types/types_windows.go +++ b/libcontainerd/types/types_windows.go @@ -4,10 +4,10 @@ import ( "time" "github.com/Microsoft/hcsshim" + "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" ) -// Summary contains a ProcessList item from HCS to support `top` -type Summary hcsshim.ProcessListItem +type Summary options.ProcessDetails // Stats contains statistics from HCS type Stats struct { |