Programmatic resource monitoring per process in Linux
/usr/src/linux/Documentation/accounting/taskstats.txt
Taskstats is a netlink-based interface for sending per-task and
per-process statistics from the kernel to userspace.Taskstats was designed for the following benefits:
- efficiently provide statistics during lifetime of a task and on its exit
- unified interface for multiple accounting subsystems
- extensibility for use by future accounting patches
This interface lets you monitor CPU, memory, and I/O usage by processes of your choosing. You only need to set up and receive messages on a single socket.
This does not differentiate (for example) disk I/O versus network I/O. If that's important to you, you might go with a LD_PRELOAD
interception library that tracks socket operations. Assuming that you can control the startup of the programs you wish to observe and that they won't do trickery behind your back, of course.
I can't think of any light-weight solutions if those still fail, but linux-audit can globally trace syscalls, which seems a fair bit more direct than re-capturing and analyzing your own network traffic.
Any Ideas for a Permanent Resource Monitor Program?
Process Explorer is a pretty good alternative for continuous monitoring. If you need more detailed memory information for a given process including diffing capabilities, VMMap is great.
Programmatically getting per-process network statistics on Windows?
I wrote a solution to this.
A TDI filter driver to collect the stats, a service which communicates with the driver and gets the stats once per second. Since the filter is at the TDI layer, I know which sockets belong to which applications. The service is a server for this data, offering it via shared memory to arbitrary third party clients via an API I wrote. I wrote a GUI and a command line client.
You can also bandwidth shape sends (per interface and/or application and/or socket) and watch data passing over a socket in real time, in a window.
Related Topics
Any Good Guides on Using Ptrace_Sysemu
Finding Threading Bottlenecks and Optimizing for Wall-Time with Perf
Docker Compose Volume Permissions Linux
Move Lines Matching a Pattern from One File to Another
Automatically Sync Two Amazon S3 Buckets, Besides S3Cmd
How to Send Esc/Pos Commands to Thermal Printer in Linux
Linux of Equivalent Cryptprotectmemory
Execute a Script After Every Git Push
Killing Process in Shell Script
How to Specify Which Version of Perl to Use on Centos
How Is a Memory Barrier in Linux Kernel Is Used
What Is The Equivalent of /Proc/Cpuinfo on Freebsd V8.1
Jenkins Failed to Start in Linux
How to Simulate Two Consecutive Enter Key Presses for a Command in a Bash Script
Tab Completion in Emacs Shell-Mode Ssh Sessions
Cloudera Manager Failed to Authenticate: Exhausted Available Authentication Methods