diff --git a/src/recordhost.cpp b/src/recordhost.cpp index df5b53f58..e588948c6 100644 --- a/src/recordhost.cpp +++ b/src/recordhost.cpp @@ -130,9 +130,11 @@ RecordHost::PerfCapabilities fetchLocalPerfCapabilities(const QString& perfPath) const auto help = perfRecordHelp(perfPath); capabilities.canCompress = Zstd_FOUND && buildOptions.contains("zstd: [ on ]"); capabilities.canUseAio = buildOptions.contains("aio: [ on ]"); + capabilities.libtraceeventSupport = buildOptions.contains("libtraceevent: [ on ]"); capabilities.canSwitchEvents = help.contains("--switch-events"); capabilities.canSampleCpu = help.contains("--sample-cpu"); - capabilities.canProfileOffCpu = canTrace(QStringLiteral("events/sched/sched_switch")); + capabilities.canProfileOffCpu = + capabilities.libtraceeventSupport && canTrace(QStringLiteral("events/sched/sched_switch")); const auto isElevated = privsAlreadyElevated(); capabilities.privilegesAlreadyElevated = isElevated; diff --git a/src/recordhost.h b/src/recordhost.h index 5023d1cbf..c914193c4 100644 --- a/src/recordhost.h +++ b/src/recordhost.h @@ -79,6 +79,7 @@ class RecordHost : public QObject bool canCompress = false; bool canElevatePrivileges = false; bool privilegesAlreadyElevated = false; + bool libtraceeventSupport = false; }; PerfCapabilities perfCapabilities() const { diff --git a/src/recordpage.cpp b/src/recordpage.cpp index d3068635f..9e9bd1068 100644 --- a/src/recordpage.cpp +++ b/src/recordpage.cpp @@ -227,6 +227,14 @@ RecordPage::RecordPage(QWidget* parent) ui->compressionComboBox->setVisible(capabilities.canCompress); ui->compressionLabel->setVisible(capabilities.canCompress); + ui->offCpuCheckBox->setCheckable(capabilities.libtraceeventSupport); + + if (!capabilities.libtraceeventSupport) { + ui->offCpuCheckBox->setChecked(false); + ui->offCpuCheckBox->setText( + tr("perf doesn't support libtraceevent, you may need to build perf manually to support this")); + } + if (!capabilities.canElevatePrivileges) { ui->elevatePrivilegesCheckBox->setChecked(false); ui->elevatePrivilegesCheckBox->setEnabled(false);