Back to Netdata

CPU performance

src/collectors/perf.plugin/integrations/cpu_performance.md

2.10.36.3 KB
Original Source
<!--startmeta custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/perf.plugin/README.md" meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/perf.plugin/metadata.yaml" sidebar_label: "CPU performance" learn_status: "Published" learn_rel_path: "Collecting Metrics/Collectors/Operating Systems" keywords: ['linux', 'cpu performance', 'cpu cache', 'perf.plugin'] message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" endmeta-->

CPU performance

Plugin: perf.plugin Module: perf.plugin

Overview

This collector monitors CPU performance metrics about cycles, instructions, migrations, cache operations and more.

It uses syscall (2) to open a file descriptor to monitor the perf events.

This collector is only supported on the following platforms:

  • Linux

This collector supports collecting metrics from multiple instances of this integration, including remote instances.

It needs setuid to use the necessary syscall to collect perf events. Netdata sets the permission during installation time.

Default Behavior

Auto-Detection

This integration doesn't support auto-detection.

Limits

The default configuration for this integration does not impose any limits on data collection.

Performance Impact

The default configuration for this integration is not expected to impose a significant performance impact on the system.

Setup

Prerequisites

Install perf plugin

If you are using our official native DEB/RPM packages, make sure the netdata-plugin-perf package is installed.

Enable the perf plugin

The plugin is disabled by default because the number of PMUs is usually quite limited and it is not desired to allow Netdata to struggle silently for PMUs, interfering with other performance monitoring software.

To enable it, use edit-config from the Netdata config directory, which is typically at /etc/netdata, to edit the netdata.conf file.

bash
cd /etc/netdata   # Replace this path with your Netdata config directory, if different
sudo ./edit-config netdata.conf

Change the value of the perf setting to yes in the [plugins] section. Save the file and restart the Netdata Agent with sudo systemctl restart netdata, or the appropriate method for your system.

Configuration

Options

You can get the available options running:

bash
/usr/libexec/netdata/plugins.d/perf.plugin  --help
<details open><summary>Config options</summary>
OptionDescriptionDefaultRequired
update everyData collection frequency.1no
command optionsCommand options that specify charts shown by the plugin. cycles, instructions, branch, cache, bus, stalled, migrations, alignment, emulation, L1D, L1D-prefetch, L1I, LL, DTLB, ITLB, PBU.1yes
</details>

via File

The configuration file name for this integration is netdata.conf. Configuration for this specific integration is located in the [plugin:perf] section within that file.

The file format is a modified INI syntax. The general structure is:

ini
[section1]
    option1 = some value
    option2 = some other value

[section2]
    option3 = some third value

You can edit the configuration file using the edit-config script from the Netdata config directory.

bash
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config netdata.conf
Examples
All metrics

Monitor all metrics available.

yaml
[plugin:perf]
    command options = all

CPU cycles

Monitor CPU cycles.

<details open><summary>Config</summary>
yaml
[plugin:perf]
    command options = cycles

</details>

Alerts

There are no alerts configured by default for this integration.

Metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

Per CPU performance instance

These metrics refer to the entire monitored application.

This scope has no labels.

Metrics:

MetricDimensionsUnit
perf.cpu_cyclescpu, ref_cpucycles/s
perf.instructionsinstructionsinstructions/s
perf.instructions_per_cycleipcinstructions/cycle
perf.branch_instructionsinstructions, missesinstructions/s
perf.cachereferences, missesoperations/s
perf.bus_cyclesbuscycles/s
perf.stalled_cyclesfrontend, backendcycles/s
perf.migrationsmigrationsmigrations
perf.alignment_faultsfaultsfaults
perf.emulation_faultsfaultsfaults
perf.l1d_cacheread_access, read_misses, write_access, write_missesevents/s
perf.l1d_cache_prefetchprefetchesprefetches/s
perf.l1i_cacheread_access, read_missesevents/s
perf.ll_cacheread_access, read_misses, write_access, write_missesevents/s
perf.dtlb_cacheread_access, read_misses, write_access, write_missesevents/s
perf.itlb_cacheread_access, read_missesevents/s
perf.pbu_cacheread_accessevents/s

Troubleshooting

Debug Mode

You can run perf.plugin with the debug option enabled to troubleshoot issues with it. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    bash
    cd /usr/libexec/netdata/plugins.d/
    
  • Switch to the netdata user.

    bash
    sudo -u netdata -s
    
  • Run the perf.plugin in debug mode:

    bash
    ./perf.plugin 1 all debug