Essential System Utils

mstat – measure memory usage of a program over time

mstat is a command-line tool for measuring how much memory a program consumes over time. It uses the Linux control groups (cgroups) interface to track a process and the child processes created during its execution.

This approach is useful when profiling applications that launch subprocesses. Instead of following one PID and potentially missing memory consumed by its descendants, mstat measures the memory attributed to the process group as a whole.

The software is designed for developers and system administrators who need repeatable measurements of memory consumption during program execution. It writes sampled measurements to a file that can be examined or processed with other tools, making it suitable for benchmarking and resource analysis.

This is free and open source software.

Key Features

  • Uses Linux cgroups to measure the memory consumption of a program together with its descendant processes.
  • Supports both the legacy cgroups v1 interface and the unified cgroups v2 hierarchy, automatically detecting the available configuration.
  • Records memory measurements at configurable sampling frequencies, including high-frequency sampling for short-lived workloads.
  • Writes measurements to tab-separated files suitable for further analysis, plotting and comparison.
  • Can set environment variables for the monitored program, allowing different execution configurations to be tested.
  • Reports additional memory accounting information on cgroups v1 systems, including kernel memory attributed to a process group.
  • Requires permission to create and manage cgroups, typically through root privileges or an appropriately configured set-UID installation.
  • Provides verbose output identifying the cgroup mode being used during execution.

Website: github.com/bpowers/mstat
Support:
Developer: Bobby Powers
License: ISC License

mstat options

mstat is written in Go. Learn Go with our recommended free books and free tutorials.


Related Software

Process Memory Tools
ps_memAccurately reports memory usage of programs
pscircleVisualizes Linux processes in a form of radial tree
psrecordRecord the CPU and memory activity of a process
smem2Reports on memory usage on Linux systems
process-memDisplay memory used by processes
process-mapVisualize the virtual memory of a process
SmemstatReports the physical memory usage
mstatMeasure memory usage of a program over time
alramHelps when available memory is below threshold, with optional task killer

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted