Commit Graph

72 Commits

Author SHA1 Message Date
AtakanColak 498a39984d tidy comments 2020-11-06 11:07:02 +03:00
AtakanColak 2c98f69e11 add load v2
tidied up common/windows
added load benchmark for load_test
cpu percent is used as load if queue is zero
2020-11-02 16:54:39 +03:00
AtakanColak 24e6d6d350 add load to windows 2020-10-22 17:44:11 +03:00
Atakan 3504ea07b0 simplify virt cache 2020-10-13 11:06:20 +03:00
shirou b94f262e7d
Merge pull request #949 from boogie-byte/vet-target
Add "vet" target to the Makefile
2020-10-11 23:01:10 +09:00
Sergey Vinogradov 8ff2ab3187 Add "vet" target to the Makefile
Making the "vet" target will run "go vet ./..." for each supported
GOOS.

Also, some of the warnings produced by go 1.15 vet were mitigated.
2020-10-10 16:50:49 +03:00
Ryan Fitzpatrick 8046134504
Fix VirtualizationWithContext() race in linux 2020-10-06 17:03:49 +00:00
shirou 5084874a4c
Merge pull request #942 from AtakanColak/patch-1
Cache common/common_linux.Virtualization()
2020-10-01 11:56:51 +09:00
Ata ba243b1d14
removed explicit set to nil 2020-09-29 10:12:48 +03:00
Ata 5fd5d64304
Cache common/common_linux.Virtualization()
By assuming virtualization environment won't change during a the program's runtime, we can cache common/common_linux.Virtualization() with a simple map to reduce amount of system calls. I first mentioned this issue at https://github.com/shirou/gopsutil/pull/890#issuecomment-690211919
2020-09-11 10:41:01 +03:00
Lomanic e1082dabb6 [process][darwin] Fix #925 remove references to removed const unix.SYS___SYSCTL from x/sys/unix
More like a workaround, wanted to port process.getKProcWithContext() to use unix.SysctlRaw() to get rid of exec calls to ps
in the same time but didn't have time.
2020-09-08 11:44:46 +02:00
ninedraft baf3495197 use legacy error check in the common.TestSleep 2020-09-03 23:07:04 +03:00
ninedraft 34df4904f6 use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext 2020-09-03 23:01:53 +03:00
Mihir Singh 92d6df6d8f Attempted LXC guest detection from environ procfile 2020-06-21 09:13:34 +00:00
Lomanic c89193f22d
Merge pull request #857 from Gui13/fix_837
Do not cache boot time for linux. Fix #837
2020-05-17 22:47:08 +02:00
Mauro Leggieri 00957cfedc Fixed slow command line retrieval on Windows 2020-04-30 22:44:43 -03:00
Guillaume Bienkowski aeb3b6b1c7 Do not cache boot time for linux. Fix #837 2020-04-15 13:52:34 +02:00
Ilya Prudnikov 256e00319e implement proposed solution 2020-01-20 20:13:45 +02:00
shirou a21ed69d3a Revert "Merge pull request #763 from Iqoqo/add-android-support-for-host"
This reverts commit f58b2e3677, reversing
changes made to 84e6215770.
2019-09-15 09:49:07 +09:00
Ilya Guterman 11244886bb add android support for host 2019-09-08 19:45:04 +03:00
Kris Watts c3720007e4 Fixes issue #730 2019-07-26 12:05:16 -06:00
Lomanic 47323f9ad5 [process][windows] Fix #586 use win32 API in process.Exe() instead of slow WMI call
This is faster by a factor of 100.

