Commit Graph

1824 Commits

Author SHA1 Message Date
shirou ec072d99db
Merge pull request #1091 from shirou/add_other_flag_to_shellcheck
change to use ludeeus/action-shellcheck for shellcheck.
2021-07-01 14:59:50 +09:00
shirou 92aa11e80a use ludeeus/action-shellcheck for shellcheck. 2021-06-29 12:20:05 +00:00
shirou d87e955d79
Merge pull request #1090 from MyaLongmire/windows_name_fix
simplify mutex usage
2021-06-29 20:59:19 +09:00
shirou daec167ba2
Merge pull request #1087 from ivandeex/openbsd-process-nocgo
process, v3/process (openbsd):  remove remaining CGO bits from CmdlineSliceWithContext
2021-06-28 22:38:03 +09:00
Mya cb512c8500 simplify mutex usage 2021-06-24 15:18:00 -07:00
shirou 7ea8062810
Merge pull request #1083 from elmeyer/fix-processes-smartos
process, v3/process (Linux): fix Processes in SmartOS lx containers
2021-06-20 00:30:09 +09:00
shirou fcbe555401
Merge pull request #1088 from fredwangwang/fix-slow-cpuinfo-win
processor, v3/processor (Win): fix slow cpuinfo on multisocket config
2021-06-20 00:28:49 +09:00
Huan Wang 6a572952f0 fix slow cpuinfo on multisocket config
updated win32_Processor struct to exclude loadpercentage field.
The loadpercentage takes linearly more time as the # of sockets
increases. By default vSphere maps 1 vCPU to 1 socket, resulting in very
poor performance when getting CPU info against, saying, 40 vCPU VM
(basically 40 sockets as seen by the VM).
2021-06-14 22:00:22 -06:00
Lars Meyer e89412a81e [process][linux] copy test for missing iotime in SmartOS lx containers to v3 2021-06-14 15:17:32 +02:00
shirou b60e8d1895
Merge pull request #1081 from tklauser/process-sysconf-clk-tck
process, v3/process: use SC_CLK_TCK sysconf value instead of hard-coding clock ticks
2021-06-12 19:11:31 +09:00
Ivan Andreev d6e0932b96 Remove CGO bits from process_openbsd.go (also v3)
Prior to this commit CGO was used in OpenBSD implementation of
Process.CmdlineSliceWithContext() for parsing the "kern.proc.args"
sysctl output. It requires some pointer arithmetics and raw pointer
dereferencing.

Having CGO in the "process" module prevents it from being go vet'ted
on any platform other than OpenBSD. In order to overcome this
limitation, the sysctl output parsing was reimplemented without raw
pointer deferencing. The resulting code might be slightly slower
than the original one, but it is cleaner and safer.

Since this fix allows go vet with GOOS=openbsd to run without any
issues on all platforms, openbsd entries were also added to the "vet"
Makefile target.

