From 1a820b9a10ce29edce20bf1ad0357f6029ed9605 Mon Sep 17 00:00:00 2001 From: WAKAYAMA Shirou Date: Tue, 29 Apr 2014 14:01:59 +0900 Subject: [PATCH] add args which same as psutil. but has not implemented yet. --- cpu.go | 2 +- cpu_freebsd.go | 2 +- cpu_linux.go | 2 +- cpu_test.go | 4 ++-- cpu_windows.go | 2 +- disk_freebsd.go | 2 +- disk_linux.go | 2 +- disk_test.go | 2 +- disk_windows.go | 2 +- process_freebsd.go | 2 +- process_linux.go | 2 +- process_test.go | 2 +- process_windows.go | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cpu.go b/cpu.go index 83d2a97f..943f35c5 100644 --- a/cpu.go +++ b/cpu.go @@ -19,6 +19,6 @@ type CPU_TimesStat struct { Stolen float32 `json:"stolen"` } -func Cpu_counts() (int, error) { +func Cpu_counts(logical bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu_freebsd.go b/cpu_freebsd.go index 06d8f4a1..aeec136b 100644 --- a/cpu_freebsd.go +++ b/cpu_freebsd.go @@ -22,7 +22,7 @@ const ( ) // TODO: get per cpus -func Cpu_times() ([]CPU_TimesStat, error) { +func Cpu_times(percpu bool) ([]CPU_TimesStat, error) { ret := make([]CPU_TimesStat, 0) cpu_time, err := do_sysctrl("kern.cp_time") diff --git a/cpu_linux.go b/cpu_linux.go index 674b9dca..60b612c9 100644 --- a/cpu_linux.go +++ b/cpu_linux.go @@ -8,7 +8,7 @@ import ( "strings" ) -func Cpu_times() ([]CPU_TimesStat, error) { +func Cpu_times(percpu bool) ([]CPU_TimesStat, error) { ret := make([]CPU_TimesStat, 0) filename := "/proc/stat" diff --git a/cpu_test.go b/cpu_test.go index 8a66b68d..bf5abfd4 100644 --- a/cpu_test.go +++ b/cpu_test.go @@ -5,7 +5,7 @@ import ( ) func TestCpu_times(t *testing.T) { - v, err := Cpu_times() + v, err := Cpu_times(false) if err != nil { t.Errorf("error %v", err) } @@ -21,7 +21,7 @@ func TestCpu_times(t *testing.T) { } func TestCpu_counts(t *testing.T) { - v, err := Cpu_counts() + v, err := Cpu_counts(true) if err != nil { t.Errorf("error %v", err) } diff --git a/cpu_windows.go b/cpu_windows.go index ba88542d..6f94aa8d 100644 --- a/cpu_windows.go +++ b/cpu_windows.go @@ -7,7 +7,7 @@ import ( "unsafe" ) -func Cpu_times() ([]CPU_TimesStat, error) { +func Cpu_times(percpu bool) ([]CPU_TimesStat, error) { ret := make([]CPU_TimesStat, 0) var lpIdleTime FILETIME diff --git a/disk_freebsd.go b/disk_freebsd.go index 155446a3..366bacbc 100644 --- a/disk_freebsd.go +++ b/disk_freebsd.go @@ -7,7 +7,7 @@ import ( "unsafe" ) -func Disk_partitions() ([]Disk_partitionStat, error) { +func Disk_partitions(all bool) ([]Disk_partitionStat, error) { ret := make([]Disk_partitionStat, 0) // get length diff --git a/disk_linux.go b/disk_linux.go index e7e78279..ad7192da 100644 --- a/disk_linux.go +++ b/disk_linux.go @@ -2,7 +2,7 @@ package gopsutil -func Disk_partitions() ([]Disk_partitionStat, error) { +func Disk_partitions(all bool) ([]Disk_partitionStat, error) { ret := make([]Disk_partitionStat, 0) return ret, nil diff --git a/disk_test.go b/disk_test.go index eb0453ba..f7dfd687 100644 --- a/disk_test.go +++ b/disk_test.go @@ -21,7 +21,7 @@ func TestDisk_usage(t *testing.T) { } func TestDisk_partitions(t *testing.T) { - v, err := Disk_partitions() + v, err := Disk_partitions(false) if err != nil { t.Errorf("error %v", err) } diff --git a/disk_windows.go b/disk_windows.go index 133eb398..85471557 100644 --- a/disk_windows.go +++ b/disk_windows.go @@ -44,7 +44,7 @@ func Disk_usage(path string) (Disk_usageStat, error) { return ret, nil } -func Disk_partitions() ([]Disk_partitionStat, error) { +func Disk_partitions(all bool) ([]Disk_partitionStat, error) { ret := make([]Disk_partitionStat, 0) lpBuffer := make([]byte, 254) diskret, _, err := procGetLogicalDriveStringsW.Call( diff --git a/process_freebsd.go b/process_freebsd.go index ab88e364..bca182b4 100644 --- a/process_freebsd.go +++ b/process_freebsd.go @@ -127,7 +127,7 @@ func (p *Process) Connections() ([]Net_connectionStat, error) { func (p *Process) Is_running() (bool, error) { return true, errors.New("Not implemented yet") } -func (p *Process) Memory_Maps() (*[]Memory_mapsStat, error) { +func (p *Process) Memory_Maps(grouped bool) (*[]Memory_mapsStat, error) { ret := make([]Memory_mapsStat, 0) return &ret, errors.New("Not implemented yet") } diff --git a/process_linux.go b/process_linux.go index 285a52b2..a8b6fb2c 100644 --- a/process_linux.go +++ b/process_linux.go @@ -188,7 +188,7 @@ func (p *Process) Is_running() (bool, error) { } // Get memory maps from /proc/(pid)/smaps -func (p *Process) Memory_Maps() (*[]Memory_mapsStat, error) { +func (p *Process) Memory_Maps(grouped bool) (*[]Memory_mapsStat, error) { pid := p.Pid ret := make([]Memory_mapsStat, 0) smapsPath := filepath.Join("/", "proc", strconv.Itoa(int(pid)), "smaps") diff --git a/process_test.go b/process_test.go index f18b4ff0..d58d1de6 100644 --- a/process_test.go +++ b/process_test.go @@ -57,7 +57,7 @@ func Test_Process_memory_maps(t *testing.T) { return ret, err := NewProcess(int32(check_pid)) - mmaps, err := ret.Memory_Maps() + mmaps, err := ret.Memory_Maps(false) if err != nil { t.Errorf("memory map get error %v", err) } diff --git a/process_windows.go b/process_windows.go index b6a8ceb2..50a2555f 100644 --- a/process_windows.go +++ b/process_windows.go @@ -160,7 +160,7 @@ func (p *Process) Is_running() (bool, error) { return true, errors.New("Not implemented yet") } -func (p *Process) Memory_Maps() (*[]Memory_mapsStat, error) { +func (p *Process) Memory_Maps(grouped bool) (*[]Memory_mapsStat, error) { return nil, errors.New("Not implemented yet") }