Commit Graph

1203 Commits (cce2d16538b41615132a07ec08d5bdc91c1851e3)
 

Author SHA1 Message Date
shirou cce2d16538 [process]: add missing argment to process_fallback. 6 years ago
Lomanic eead265362
Merge pull request #611 from marcospedreiro/master
[cpu][windows] cpu.Times(true) should not return percent values
6 years ago
Lomanic 21ddb4f6d5
Merge pull request #605 from Lomanic/issue596
Fix #596 Implement process.Background and process.Foreground functions
6 years ago
Lomanic 8002bddf3f Merge branch 'master' into issue596 6 years ago
shirou 35815938bf
Merge pull request #614 from joestringer/netns
[net][linux] Support socket tables in nested namespaces
6 years ago
Joe Stringer f87d9813da [net][linux] Support socket tables in nested namespaces
Signed-off-by: Joe Stringer <joe@cilium.io>
6 years ago
Lomanic 0f70a4a06f
Merge pull request #609 from Lomanic/windows-process-children
[process][windows] Use win32 API in process.Children() instead of slow WMI call
6 years ago
shirou 852c7686b5
Merge pull request #613 from tmm1/allow-a-b-windows-drives
do not ignore A: and B: drives on windows
6 years ago
Lomanic 3b882b034c
Merge pull request #612 from tmm1/fix-typo
fix minor typo in disk_windows
6 years ago
marcospedreiro f0ebb60b86 handle pr comments: use assert.InEpsilon 6 years ago
Aman Gupta d021425af3 do not ignore A: and B: drives on windows
from https://www.howtogeek.com/122891/what-are-the-windows-a-and-b-drives-used-for/

>if your computer does not have floppy disk drives, you can assign A and B to volumes
6 years ago
Aman Gupta ab57d4a5fe fix minor typo in disk_windows 6 years ago
marcospedreiro d47801b68b revert imports 6 years ago
marcospedreiro 3cc34ebf18 windows cpu time (true) should return cpu time not percentages 6 years ago
Lomanic b0c24b4251
Merge pull request #610 from Lomanic/issue555
[disk][linux] Fix #555 Unescape escaped sequences in fstab path in disk.Partitions
6 years ago
marcospedreiro 45aeaebda5 test windows cpu.Time(true) returning time instead of percentages 6 years ago
Lomanic 8888537497 [disk][linux] Fix #555 Unescape escaped sequences in fstab path in disk.Partitions 6 years ago
Lomanic 6b539051d2 [process][windows] Use win32 API in process.Children() instead of slow WMI call
The CreateToolhelp32Snapshot+Process32First+Process32Next combo already
iterates over all processes, so it would be inefficient to enumerate all
processes with process.Processes() and then calling p.Ppid() on each of
them: we just use this combo to get all processes and their ppid in a
single iteration.

This is faster by a factor of 25 compared to the previous WMI call.
6 years ago
Lomanic 8ffa453390 #596 Amend last commit, add missing strconv pkg in process_freebsd.go 6 years ago
Lomanic 8ef9b01052 Fix process.Foreground for BSDs, add openbsd implementation 6 years ago
Lomanic 878e0a701b Fix #596 Implement process.Background and process.Foreground functions 6 years ago
shirou 48177ef5f8
Merge pull request #603 from pierresouchay/host_id_fixed_on_linux
Have a real fixed HostID on Linux
6 years ago
Pierre Souchay 890eb80501 Better comments for fallback on /etc/machine-id 6 years ago
Pierre Souchay be2b25a7c6 Have a real fixed HostID on Linux
On Linux, most golang programs do not run as root (or at least, they should not),
by default, the kernels uses strict permissions, so most userland programs cannot
read `/sys/class/dmi/id/product_uuid`. However, programs such as Consul are relying
on it to get fixed IDs, instead they have a different ID on each boot.

We propose to use `/etc/machine-id` as fallback https://www.freedesktop.org/software/systemd/man/machine-id.html

In order to fix this, this patch does the following:
 - if `/sys/class/dmi/id/product_uuid` can be read, use it for HostID
 - else if `/etc/machine-id` exists and has 32 chars, use it and add '-' to have the same format as product_uuid
 - finally, if notthing works, use the `kernel.random.boot_id`

This will greatly increase the number of programs having correct behaviour when
those rely on having a fixed HostID.

This will fix the following issues:
 - https://github.com/shirou/gopsutil/issues/350
 - https://github.com/hashicorp/consul/issues/4741
6 years ago
Lomanic 4254ce2081
Merge pull request #601 from Lomanic/issue551
Fix #551 Filter out '_Total' results from PerfInfoWithContext and unexport this function.

