CPU_CLR - Linux


CPU_CLR is a debugging tool used to clear the CPU performance counters. It allows users to reset the values of CPU hardware performance metrics to zero and start fresh measurements. This is particularly useful when analyzing the performance of a system or application, as it enables accurate and isolated measurements without interference from previous operations.


cpu_clr [options] <event_list>


  • -h, –help: Display help and usage information.
  • -v, –verbose: Enable verbose output, showing additional information about the events being cleared.
  • -a, –all: Clear all available CPU performance events.
  • -f, –force: Clear events even if they are being used by another process. Use with caution.


Clear a single event:

cpu_clr instructions_retired

Clear all hardware events:

cpu_clr -a

Clear specific events and display verbose output:

cpu_clr -v L1-dcache-loads,L1-dcache-load-misses

Common Issues

  • Permission denied: Ensure you have sufficient privileges to access and modify CPU performance counters.
  • Event not found: Verify that the event name provided is correct and supported by your system.
  • Events in use: If events are being used by another process, use the -f flag to override and clear them.


CPU_CLR can be used in conjunction with other system monitoring and debugging tools, such as:

  • perf: To monitor and measure hardware performance events.
  • sysstat: To collect and report system performance metrics.
  • strace: To trace system calls made by an application and identify performance bottlenecks.

Related Commands

  • perf: Measure performance of software and hardware components.
  • pmquery: Query and monitor hardware performance counters.
  • vmstat: Display virtual memory statistics and system performance.