Commit Graph

748 Commits

Author SHA1 Message Date
Marc Magnin 31f4fb8dee fixed test TestDiskIOCountersStat_String to consider new weightedIO field 2016-09-22 00:03:48 +02:00
Marc Magnin acf3fef036 added weightedIO field to disk IOCountersStat (last field of /etc/mtab) 2016-09-21 23:48:49 +02:00
shirou 5332238407 Merge pull request #261 from monstermunchkin/issues/260
process: make `ClockTicks` arch-independent
2016-09-19 22:31:52 +09:00
Thomas Hipp 68ad8d603c
process: make `ClockTicks` arch-independent
The value for `ClockTicks` is defined as `100` by the Linux kernel for
all currently supported architectures in Go. Therefore, there is no need
to define this constant for each architecture separately.

This fixes #260.

Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
2016-09-17 18:06:07 +02:00
shirou c2c33439b4 Merge pull request #259 from monstermunchkin/issues/258
process: determine page sizes via function
2016-09-16 17:42:39 +09:00
Thomas Hipp eb4a57117f
process: determine page sizes via function
Instead of hard-coding the page size for linux systems, use Go's
`Getpagesize` function.

This resolves #258.

Signed-off-by: Thomas Hipp <thipp@suse.de>
2016-09-16 09:17:34 +02:00
shirou 214acac9ea Merge pull request #256 from shirou/change-platform-version-on-darwin
[host]darwin: change to use sw_vers to get platform version
2016-09-13 00:34:47 +09:00
Shirou WAKAYAMA 4bab832fc5 fix broken CurrentStatus table. 2016-09-13 00:25:04 +09:00
Shirou WAKAYAMA b9067179ef [host]darwin: change to use sw_vers to get platform version 2016-09-12 08:07:12 +09:00
shirou f20771d32a Merge pull request #255 from lberruti/fix_swap_mem_linux
Fix: wrong swap values on i686 / 4GB ram.
2016-09-07 14:41:21 +09:00
shirou ea490ab3c5 Merge pull request #254 from bclermont/fix-multidigit-interface
OSX Workaround: support interface with multiple digits
2016-09-07 14:25:29 +09:00
Bruno Clermont 3f96312057 only run ifconfig/netstat if necessary, add some tests 2016-09-04 16:37:28 +02:00
Luca Berruti 36f47562c0 Fix: wrong swap values on i686 / 4GB ram.
According to sysinfo manpages: swap fields need to be interpreted along
with the mem_unit (Unit) field.

See also http://stackoverflow.com/a/4229727
2016-09-04 12:39:34 +02:00
Bruno Clermont 145e48efdb actually there is 13 columns, not 12 2016-08-31 20:41:42 +02:00
Bruno Clermont 57ffe3b1ef Support interface with multiple digits 2016-08-31 20:41:11 +02:00
shirou 859c81da50 Merge pull request #253 from dvusboy/standardize_mhz
Standardize `Mhz` to mean maximum CPU frequency on Linux platform
2016-08-30 08:42:49 +09:00
K.C. Wong 3dc4e52844 Handle the case when the `cpufreq` sysfs does not exist
* on virtualized host, this may happen.
* but we may have a value from parsing `/proc/cpuinfo`
* in this case, we do not return the error if we fail to extra
  a value from `cpufreq/cpuinfo_max_freq`
2016-08-29 16:21:17 -07:00
K.C. Wong 10a1ae2123 Standardize `Mhz` to mean maximum CPU frequency on Linux platform
* resolve #249
* in `cpu_windows.go`, `Mhz` is the value of `MaxClockSpeed`
* on Linux platform, the `Mhz` value is extracted from `/proc/cpuinfo`
  which reflects the current clock speed; treat this as the fallback
  value instead
* read from `cpufreq/cpuinfo_max_freq` under sysfs to get the
  maximum clock speed for `Mhz`, just like for Windows platform
* also fix the path to `cpu.CoreID` value; the filename is `core_id`
2016-08-29 10:11:30 -07:00
shirou 79184fee44 Merge pull request #251 from theothertomelliott/master
Correctly handle long running processes on OSX
2016-08-29 14:31:36 +09:00
Shirou WAKAYAMA 08a6ab66b0 disk: If could not get Inodes, return empty. 2016-08-27 14:02:51 +09:00
shirou a8e24d70f9 Merge pull request #247 from lfittl/fallback-for-unsupported-architectures
Add fallback code for all unsupported operating systems
2016-08-27 00:58:16 +09:00
Tom Elliott 1435987652 Correctly handle long running processes on OSX
The full etime format is dd-hh:mm:ss. Replacing '-' with ':' fixes parsing of this format.
2016-08-26 11:49:57 -04:00
shirou 0130d5f088 Merge pull request #248 from dvusboy/cpu_freq_unit
Addressing frequency unit discrepancies
2016-08-26 00:06:39 +09:00
K.C. Wong 123a6c9b0d Addressing frequency unit discrepancies
* for Darwin, it is a minor tweak for readability: the value
  returned is in Hz, so using a variable named 'hz' makes more
  sense than 'mhz'
* for Linux, the unit is in kHz so we need to divide the value
  from `cpuinfo_max_freq` by 10^3 to get MHz (see
  cpu-freq/user-guide.txt of the kernel documentation)