Co-authored-by: Sergey Vinogradov <cbrpnk@gmail.com>
2021-06-11 03:38:46 +03:00
Lars Meyer e42c52cb35 [process][linux] add test for missing iotime in SmartOS lx containers 2021-06-04 10:38:28 +02:00
Lars Meyer 0ab3954dc4 [process][linux] fix Processes in SmartOS lx containers
In Linux containers running in LX Branded Zones on SmartOS (potentially
other Solaris-based OSes with LX Branded Zones),
fillFromTIDStatWithContext panics as the delayacct_blkio_ticks field is
not present and thus results in an out-of-bounds slice access.
Check the slice length before and only attempt to parse the
delayacct_blkio_ticks field if there is an appropriate number of fields.
2021-06-04 10:15:21 +02:00
Tobias Klauser 611c8b576e process, v3/process: use SC_CLK_TCK sysconf value instead of hard-coding clock ticks
The github.com/tklauser/go-sysconf package is already a dependency used
in the cpu and v3/cpu packages to determine clock ticks using
`sysconf.Sysconf(sysconf.SC_CLK_TCK)`, see #1036. Use the same in
packages process and v3/process as well instead of hard-coding clock
ticks to 100.
2021-06-02 14:11:11 +02:00
Tobias Klauser 25b4a07b16 Update github.com/tklauser/go-sysconf to v0.3.6
List of changes: https://github.com/tklauser/go-sysconf/compare/v0.3.4...v0.3.6
2021-06-02 14:11:09 +02:00
shirou b49f37e9f3
Merge pull request #1076 from scop/feat-arm-cpuinfo
[cpu][linux] more info for ARM processors
2021-06-01 16:28:17 +09:00
Ville Skyttä 47f2f0eee5 [cpu][linux] add more ARM hw implementers 2021-05-30 15:39:19 +03:00
shirou d5e9031b2a
Merge pull request #1079 from shirou/feature/fix_1056_tests_and_copy_to_v2
[process][linux] fix 1056 test and copy to v2
2021-05-29 22:34:37 +09:00
shirou 9bd4bc70ae [process][linux] fix 1056 test and copy to v2 2021-05-29 21:31:50 +09:00
shirou 3a48fa3629
Merge pull request #1077 from shirou/feature/1010_port_to_v3
[host][openbsd][v3] Fix wrong OpenBSD user count
2021-05-29 18:47:24 +09:00
shirou bade702712
Merge pull request #1056 from sakateka/splitProcStat
add a reliable way to get fields from /prod/PID/stat
2021-05-29 18:47:12 +09:00
shirou ddef7ea64d [host][openbsd][v3] Fix wrong OpenBSD user count 2021-05-29 13:40:07 +09:00
shirou 2782a109dc
Merge pull request #1010 from gdbinit/openbsd-wrong-users-number-patch
Fix wrong OpenBSD user count
2021-05-29 13:39:08 +09:00
shirou b76e0ffe7a
Merge pull request #1074 from scop/feat/solaris-load-procsrunning
[load][solaris] support MiscStat.ProcsRunning
2021-05-29 13:37:09 +09:00
shirou 7ffa844cd5
Merge pull request #1075 from scop/feat/improve-solaris-exe
[process][solaris] improve Exe portability
2021-05-29 13:27:54 +09:00
Lomanic 8775def991
Merge pull request #1072 from djs55/externproc-arm64
process: fix ExternProc on Apple Silicon / Darwin arm64
2021-05-27 20:57:52 +02:00
David Scott 0a281012db process: change all pointers to uint64 in ExternProc for darwin arm64
This is the arm64 version of the change in
20c3ddbfe5

Before this patch:
```
dave@m1 process % GO111MODULE=off CGO_ENABLED=0 go test
--- FAIL: Test_Process_Name (0.00s)
    process_test.go:312: invalid Exe
--- FAIL: Test_Process_Long_Name_With_Spaces (0.22s)
    process_test.go:357: loooong name with spaces.go.exe !=
--- FAIL: Test_Process_Long_Name (0.22s)
    process_test.go:402: looooooooooooooooooooong.go.exe !=
--- FAIL: Test_Username (0.00s)
    process_test.go:593:
        	Error Trace:	process_test.go:593
        	Error:      	Not equal:
        	            	expected: "dave"
        	            	actual  : "root"

        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-dave
        	            	+root
        	Test:       	Test_Username
    process_test.go:595: root
FAIL
exit status 1
FAIL	github.com/shirou/gopsutil/process	9.955s
```

After this patch:
```
dave@m1 process % GO111MODULE=off CGO_ENABLED=0 go test
PASS
ok  	github.com/shirou/gopsutil/process	9.784s
dave@m1 process % GO111MODULE=off CGO_ENABLED=1 go test
PASS
ok  	github.com/shirou/gopsutil/process	3.180s
```

