master
md 217 lines 6.35 KB
Rendered Raw
1 <!--startmeta
2 custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/perf.plugin/README.md"
3 meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/perf.plugin/metadata.yaml"
4 sidebar_label: "CPU performance"
5 learn_status: "Published"
6 learn_rel_path: "Collecting Metrics/Collectors/Operating Systems"
7 keywords: ['linux', 'cpu performance', 'cpu cache', 'perf.plugin']
8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9 endmeta-->
10
11 # CPU performance
12
13
14 <img src="https://netdata.cloud/img/bolt.svg" width="150"/>
15
16
17 Plugin: perf.plugin
18 Module: perf.plugin
19
20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
22 ## Overview
23
24 This collector monitors CPU performance metrics about cycles, instructions, migrations, cache operations and more.
25
26 It uses syscall (2) to open a file descriptor to monitor the perf events.
27
28 This collector is only supported on the following platforms:
29
30 - Linux
31
32 This collector supports collecting metrics from multiple instances of this integration, including remote instances.
33
34 It needs setuid to use the necessary syscall to collect perf events. Netdata sets the permission during installation time.
35
36 ### Default Behavior
37
38 #### Auto-Detection
39
40 This integration doesn't support auto-detection.
41
42 #### Limits
43
44 The default configuration for this integration does not impose any limits on data collection.
45
46 #### Performance Impact
47
48 The default configuration for this integration is not expected to impose a significant performance impact on the system.
49
50 ## Setup
51
52
53 ### Prerequisites
54
55 #### Install perf plugin
56
57 If you are [using our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure the `netdata-plugin-perf` package is installed.
58
59
60 #### Enable the perf plugin
61
62 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.
63
64 To enable it, use `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md), which is typically at `/etc/netdata`, to edit the `netdata.conf` file.
65
66 ```bash
67 cd /etc/netdata # Replace this path with your Netdata config directory, if different
68 sudo ./edit-config netdata.conf
69 ```
70
71 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](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/start-stop-restart.md) for your system.
72
73
74
75 ### Configuration
76
77 #### Options
78
79 You can get the available options running:
80
81 ```bash
82 /usr/libexec/netdata/plugins.d/perf.plugin --help
83 ````
84
85
86 <details open><summary>Config options</summary>
87
88
89
90 | Option | Description | Default | Required |
91 |:-----|:------------|:--------|:---------:|
92 | update every | Data collection frequency. | 1 | no |
93 | command options | Command 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`. | 1 | yes |
94
95
96 </details>
97
98
99
100 #### via File
101
102 The configuration file name for this integration is `netdata.conf`.
103 Configuration for this specific integration is located in the `[plugin:perf]` section within that file.
104
105 The file format is a modified INI syntax. The general structure is:
106
107 ```ini
108 [section1]
109 option1 = some value
110 option2 = some other value
111
112 [section2]
113 option3 = some third value
114 ```
115 You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the
116 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory).
117
118 ```bash
119 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
120 sudo ./edit-config netdata.conf
121 ```
122
123 ##### Examples
124
125 ###### All metrics
126
127 Monitor all metrics available.
128
129 ```yaml
130 [plugin:perf]
131 command options = all
132
133 ```
134 ###### CPU cycles
135
136 Monitor CPU cycles.
137
138 <details open><summary>Config</summary>
139
140 ```yaml
141 [plugin:perf]
142 command options = cycles
143
144 ```
145 </details>
146
147
148
149 ## Alerts
150
151 There are no alerts configured by default for this integration.
152
153
154 ## Metrics
155
156 Metrics grouped by *scope*.
157
158 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
159
160
161
162 ### Per CPU performance instance
163
164 These metrics refer to the entire monitored application.
165
166 This scope has no labels.
167
168 Metrics:
169
170 | Metric | Dimensions | Unit |
171 |:------|:----------|:----|
172 | perf.cpu_cycles | cpu, ref_cpu | cycles/s |
173 | perf.instructions | instructions | instructions/s |
174 | perf.instructions_per_cycle | ipc | instructions/cycle |
175 | perf.branch_instructions | instructions, misses | instructions/s |
176 | perf.cache | references, misses | operations/s |
177 | perf.bus_cycles | bus | cycles/s |
178 | perf.stalled_cycles | frontend, backend | cycles/s |
179 | perf.migrations | migrations | migrations |
180 | perf.alignment_faults | faults | faults |
181 | perf.emulation_faults | faults | faults |
182 | perf.l1d_cache | read_access, read_misses, write_access, write_misses | events/s |
183 | perf.l1d_cache_prefetch | prefetches | prefetches/s |
184 | perf.l1i_cache | read_access, read_misses | events/s |
185 | perf.ll_cache | read_access, read_misses, write_access, write_misses | events/s |
186 | perf.dtlb_cache | read_access, read_misses, write_access, write_misses | events/s |
187 | perf.itlb_cache | read_access, read_misses | events/s |
188 | perf.pbu_cache | read_access | events/s |
189
190
191
192 ## Troubleshooting
193
194 ### Debug Mode
195
196 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.
197
198 - 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]`.
199
200 ```bash
201 cd /usr/libexec/netdata/plugins.d/
202 ```
203
204 - Switch to the `netdata` user.
205
206 ```bash
207 sudo -u netdata -s
208 ```
209
210 - Run the `perf.plugin` in debug mode:
211
212 ```bash
213 ./perf.plugin 1 all debug
214 ```
215
216
217