ctinfo - Linux


Overview

ctinfo is a command-line utility used to gather detailed information and statistics about control groups (cgroups) in a Linux system. It offers insights into resource usage, hierarchies, and constraints applied to processes and tasks.

Syntax

ctinfo [options] [--] [cgroup-path]...

Options/Flags

  • -h, --help: Display help and exit.
  • -v, --version: Print version information and exit.
  • -i, --info: Get general information about the specified cgroup.
  • -s, --stats: Show resource usage statistics for the cgroup.
  • -p, --processes: List processes running inside the cgroup.
  • -d, --drop: Exclude specific subsystems or groups from the output.
  • -a, --all: Display all cgroups and their properties, even inactive ones.
  • -l, --long: Output more detailed information for each cgroup.

Examples

Get basic information about a cgroup:

ctinfo /sys/fs/cgroup/cpu/test

Show resource usage statistics for a cgroup:

ctinfo -s /sys/fs/cgroup/memory/foo

List all active cgroups in the system:

ctinfo -a

Display information about specific subsystems:

ctinfo -d cpu,memory /sys/fs/cgroup

Common Issues

  • Incorrect cgroup path: Ensure the specified cgroup path is valid and exists.
  • Permission denied: Check user permissions to access the cgroup filesystem.
  • Process not found: Processes may not be visible in cgroup listings if they are stopped or have exited.

Integration

ctinfo can be used in combination with other commands for system monitoring and performance analysis:

  • top: Integrate ctinfo into top to display cgroup usage statistics alongside process information.
  • ps: Use ctinfo to identify cgroups associated with specific processes and their usage patterns.

Related Commands

  • cgcreate: Create a new cgroup.
  • cgdelete: Delete a cgroup.
  • cgset: Set cgroup parameters.
  • cgexec: Execute a command within a specific cgroup.
  • systemd-cgls: List and manage cgroups from within systemd.