Signed-off-by: David Scott <dave@recoil.org>
2021-05-24 11:04:41 +01:00
Ville Skyttä b8ac60acc1 [cpu][linux] more info for ARM processors
https://developer.arm.com/documentation/ddi0337/h/system-control/register-descriptions/cpuid-base-register--cpuid
2021-05-20 19:35:01 +03:00
Ville Skyttä f43138a3ff [process][solaris] improve Exe portability
Resolving from path/a.out seems more portable than from execname.
2021-05-19 22:29:21 +03:00
Ville Skyttä eab3aea46b [load][solaris] support MiscStat.ProcsRunning 2021-05-19 21:57:49 +03:00
shirou 3af73eac22
Merge pull request #1064 from scop/fix/solaris-cpu
[cpu][solaris] psrinfo parsing fixes
2021-05-19 22:08:59 +09:00
shirou 9a5f86a30e
Merge pull request #1065 from scop/feat/solaris-process-some
Basic Solaris process support
2021-05-19 22:08:00 +09:00
Sergey Kacheev 44d3907f9d
Merge branch 'master' into splitProcStat 2021-05-11 09:43:55 +07:00
Lomanic 37678fe053
Merge pull request #1067 from shirou/feature/add_testdata_process_linux_fillfrom
[process][linux] add test to parse fillFromStatus
2021-05-09 11:24:02 +02:00
Lomanic f3a5a93d62
Merge pull request #1068 from shirou/feature/relax_net_iocounter_test
relax net/NetIOCountersAll test.
2021-05-09 10:27:48 +02:00
Ville Skyttä e35ae34dce [process][solaris] process basics 2021-05-08 16:54:12 +03:00
Ville Skyttä b7d717ba80 [process][posix] use os.Lstat for symlink check
unix.DT_LNK is not portable; per glibc docs it's a BSD extension. It is
not available e.g. in Solaris.
https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html#index-DT_005fLNK

As a side effect, fixes incorrect equality comparison against
Stat_t.Mode, a bitmask.
2021-05-08 16:46:56 +03:00
Ville Skyttä 2278747969 [v2][cpu][solaris] psrinfo parsing fixes 2021-05-08 16:41:03 +03:00
shirou 3d97fc18f4 add check if it runs on CI 2021-05-08 22:31:05 +09:00
shirou c6bd05a3e9 relax net/NetIOCountersAll test.
It often fails in CI.
2021-05-08 21:25:16 +09:00
shirou 2fa855f295 add MockEnv as more generic function. 2021-05-08 21:18:46 +09:00
shirou abacce2177 [process][linux] add test to parse fillFromStatus 2021-05-08 20:56:46 +09:00
shirou 008b5a41ef
Merge pull request #1060 from heptalium/master
Fix fillFromStatusWithContext() on systems with 128 bit signal masks.
2021-05-08 18:52:36 +09:00
Ville Skyttä 7598518443 [v3][cpu][solaris] psrinfo parsing fixes 2021-05-03 23:01:01 +03:00
Sergey Kacheev 716cf26984 add parsing of real data from testdata with the splitProcStat function 2021-05-03 00:00:44 +07:00
Jens Meißner 14a1f64e7e
[v3][process][linux] Fix fillFromStatusWithContext() on systems with 128 bit signal masks. 2021-04-25 17:35:07 +02:00
shirou 539c0d52c0
Merge pull request #1063 from damilola-bello/master
Make limitToUint parse to uint instead of int
2021-04-25 12:15:09 +09:00
Damilola Bello 61c36c7b8c Make limitToUint parse to uint instead of int 2021-04-23 21:30:29 -04:00
Lomanic c7a38de76e
Merge pull request #1052 from gballet/openbsd-arm-support
add support for OpenBSD arm64
2021-04-19 02:08:35 +02:00
Lomanic d447f9f7ed
Merge pull request #1039 from Lomanic/issue1037
[cpu][linux] Fix #1037 only count logical cores where 2nd field is a number
2021-04-14 00:58:15 +02:00