Skip to content

Implement ptime -m #69

@basil

Description

@basil

The original ptime had a -m option to print microstate accounting details. The closest equivalent on Linux is delay accounting, which would give us these statistics:

  • cpu_run_real_total
  • cpu_run_virtual_total
  • cpu_delay_total
  • blkio_delay_total
  • swapin_delay_total
  • freepages_delay_total
  • thrashing_delay_total
  • compact_delay_total
  • wpcopy_delay_total
  • irq_delay_total

Unfortunately, Linux delay accounting (CONFIG_TASK_DELAY_ACCT) is disabled by default to prevent minor performance overhead. It can be enabled at boot via kernel boot options (adding delayacct) or at runtime using sysctl kernel.task_delayacct=1 to allow tools like to report I/O and CPU wait times. If it is off, we should probably detect this and display a warning. Even if the user turns it on, it only applies to newly started processes, not retroactively to existing processes, so our user interaction should be carefully phrased to set expectations appropriately.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions