Calculating pss/uss from /proc/<pid>/smaps
Added pss and uss metrics.
Fixed issue in MemoryMapsWithContext. Parsing of /proc/
We can't accept your additions as they are Linux-only currently, try to run GOOS=windows go test github.com/shirou/gopsutil/process to see undefined types/methods errors at compile time.
Please document what these values represent and provide a source re: how you calculate them.
Moved specific linux test, to a dedicated test file. USS/PSS calculation is described in https://lwn.net/Articles/230975/. Added comments to emphasis that.
The MemoryInfoSmaps type and function are still Linux-only, gopsutil is platform-agnostic and provides the same public API (types, methods) across all the supported platforms, moving around this new test to make it Linux-only does not fix anything. The GOOS=windows go test command was here to underline the undefined type/method errors on this platform (any platform not Linux).
Also, do we need a new type MemoryInfoSmaps where PSS is already found in MemoryMapsStat? Wouldn't it be sensible to just add the new USS field to MemoryMapsStat?
Currently MemoryMapsWithContext is called with a boolean "grouped" variable. But this variable is not used. Maybe the intention was to use this flag to decide whether to sum up all memory maps into a single group? If so, then we can add USS and use the grouped flag to decide to either return all memory maps, or a single aggregate memory map (sum of each memory map type).
MemoryMaps is a port of psutil memory_map. This (perhaps only this) method is allowed to use platform dependent struct, because psutil does.
grouped is not implemented, but it is just because my laziness. I will appreciate if you would make a PR with PSS and grouped feature.
Sure, i will make a PR for it. I will also make a PR for implementing memory_full_info(), which returns both USS and PSS.
Just noticed, that you've been up to the same stuff. Here's a PR that adds grouping of MemoryMaps, please have a look: https://github.com/shirou/gopsutil/pull/567.