6 lines · plain
1import shutil2import subprocess3 4if shutil.which("perf") is not None and subprocess.run(["perf", "record", "-e", "cycles:u", "-o", "/dev/null", "--", "perf", "--version"], capture_output=True).returncode == 0:5 config.available_features.add("perf")6