References:
5f4287d17f/psutil/_pswindows.py (L221)
921870d540/psutil/_psutil_windows.c (L1211)
921870d540/psutil/_psutil_windows.c (L626)
2019-06-16 23:03:27 +02:00
Arturo Reuschenbach Puncernau eb15d06a52 trim quotes when reading from os-release 2019-06-03 14:21:04 +02:00
shirou 5335e3fd50
Merge pull request #685 from cmattoon/conntrack-stat
Adds ConntrackStats (/proc/net/stat/nf_conntrack)
2019-06-01 11:50:09 +09:00
shirou 07863cab0c [host]linux: add #688 diff which is removed after merging #689 2019-06-01 11:31:00 +09:00
Tyler Dixon 4e81681ab3 code review 2019-05-24 09:48:27 -07:00
Tyler Dixon a02925055c Remove cycle between process and host packages
gopsutil is a transitive dependency of another project that I am integrating
into an internal build system. We target multiple platforms and as a part
of the build system for the large internal repo, we calculate the build
graph used to determine what targets have changed and need to be build /
tested as a single DAG for all platforms.

gopsutil currently does not form a DAG if linux and any other platform are
considered at the same time. linux is the only platform where the process
package imports the host package.

To remove this cycle, the relevant methods have been moved to internal/common
with the linux build tag and are consumed the host and process packages.
2019-05-22 17:45:50 -07:00
Curtis Mattoon 648bf4eebc Adds ConntrackStats to get conntrack summary stats 2019-05-11 12:45:05 -04:00
Lomanic 0e0dd767df [process][darwin] Fix #670 remove call to common.Pipeline (prone to race condition)
Also properly parse lsof to get second txt record instead of hoping the 5th line is the right one (wrong data returned for pid 57)
2019-05-08 18:17:56 +02:00
Segflow 86c7289ccc Fix: use filename in exec.LookPath instead of full path
exec.LookPath searches for the file in the $PATH, which mean giving it an absolute path is against it's own purposes.
2019-05-05 20:45:07 +01:00
WAKAYAMA shirou bb15c85289 [mem][freebsd]: add SysctlUint which can adapt both 32 and 64 bit 2019-03-16 21:43:15 +09:00
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
2018-08-18 22:52:41 +02:00
Jaime Soriano Pastor 61902bc2a5 Use HOST_* environment variables for getting disk serial number in Linux 2018-07-02 10:04:57 +02:00
shirou 145dca90f7 change to use CommandContext. 2018-03-31 21:35:53 +09:00
sada 8dd42707e2 windows: fix WithContext functions
set timeout only if parent context doesn't set.
2018-02-12 13:26:17 -08:00
shirou 079e1cb22f [internal]Windows: skip Host test. 2018-01-11 11:34:14 +09:00
leaf 65598d98cc To prevent hang if wmi.Query hangs, add a context-aware wrapper for it. 2017-11-20 10:13:27 -08:00
Daniel Nelson df2f1a8dd1
Add HOST_VAR envvar and use to locate utmp on Linux. 2017-10-16 14:53:14 -07:00
Derek Brown 7c807c86e4 Add implementation of SwapMemory() for windows 2017-09-18 18:14:29 -07:00
Michael Schurter 042305ee4a Remove SetEnv on all platforms 2017-08-16 15:32:21 -07:00
Michael Schurter 565f5c8c5e Alter subprocess's environment instead of the hosts
Fixes #415
2017-08-16 14:54:50 -07:00
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}` 2017-06-02 13:51:00 -07:00
Asato Wakisaka 16a38100b3 NumProcs() just counts files under f, so use f.Readdirnames to avoid `lstat` syscall inside f.Readdir. 2017-05-25 00:04:41 +09:00
Sean Chittenden d0e40ff723
Fix issues reported by golint. 2017-04-27 14:21:34 -07:00
Sean Chittenden 3834908232
Improve Command() handling and signal handling for launched processes. 2017-04-27 14:11:25 -07:00
WAKAYAMA Shirou 30ebb9ca3a rename expected dir to testdata. 2017-03-15 23:01:06 +09:00
tycho garen 22c56d292e close open files 2017-02-22 08:46:23 -05:00
Cameron Sparr a213bf5e6d
run go fmt ./... 2017-02-01 23:05:29 +00:00
shirou 93564b3142 Merge pull request #271 from botherder/master
Obtain executable path from macOS process (fix #270)
2017-01-02 14:11:51 +09:00
Marco Pfatschbacher b4846b445b Add support for OpenBSD/amd64
This code is based on the FreeBSD version
and implements roughly the same feature set.
2016-11-24 22:30:29 +01:00