2016-08-23 17:21:30 -07:00
shirou 3562fb8aa2 Merge pull request #241 from lfittl/add-host-kernel-version
Add separate kernelVersion field to host information
2016-08-23 21:11:47 +09:00
shirou 58133410ec Merge pull request #240 from lfittl/fix-osx-linter-warning
CPU: Fix linter warning on OSX
2016-08-23 21:08:08 +09:00
shirou 41852ca459 Merge pull request #246 from theothertomelliott/master
Implement CreateTime for darwin.
2016-08-23 08:03:37 +09:00
Lukas Fittl da9fa1162b Add fallback code for all unsupported operating systems.
This enables using gopsutil in a codebase that gets built on other OSes
than the ones supported. Instead of a build failure as before, due to
the build tags, gopsutil will now throw an "not implemented" runtime
error.

Fixes #234.
2016-08-22 15:31:26 -07:00
Lukas Fittl 74541ba4a5 CPU: Fix linter warning on OSX. 2016-08-22 14:20:29 -07:00
Lukas Fittl 13aedadcde Add separate kernelVersion field to host information.
This is mostly intended for Linux, where we are returning the OS version
in the PlatformVersion field, which seems reasonable. Often it is still
useful to know which Linux kernel is running.

For FreeBSD and Darwin the kernel version matches the platform version,
since they previously used the kernel version for the platform version.

For Windows the kernel version is empty, since there is no clear way
to determine it.
2016-08-22 14:15:30 -07:00
Tom Elliott 3855e7ba0e Implement CreateTime for darwin. Parses elapsed time and converts this to epoch time. 2016-08-20 23:38:36 -04:00
shirou 2eb8f8bff8 Merge pull request #242 from lfittl/add-missing-linux-disk-io-statistics
Add missing disk IO statistics for merged reads/writes, IOPS in progress
2016-08-17 13:44:03 +09:00
shirou 188e6d5436 Merge pull request #239 from lfittl/fix-make-check-condition
Ensure "make check" can succeeed if it doesn't find any golint errors
2016-08-17 12:33:51 +09:00
Lukas Fittl 8f2153dfcf Add missing disk IO statistics for merged reads/writes, IOPS in progress. 2016-08-16 13:11:50 -07:00
Lukas Fittl fc27f01654 Ensure "make check" can succeeed if it doesn't find any golint errors. 2016-08-16 13:04:47 -07:00
shirou e997d2e3db Merge pull request #238 from kthommandra/add_linux_mem_fields
Added fields to VirtualMemoryStat
2016-08-16 23:35:08 +09:00
kthommandra 1fd3a4dbad Added the writeback, dirty and writebacktmp fields from /proc/meminfo on Linux 2016-08-16 05:13:14 -07:00
shirou 1cc18d94d9 Merge pull request #237 from sean-/f-host-id
Add HostID to Host
2016-08-11 23:52:12 +09:00
Sean Chittenden d490d634ca
On Linux, attempt to read from /sys/class/dmi/id/product_uuid first
before falling back to kernel.random.boot_id.

`/sys/class/dmi/id/product_uuid` is still managed by permissions, so
for root-run processes where `/sys/class/dmi/id/product_uuid` is
available, the host's UUID will be used instead, otherwise the UUID
from kernel.random.boot_id will be used instead.
2016-08-11 01:29:46 -07:00
Sean Chittenden 59094cd5b7
Add HostID to the Host InfoStat struct returned from host.Info().
On supported hosts the value returned is a UUID (case preserving
from the value of the underlying OS).

For Linux this is generated once, randomly per boot.  For FreeBSD and
Darwin this is a more durable value that should persist across reboots.
2016-08-11 00:51:07 -07:00
Sean Chittenden e4f857a9ca
Fix a linter issue: s/TimeoutErr/ErrTimeout/g 2016-08-11 00:49:29 -07:00
Sean Chittenden 613ada987d
Add DoSysctrl() to Linux's common utilities. 2016-08-11 00:48:24 -07:00
shirou 4d0c402af6 Merge pull request #236 from ncabatoff/master
fix incorrect names for fields in proc/pid/io
2016-07-25 17:59:33 +09:00
Nick Cabatoff 28640e5d73 fix incorrect names for fields in proc/pid/io 2016-07-24 11:19:59 -04:00
shirou ee66bc560c Merge pull request #232 from phemmer/io_time_freebsd
add disk IoTime on freebsd and fix read & write time calculation
2016-07-22 10:13:42 +09:00
Patrick Hemmer 3cfaee3a93 add disk IoTime on freebsd and fix read & write time calculation 2016-07-21 17:22:52 -04:00
shirou 14f42a28f1 Merge pull request #231 from msingle/patch-1
Fix typo
2016-07-21 11:20:13 +09:00
Matt Singletary 072f1a3574 Fix typo
misspelling of family in 'platformfamiliy'
2016-07-20 15:03:53 -04:00
shirou ca63fa830d Merge pull request #228 from sean-/master
Correctly detect host Procs on all platforms.
2016-07-12 08:19:29 +09:00
Sean Chittenden 4f79984afe
Remove redefined import name for common. 2016-07-11 14:27:50 -04:00