From d9f1a60a64795d2f9e63f329666c0f9d79391ddb Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Wed, 7 Oct 2015 16:12:55 -0600 Subject: [PATCH] godep update: gopsutil --- Godeps/Godeps.json | 8 +-- .../shirou/gopsutil/host/host_linux_arm.go | 53 ++++++++++++------- .../shirou/gopsutil/process/process_linux.go | 4 +- .../shirou/gopsutil/process/process_test.go | 8 +++ 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index b3460d0e1..55a7f80e9 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -197,8 +197,8 @@ }, { "ImportPath": "github.com/shirou/gopsutil/host", - "Comment": "1.0.0-153-gc1313e7", - "Rev": "c1313e76341b18456212c5645d1daa7f132ac50e" + "Comment": "1.0.0-161-g3303647", + "Rev": "3303647209557312e5db51450ea8bbdef56d5176" }, { "ImportPath": "github.com/shirou/gopsutil/load", @@ -217,8 +217,8 @@ }, { "ImportPath": "github.com/shirou/gopsutil/process", - "Comment": "1.0.0-153-gc1313e7", - "Rev": "c1313e76341b18456212c5645d1daa7f132ac50e" + "Comment": "1.0.0-161-g3303647", + "Rev": "3303647209557312e5db51450ea8bbdef56d5176" }, { "ImportPath": "github.com/streadway/amqp", diff --git a/Godeps/_workspace/src/github.com/shirou/gopsutil/host/host_linux_arm.go b/Godeps/_workspace/src/github.com/shirou/gopsutil/host/host_linux_arm.go index d4455ea39..329e530f7 100644 --- a/Godeps/_workspace/src/github.com/shirou/gopsutil/host/host_linux_arm.go +++ b/Godeps/_workspace/src/github.com/shirou/gopsutil/host/host_linux_arm.go @@ -3,25 +3,40 @@ package host -type exitStatus struct { - Etermination int16 // Process termination status. - Eexit int16 // Process exit status. -} -type timeval struct { - TvSec uint32 // Seconds. - TvUsec uint32 // Microseconds. -} +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) type utmp struct { - Type int16 // Type of login. - Pid int32 // Process ID of login process. - Line [32]byte // Devicename. - ID [4]byte // Inittab ID. - User [32]byte // Username. - Host [256]byte // Hostname for remote login. - Exit exitStatus // Exit status of a process marked - Session int32 // Session ID, used for windowing. - Tv timeval // Time entry was made. - AddrV6 [16]byte // Internet address of remote host. - Unused [20]byte // Reserved for future use. // original is 20 + Type int16 + Pad_cgo_0 [2]byte + Pid int32 + Line [32]int8 + Id [4]int8 + User [32]int8 + Host [256]int8 + Exit exit_status + Session int32 + Tv UtTv + Addr_v6 [4]int32 + X__glibc_reserved [20]int8 +} +type exit_status struct { + Termination int16 + Exit int16 +} +type UtTv struct { + TvSec int32 + TvUsec int32 } diff --git a/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_linux.go b/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_linux.go index e1085181d..692329fc0 100644 --- a/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_linux.go +++ b/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_linux.go @@ -596,8 +596,8 @@ func (p *Process) fillFromStat() (string, int32, *cpu.CPUTimesStat, int64, int32 if err != nil { return "", 0, nil, 0, 0, err } - ctime := (t / uint64(ClockTicks)) + uint64(bootTime)*1000 - createTime := int64(ctime) + ctime := (t / uint64(ClockTicks)) + uint64(bootTime) + createTime := int64(ctime * 1000) // p.Nice = mustParseInt32(fields[18]) // use syscall instead of parse Stat file diff --git a/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_test.go b/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_test.go index 3d6ee349b..854d63c12 100644 --- a/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_test.go +++ b/Godeps/_workspace/src/github.com/shirou/gopsutil/process/process_test.go @@ -270,9 +270,17 @@ func Test_Process_CreateTime(t *testing.T) { if err != nil { t.Errorf("error %v", err) } + if c < 1420000000 { t.Errorf("process created time is wrong.") } + + gotElapsed := time.Since(time.Unix(int64(c/1000), 0)) + maxElapsed := time.Duration(5 * time.Second) + + if gotElapsed >= maxElapsed { + t.Errorf("this process has not been running for %v", gotElapsed) + } } func Test_Parent(t *testing.T) {