Also propagate context in perCPUTimes (renamed to perCPUTimesWithContext) and unexport Win32_PerfFormattedData_Counters_ProcessorInformation type.
6 years ago
Lomanic da37b31860 Create Github issue templates 6 years ago
Lomanic 79f8a73e23 Fix #551 Filter out '_Total' results from PerfInfoWithContext and unexport this function
Also propagate context in perCPUTimes (renamed to perCPUTimesWithContext)
and unexport Win32_PerfFormattedData_Counters_ProcessorInformation.
6 years ago
shirou 3ec50d2876
Merge pull request #595 from liu4480/dev
add CgroupCPUUsageDocker just like CgroupCPUDocker
6 years ago
Lomanic feffc5e3e1
Merge pull request #597 from liu4480/arg_in_lines
correct param in docker_linux.go for memory.stat
6 years ago
Bin Liu 4ef2371dda correct param in docker_linux.go for memory.stat
The version of docker on Ubuntu18.04 and Centos7 are old, and the
parameters in memory.stat on Ubuntu18.04 and Centos7 are as following:

cat /sys/fs/cgroup/memory/docker/33f962ca254969762d750ced9a97d8deef67535b96b1e8c17abd0939a3f2cbcf/memory.stat

cache 1110016
rss 413696
rss_huge 0
shmem 0
mapped_file 1015808
dirty 0
writeback 0
pgpgin 1610
pgpgout 1238
pgfault 1923
pgmajfault 12
inactive_anon 262144
active_anon 151552
inactive_file 0
active_file 1110016
unevictable 0
hierarchical_memory_limit 9223372036854771712
total_cache 1110016
total_rss 413696
total_rss_huge 0
total_shmem 0
total_mapped_file 1015808
total_dirty 0
total_writeback 0
total_pgpgin 1610
total_pgpgout 1238
total_pgfault 1923
total_pgmajfault 12
total_inactive_anon 262144
total_active_anon 151552
total_inactive_file 0
total_active_file 1110016
total_unevictable 0

this patch is for backward.
6 years ago
Bin Liu 601dd00812 add CgroupCPUUsageDocker just like CgroupCPUDocker 6 years ago
shirou a11c78ba2c
Merge pull request #581 from CMGS/master
get docker container cpu usage from cpuacct.usage
7 years ago
CMGS 80b3769ea3 not modify old API now 7 years ago
shirou 77e5abb6f0
migrate to circleci2 (#587)
* add circleci 2.0 config, which has golang 1.9 image.
7 years ago
shirou e50c47b503
Merge pull request #528 from pytimer/win_services
[windows]services: add windows service feature
7 years ago
shirou 6f5e32dd2f
Merge pull request #584 from Quasilyte/quasilyte/commentedOutCode
cpu,process: remove commented-out code
7 years ago
shirou 62f689bda3
Merge pull request #576 from Lomanic/issue574
Fix #574
7 years ago
shirou 50e1c3da5a
Merge pull request #575 from Lomanic/issue573
Fix #573
7 years ago
Lomanic 3773c0ebf0
Merge pull request #583 from Quasilyte/quasilyte/emptyFallthrough
net: use multi-value case clause instead of fallthrough
7 years ago
Iskander Sharipov f3d4342c30 cpu,process: remove commented-out code
Found using https://go-critic.github.io/overview#commentedOutCode-ref
7 years ago
Iskander Sharipov 3684fce88a net: use multi-value case clause instead of fallthrough
Found using https://go-critic.github.io/overview#emptyFallthrough-ref
7 years ago
CMGS d93c01e54d get docker container cpu usage from cpuacct.usage 7 years ago
Lomanic 18b2744df2 [host][darwin] Fix #574, use 'uname -r' in KernelVersion() 7 years ago
Lomanic e38ea9f318 [process] Don't lose context in ProcessesWithContext() on Windows and Linux 7 years ago
Lomanic 82b8111d04 [process][darwin] Fix #573 use Pids() to get processes in Processes() 7 years ago
Lomanic eb1f1ab16f
Merge pull request #549 from pytimer/win_net
[net] Implements windows net package Connections and ConnectionsPid
7 years ago
Lomanic ef54649286 [windows] Use windows.NewLazySystemDLL to (possibly) prevent DLL hijacking
Might be useless because of https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
but better be safe than sorry.

Ref: https://github.com/shirou/gopsutil/issues/570#issuecomment-413951653
7 years ago
shirou 68ff0e2996
Merge pull request #566 from zyun-i/add_freebsd_mem_laundry
Add mem(laundry) numbers on FreeBSD.
7 years ago
Isida Zyun'iti bd7b2f8148 Add mem(laundry) numbers on FreeBSD.
After FreeBSD 11.1, mem number of cached replaced by laundry.

https://reviews.freebsd.org/D8302
7 years ago
Isida Zyun'iti 48da6ade9e Fix FreeBSD total memory.
Like this.
FreeBSD: fix total memory giampaolo/psutil@bd9a58b bd9a58b2af
7 years ago