Merge pull request #1649 from mlaventure/win-procdetaisl-use-stdtime
windows: Use stdtime for hcsshimtypes.ProcessDetails.CreatedAt
This commit is contained in:
commit
3c89aafdc3
@ -19,7 +19,7 @@ import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
import _ "github.com/gogo/protobuf/types"
|
||||
import google_protobuf2 "github.com/gogo/protobuf/types"
|
||||
import _ "github.com/gogo/protobuf/types"
|
||||
|
||||
import time "time"
|
||||
|
||||
@ -53,14 +53,14 @@ func (*CreateOptions) Descriptor() ([]byte, []int) { return fileDescriptorHcsshi
|
||||
// ProcessDetails contains additional information about a process
|
||||
// ProcessDetails is made of the same fields as found in hcsshim.ProcessListItem
|
||||
type ProcessDetails struct {
|
||||
ImageName string `protobuf:"bytes,1,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"`
|
||||
CreatedAt *google_protobuf2.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt" json:"created_at,omitempty"`
|
||||
KernelTime_100Ns uint64 `protobuf:"varint,3,opt,name=kernel_time_100_ns,json=kernelTime100Ns,proto3" json:"kernel_time_100_ns,omitempty"`
|
||||
MemoryCommitBytes uint64 `protobuf:"varint,4,opt,name=memory_commit_bytes,json=memoryCommitBytes,proto3" json:"memory_commit_bytes,omitempty"`
|
||||
MemoryWorkingSetPrivateBytes uint64 `protobuf:"varint,5,opt,name=memory_working_set_private_bytes,json=memoryWorkingSetPrivateBytes,proto3" json:"memory_working_set_private_bytes,omitempty"`
|
||||
MemoryWorkingSetSharedBytes uint64 `protobuf:"varint,6,opt,name=memory_working_set_shared_bytes,json=memoryWorkingSetSharedBytes,proto3" json:"memory_working_set_shared_bytes,omitempty"`
|
||||
ProcessID uint32 `protobuf:"varint,7,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
|
||||
UserTime_100Ns uint64 `protobuf:"varint,8,opt,name=user_time_100_ns,json=userTime100Ns,proto3" json:"user_time_100_ns,omitempty"`
|
||||
ImageName string `protobuf:"bytes,1,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"`
|
||||
CreatedAt time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,stdtime" json:"created_at"`
|
||||
KernelTime_100Ns uint64 `protobuf:"varint,3,opt,name=kernel_time_100_ns,json=kernelTime100Ns,proto3" json:"kernel_time_100_ns,omitempty"`
|
||||
MemoryCommitBytes uint64 `protobuf:"varint,4,opt,name=memory_commit_bytes,json=memoryCommitBytes,proto3" json:"memory_commit_bytes,omitempty"`
|
||||
MemoryWorkingSetPrivateBytes uint64 `protobuf:"varint,5,opt,name=memory_working_set_private_bytes,json=memoryWorkingSetPrivateBytes,proto3" json:"memory_working_set_private_bytes,omitempty"`
|
||||
MemoryWorkingSetSharedBytes uint64 `protobuf:"varint,6,opt,name=memory_working_set_shared_bytes,json=memoryWorkingSetSharedBytes,proto3" json:"memory_working_set_shared_bytes,omitempty"`
|
||||
ProcessID uint32 `protobuf:"varint,7,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
|
||||
UserTime_100Ns uint64 `protobuf:"varint,8,opt,name=user_time_100_ns,json=userTime100Ns,proto3" json:"user_time_100_ns,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ProcessDetails) Reset() { *m = ProcessDetails{} }
|
||||
@ -118,16 +118,14 @@ func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) {
|
||||
i = encodeVarintHcsshim(dAtA, i, uint64(len(m.ImageName)))
|
||||
i += copy(dAtA[i:], m.ImageName)
|
||||
}
|
||||
if m.CreatedAt != nil {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintHcsshim(dAtA, i, uint64(m.CreatedAt.Size()))
|
||||
n2, err := m.CreatedAt.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintHcsshim(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)))
|
||||
n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
if m.KernelTime_100Ns != 0 {
|
||||
dAtA[i] = 0x18
|
||||
i++
|
||||
@ -203,10 +201,8 @@ func (m *ProcessDetails) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovHcsshim(uint64(l))
|
||||
}
|
||||
if m.CreatedAt != nil {
|
||||
l = m.CreatedAt.Size()
|
||||
n += 1 + l + sovHcsshim(uint64(l))
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)
|
||||
n += 1 + l + sovHcsshim(uint64(l))
|
||||
if m.KernelTime_100Ns != 0 {
|
||||
n += 1 + sovHcsshim(uint64(m.KernelTime_100Ns))
|
||||
}
|
||||
@ -257,7 +253,7 @@ func (this *ProcessDetails) String() string {
|
||||
}
|
||||
s := strings.Join([]string{`&ProcessDetails{`,
|
||||
`ImageName:` + fmt.Sprintf("%v", this.ImageName) + `,`,
|
||||
`CreatedAt:` + strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "google_protobuf2.Timestamp", 1) + `,`,
|
||||
`CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`,
|
||||
`KernelTime_100Ns:` + fmt.Sprintf("%v", this.KernelTime_100Ns) + `,`,
|
||||
`MemoryCommitBytes:` + fmt.Sprintf("%v", this.MemoryCommitBytes) + `,`,
|
||||
`MemoryWorkingSetPrivateBytes:` + fmt.Sprintf("%v", this.MemoryWorkingSetPrivateBytes) + `,`,
|
||||
@ -440,10 +436,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.CreatedAt == nil {
|
||||
m.CreatedAt = &google_protobuf2.Timestamp{}
|
||||
}
|
||||
if err := m.CreatedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
@ -692,35 +685,35 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorHcsshim = []byte{
|
||||
// 474 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x6e, 0xd3, 0x30,
|
||||
0x1c, 0xc6, 0x1b, 0x36, 0xc6, 0x62, 0x54, 0x60, 0x86, 0x43, 0x28, 0x90, 0x54, 0xbb, 0x50, 0x09,
|
||||
0x94, 0x74, 0x70, 0x42, 0x9c, 0x48, 0x2b, 0xa4, 0x5d, 0xc6, 0x94, 0x21, 0x21, 0x21, 0x24, 0xcb,
|
||||
0x4d, 0xfe, 0xa4, 0xd6, 0xea, 0x38, 0xb2, 0x5d, 0xaa, 0xde, 0x78, 0x0c, 0x1e, 0x82, 0x07, 0xe9,
|
||||
0x91, 0x23, 0xa7, 0xc1, 0xf2, 0x24, 0x28, 0xb6, 0x5b, 0x46, 0xe1, 0xc4, 0xcd, 0x7f, 0x7f, 0xbf,
|
||||
0xef, 0xfb, 0xd7, 0x5f, 0x83, 0x46, 0x25, 0xd3, 0xd3, 0xf9, 0x24, 0xce, 0x05, 0x4f, 0x72, 0x51,
|
||||
0x69, 0xca, 0x2a, 0x90, 0xc5, 0xd5, 0xe3, 0x82, 0x55, 0x85, 0x58, 0xa8, 0x64, 0x9a, 0x2b, 0x35,
|
||||
0x65, 0x5c, 0x2f, 0x6b, 0xd8, 0x0c, 0x71, 0x2d, 0x85, 0x16, 0xb8, 0xf7, 0x1b, 0x8f, 0x1d, 0x1e,
|
||||
0x3b, 0xa2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x38, 0x46, 0x77, 0x39, 0x70, 0x21, 0x97, 0x24, 0x17, 0x9c, 0x33, 0x4d, 0x26, 0x4b, 0x0d, 0x2a,
|
||||
0xd8, 0x35, 0xf4, 0x81, 0x95, 0x46, 0x46, 0x49, 0x5b, 0x01, 0xbf, 0x46, 0x7d, 0xc7, 0x2f, 0x84,
|
||||
0x3c, 0x67, 0x55, 0x49, 0x14, 0x68, 0x52, 0x4b, 0xf6, 0xa9, 0xad, 0xcb, 0x9a, 0xaf, 0x1b, 0xf3,
|
||||
0x43, 0xcb, 0xbd, 0xb3, 0xd8, 0x19, 0xe8, 0x53, 0x0b, 0xd9, 0x9c, 0x31, 0x8a, 0xfe, 0x91, 0xa3,
|
||||
0xa6, 0x54, 0x42, 0xe1, 0x62, 0xf6, 0x4c, 0xcc, 0x83, 0xed, 0x98, 0x33, 0xc3, 0xd8, 0x94, 0xa7,
|
||||
0x08, 0xd5, 0xb6, 0x56, 0xc2, 0x8a, 0xe0, 0x46, 0xdf, 0x1b, 0x74, 0xd3, 0x6e, 0x73, 0x11, 0xf9,
|
||||
0xae, 0xec, 0xe3, 0x71, 0xe6, 0x3b, 0xe0, 0xb8, 0xc0, 0x8f, 0xd1, 0x9d, 0xb9, 0x02, 0xf9, 0x47,
|
||||
0x2d, 0xfb, 0x66, 0x49, 0xb7, 0xbd, 0xdf, 0x94, 0x92, 0x7e, 0x58, 0x5d, 0x86, 0x9d, 0xef, 0x97,
|
||||
0x61, 0xe7, 0x73, 0x13, 0x7a, 0xab, 0x26, 0xf4, 0xbe, 0x35, 0xa1, 0xf7, 0xb3, 0x09, 0xbd, 0xf7,
|
||||
0xe9, 0x7f, 0x7d, 0xe5, 0x2f, 0xaf, 0x0e, 0x93, 0x3d, 0xf3, 0xf7, 0x3d, 0xff, 0x15, 0x00, 0x00,
|
||||
0xff, 0xff, 0x55, 0x4d, 0x8c, 0x0a, 0x32, 0x03, 0x00, 0x00,
|
||||
// 479 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x6f, 0xd3, 0x30,
|
||||
0x14, 0xc7, 0x1b, 0x36, 0xc6, 0x62, 0x54, 0x60, 0x86, 0x43, 0x28, 0x90, 0x54, 0xbb, 0x50, 0x09,
|
||||
0x94, 0x74, 0x70, 0xe4, 0x44, 0x5a, 0x21, 0xed, 0x32, 0xa6, 0x0c, 0x09, 0x09, 0x21, 0x59, 0x6e,
|
||||
0xf2, 0x48, 0xad, 0xd5, 0x71, 0x64, 0xbb, 0x54, 0xbd, 0xf1, 0x11, 0x38, 0xf2, 0x49, 0xf8, 0x0c,
|
||||
0x3d, 0x72, 0xe4, 0x34, 0x58, 0x3e, 0x09, 0x8a, 0xed, 0x96, 0x51, 0x38, 0x71, 0xf3, 0xf3, 0xff,
|
||||
0xf7, 0x7e, 0xaf, 0x7e, 0x0d, 0x1a, 0x95, 0x4c, 0x4f, 0xe7, 0x93, 0x38, 0x17, 0x3c, 0xc9, 0x45,
|
||||
0xa5, 0x29, 0xab, 0x40, 0x16, 0x57, 0x8f, 0x0b, 0x56, 0x15, 0x62, 0xa1, 0x92, 0x69, 0xae, 0xd4,
|
||||
0x94, 0x71, 0xbd, 0xac, 0x61, 0x53, 0xc4, 0xb5, 0x14, 0x5a, 0xe0, 0xde, 0x6f, 0x3c, 0x76, 0x78,
|
||||
0xec, 0x88, 0xde, 0xbd, 0x52, 0x94, 0xc2, 0x60, 0x49, 0x7b, 0xb2, 0x1d, 0xbd, 0xb0, 0x14, 0xa2,
|
||||
0x9c, 0x41, 0x62, 0xaa, 0xc9, 0xfc, 0x43, 0x52, 0xcc, 0x25, 0xd5, 0x4c, 0x54, 0x2e, 0x8f, 0xb6,
|
||||
0x73, 0xcd, 0x38, 0x28, 0x4d, 0x79, 0x6d, 0x81, 0xc3, 0x1c, 0x75, 0x47, 0x12, 0xa8, 0x86, 0xd7,
|
||||
0x75, 0xdb, 0x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x7c, 0xdd, 0x34, 0x3f, 0xb4, 0xdc, 0x5b, 0x8b, 0x9d, 0x81, 0x3e, 0xb5, 0x90, 0xf5, 0x8c,
|
||||
0x51, 0xf4, 0x0f, 0x8f, 0x9a, 0x52, 0x09, 0x85, 0xd3, 0xec, 0x19, 0xcd, 0x83, 0x6d, 0xcd, 0x99,
|
||||
0x61, 0xac, 0xe5, 0x29, 0x42, 0xb5, 0x5d, 0x30, 0x61, 0x45, 0x70, 0xa3, 0xef, 0x0d, 0xba, 0x69,
|
||||
0xb7, 0xb9, 0x88, 0x7c, 0xb7, 0xf6, 0xe3, 0x71, 0xe6, 0x3b, 0xe0, 0xb8, 0xc0, 0x8f, 0xd1, 0x9d,
|
||||
0xb9, 0x02, 0xf9, 0xc7, 0x5a, 0xf6, 0xcd, 0x90, 0x6e, 0x7b, 0xbf, 0x59, 0x4a, 0xfa, 0x7e, 0x75,
|
||||
0x19, 0x76, 0xbe, 0x5f, 0x86, 0x9d, 0x4f, 0x4d, 0xe8, 0xad, 0x9a, 0xd0, 0xfb, 0xd6, 0x84, 0xde,
|
||||
0xcf, 0x26, 0xf4, 0xde, 0xa5, 0xff, 0xf5, 0xbd, 0xbf, 0xb8, 0x5a, 0x4c, 0xf6, 0xcc, 0x1f, 0xf9,
|
||||
0xfc, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x22, 0xad, 0xdf, 0xf8, 0x3c, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ message CreateOptions {
|
||||
// ProcessDetails is made of the same fields as found in hcsshim.ProcessListItem
|
||||
message ProcessDetails {
|
||||
string image_name = 1;
|
||||
google.protobuf.Timestamp created_at = 2;
|
||||
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
uint64 kernel_time_100_ns = 3;
|
||||
uint64 memory_commit_bytes = 4;
|
||||
uint64 memory_working_set_private_bytes = 5;
|
||||
|
@ -96,6 +96,10 @@ file {
|
||||
label: LABEL_OPTIONAL
|
||||
type: TYPE_MESSAGE
|
||||
type_name: ".google.protobuf.Timestamp"
|
||||
options {
|
||||
65010: 1
|
||||
65001: 0
|
||||
}
|
||||
json_name: "createdAt"
|
||||
}
|
||||
field {
|
||||
|
@ -400,13 +400,9 @@ func (t *task) cleanup() {
|
||||
|
||||
// convertToProcessDetails converts a given hcsshim ProcessListItem to proto ProcessDetails
|
||||
func (t *task) convertToProcessDetails(p hcsshim.ProcessListItem) (*hcsshimtypes.ProcessDetails, error) {
|
||||
protobufTime, err := types.TimestampProto(p.CreateTimestamp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "failed to convert timestamp for process pid: %d\n", p.ProcessId)
|
||||
}
|
||||
return &hcsshimtypes.ProcessDetails{
|
||||
ImageName: p.ImageName,
|
||||
CreatedAt: protobufTime,
|
||||
CreatedAt: p.CreateTimestamp,
|
||||
KernelTime_100Ns: p.KernelTime100ns,
|
||||
MemoryCommitBytes: p.MemoryCommitBytes,
|
||||
MemoryWorkingSetPrivateBytes: p.MemoryWorkingSetPrivateBytes,
|
||||
|
Loading…
Reference in New Issue
Block a user