Commit Graph

40 Commits

Author SHA1 Message Date
quanweiZhou ddaf2d7623 [mem][linux] added additional meminfo fields
support HugePages_Rsvd, HugePages_Surp

Signed-off-by: quanweiZhou <quanweiZhou@linux.alibaba.com>
2022-03-19 15:19:10 +08:00
Ville Skyttä 1e56c6f421 Spelling and grammar fixes 2022-01-30 22:48:09 +02:00
mmorel-35 1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
Matthieu MOREL c8fd8c7b1f
enable unparam linter 2021-12-22 19:53:14 +01:00
shirou 0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
shirou 582bb14d8a
[linux][mem] remove unnecessary import 2021-09-29 22:55:44 +09:00
Punya Biswal 7c1aa06a5e Respond to review comments
* use LookPath for better error messages
* support procfs in containers
2021-09-08 16:15:26 -04:00
Tom Barker 84a665b712 Add mem.SwapDevices() method. 2021-08-19 10:16:30 -04:00
Lomanic cd25417bd7 [mem][linux] Fix #1002 only try to parse /proc/meminfo numeric values on fields we're interested in 2020-11-29 18:03:50 +01:00
James Bebbington 16fdb92bfc Add pgmajfault to data returned by vmstat on Linux 2020-05-25 17:15:30 +10:00
Xuewei Zhang 929068ccd5 mem: Add VirtualMemoryEx() and VirtualMemoryExWithContext() 2020-01-30 18:46:47 -08:00
Xuewei Zhang 3695635d09 Collect Active(anon), Inactive(anon) and Unevictable in /proc/meminfo
These fields helps people understand anonymous memory usage pattern.
2020-01-30 17:47:09 -08:00
lanixzcj 38b78c3eac rename InActive(file) to Inactive(file) in mem_linux.go 2019-12-20 08:39:36 +08:00
Minje Park b7f9acbce8 add unreclaim metric, this closes #719 2019-07-20 23:42:39 +09:00
lootek 1cbb212a6b
Add pages in/out/fault statistics (as read from vmstat) 2019-04-25 09:32:59 +02:00
mingrammer 64a995aad4 Refactor with gofmt 2019-03-23 21:57:24 +09:00
Minje Park 47ed6aaebd activefile and inactivefile fields were removed from VirtualMemoryStat 2019-02-13 00:55:05 +09:00
Minje Park d7ce61cac8 Error checks and fallback for old linux 2019-01-31 00:13:52 +09:00
Minje Park 9fb3b9625d mem available fallback under kernel 2.6.13 2019-01-30 21:58:44 +09:00
Minje Park 73545ec820 AvailableMemory is't calculated automatically under kenel 3.14 so it is needed to calcuate manually
manual available memory calculation should be done if only memavail is false

Manual Available Memory calculation under kernel 3.14

accurate manaul available memory calculation
2019-01-06 23:21:59 +09:00
Minje Park f9e238c38b SReclaimable should be added to Cached Memory 2018-12-14 00:48:38 +09:00
Shrug 42 12fad953c1 added additional linux meminfo fields 2018-06-19 13:12:33 -07:00
shirou c3f470a77a
Merge pull request #504 from dimrozakis/linux-used-mem
Always calculate linux used mem as total-(free+buffered+cache)
2018-03-28 11:00:28 +09:00
shirou a1564d2e89
Merge pull request #478 from DataDog/olivielpeau/commit-vm-stats
[mem] Add commit-related stats to VirtualMemoryStat on Linux
2018-03-28 10:49:09 +09:00
Dimitris Rozakis 4510db20db Always calculate linux used mem as total-(free+buffered+cache)
Used memory was calculated as Total - Available.
For newer kernels (3.14+), available memory is taken from /proc/meminfo,
whereas for older kernels it is computed as free+buffered+cached.

This commit changes that behavior. Available memory is still taken from
/proc/meminfo, if available, but used memory is always computed as
total-free-buffered-cached.

This way, it matches the output of `free` for used memory (in the -/+
buffers/cache line) and other tools.

Prior to this change, I'd see a reported used memory of 600MiB whereas
free, htop and other tools would report a used memory of 1.8GiB. And
adding used, cached, buffered and free memory would leave ~1.2GiB
unaccounted for.
2018-03-26 21:38:02 +03:00
shirou 4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
Olivier Vielpeau 5b52fbbea5 [mem] Add commit-related stats to VirtualMemoryStat on Linux 2017-12-26 16:24:10 +01: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
Maxime Mouial 4a1d5da977 Add 'SwapCached' to the VirtualMemoryStat informations on linux 2016-12-21 15:42:09 +01:00
Maxime Mouial 44e27c6972 Add Slab, Shared and PageTables metric for VirtualMemory under linux 2016-12-19 14:01:27 +01: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
kthommandra 1fd3a4dbad Added the writeback, dirty and writebacktmp fields from /proc/meminfo on Linux 2016-08-16 05:13:14 -07:00
Johan Walles 66a07939f7 Fix memory stats on Linux 2016-02-21 20:56:11 +01:00
Daniel Theophanes 0af895258e common: rename package common to internal/common. Add ENV helper funcs.
Package common wasn't used for public functions. Place it in an
internal directory to prevent other packages from using.

Remove the distributed references to "HOST_PROC" and "HOST_SYS"
consts and combine into a common function. This also helps so that
if a env var is defined with a trailing slash all will continue to
work as expected.

Fixes #100
2015-10-18 20:40:01 -07:00
Jonathan Chauncey 0461c50666 chore(*): Fixes #94
Added the ability to fetch an alternative location for /proc via an
environment variable. If the env var is not set it will return /proc as
the default value.
2015-10-17 11:34:41 -06:00
Cameron Sparr 6cd8284b30 When MemAvailable is in /proc/meminfo, use it (kernel 3.14+) 2015-09-21 17:18:20 -07:00
Cameron Sparr ce70817f55 Fix memory reporting for linux systems
/proc/meminfo reports memory in KiloBytes and so needs a multiplier of
1024 instead of 1000.
The kernel reports in terms of pages and the proc filesystem is left
shifting by 2 for 4KB pages to get KB. Since this is a binary shift,
Bytes will need to shift by 10 and so get multiplied by 1024.

From the kernel code. PAGE_SHIFT = 12 for 4KB pages
"MemTotal:       %8lu kB\n", K(i.totalram)

Thanks to @subhachandrachandra!
2015-08-27 09:41:19 -06:00
Shirou WAKAYAMA 13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
WAKAYAMA shirou d11680c773 fix bugs on FreeBSD. 2014-11-27 10:25:14 +09:00
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00