Last active
June 24, 2022 10:33
-
-
Save mjf/16b50e06790ac0465c26b640d3337892 to your computer and use it in GitHub Desktop.
Telegraf config to collect per-CPU cycles and instructions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Telegraf configuration to collect per-CPU cycles and instructions | |
# using perf(1). You can then calculate CPI / IPC from the metrics. | |
# If Telegraf is not running as UID 0 (aka "root") you can either use | |
# sudo(1) with the perf(1) command, raise Telegraf capability, or set | |
# kernel.perf_event_paranoid = 0. But be warned: "Hic sunt dracones". | |
[[inputs.exec]] | |
name_prefix = "cpu_" | |
name_suffix = "_sample_1s" | |
interval = "10s" | |
commands = [ | |
"perf stat -x, -A -e cycles,instructions --timeout 1000 --log-fd 1" | |
] | |
data_format = "csv" | |
csv_column_names = ["cpu", "count", "dummy", "probe"] # the rest is ignored | |
csv_tag_columns = ["cpu"] | |
csv_measurement_column = "probe" | |
fielddrop = ["dummy"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample:
Enjoy!