Package taskstats
provides access to Linux's taskstats interface, for sending
per-task, per-process, and cgroup statistics from the kernel to userspace. MIT
Licensed.
For more information on taskstats, please see:
- https://www.kernel.org/doc/Documentation/accounting/cgroupstats.txt
- https://www.kernel.org/doc/Documentation/accounting/taskstats.txt
- https://www.kernel.org/doc/Documentation/accounting/taskstats-struct.txt
- https://andrestc.com/post/linux-delay-accounting/
-
When instrumenting Go programs, use either the
taskstats.Self()
ortaskstats.TGID()
method. Using thePID()
method on multithreaded programs, including Go programs, will produce inaccurate results. -
Access to taskstats requires that the application have at least
CAP_NET_RAW
capability (see capabilities(7)). Otherwise, the application must be run as root. -
If running the application in a container (e.g. via Docker), it cannot be run in a network namespace -- usually this means that host networking must be used.