Table of Contents

Access the performance-counter on Ubuntu/Linux

Performance Counters for Linux (PCL) is a new kernel-based subsystem that provides a framework for collecting and analyzing performance data. These events will vary based on the performance monitoring hardware and the software configuration of the system. Linux includes this kernel subsystem to collect data and the user-space tool perf to analyze the collected performance data.

Profiling is achieved by instrumenting either the program source code or its binary executable form using a tool called a profiler (or code profiler).

Linux hardware performance measurement using counters, trace-points, software performance counters, and dynamic probes. Perf as one of the two most commonly used performance counter profiling tools on Linux. Perf basically use to analyses the core internal bottleneck right up to the driver level.

Linux support many profiling tools like perf, trace-cmd, blktrace, strace and oprofile.

stat: This perf command provides overall statistics for common performance events,
including instructions executed and clock cycles consumed.
Options allow selection of events other than the default measurement events.
top: This perf command help monitor top-like dynamic view of hottest functions.
record: This perf command records performance data into a file which can be later analyzed using perf report.
report: This perf command reads the performance data from a file and analyzes the recorded data.
list: This perf command lists the events available on a particular machine.