Instead of encoding a JSON string of each connection (non-trivial at high
connection volumes) we can use the connTmp struct for map look-ups if we
eliminate the unused `uids` field.
Also switches to using the empty struct instead of bool for zero memory
overhead.
The goal is to improve performance of connection fetching connections across
all processes when some processes can have several hundred or thousands of file
descriptors. Right now when you have many thousands of fds the process spends
lots of time inside the syscalls from Readdir and Readlink.
The public API works as before with two new functions:
- `ConnectionsMax`
- `ConnectionsPidMax`
Each function takes an additional int argument that sets the max number of fds
read per process.
addresses a few things:
- Windows has a concept of both a network "interface" and an "adapter"
- These are almost always a one-to-one relationship, though there can be
esoteric instances where they are not.
- I believe the gopsutil NetIOCounters function should only return on a
per-interface level, since this is the behavior on linux/darwin.
Previously, the plugin was basically ignoring the actual interfaces
returned from net.Interfaces(). Instead, it was looping over the net
adapters for each interface, somewhat uselessly.
FWIW, the code for getAdapterList() doesn't exist in the Go standard lib
anymore.
closes #245
Currently gopsutils fails to indentify the POWER processors family,
returning an almost empty Info() structure.
This patch improves the POWER identification without changing what is
available for x86.
When fetching stats on all processes at once there's a non-trivial amount of
time spent in the `BootTime` call. But since this value should never change
during a live process, we can use a cached version for all subsequent calls.
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>
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>