diff --git a/src/recordhost.cpp b/src/recordhost.cpp index d7274cbe..434be822 100644 --- a/src/recordhost.cpp +++ b/src/recordhost.cpp @@ -69,7 +69,7 @@ QByteArray perfBuildOptions(const QString& perfPath) bool canTrace(const QString& path) { - const QFileInfo info(QLatin1String("/sys/kernel/debug/tracing/") + path); + const QFileInfo info(QLatin1String("/sys/kernel/tracing/") + path); if (!info.isDir() || !info.isReadable()) { return false; } @@ -111,15 +111,9 @@ bool privsAlreadyElevated() return false; } - auto checkPerms = [](const char* path) { - const mode_t required = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; // 755 - struct stat buf; - return stat(path, &buf) == 0 && ((buf.st_mode & 07777) & required) == required; - }; - static const auto paths = {"/sys/kernel/debug", "/sys/kernel/debug/tracing"}; - isElevated = std::all_of(paths.begin(), paths.end(), checkPerms); - - return isElevated; + const mode_t required = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; // 755 + struct stat buf; + return stat("/sys/kernel/tracing", &buf) == 0 && ((buf.st_mode & 07777) & required) == required; } RecordHost::PerfCapabilities fetchLocalPerfCapabilities(const QString& perfPath) diff --git a/src/recordpage.ui b/src/recordpage.ui index 0d92e35f..50db0c30 100644 --- a/src/recordpage.ui +++ b/src/recordpage.ui @@ -265,7 +265,8 @@ - Record scheduler switch events. This enables off-CPU profiling to measure sleep times etc. This requires elevated privileges. + Record scheduler switch events. This enables off-CPU profiling to measure sleep times etc. +This requires elevated privileges or both /sys/kernel/tracing to be readable and /proc/sys/kernel/perf_event_paranoid == -1. Off-CPU Profilin&g: @@ -278,7 +279,8 @@ - Record scheduler switch events. This enables off-CPU profiling to measure sleep times etc. This requires elevated privileges. + Record scheduler switch events. This enables off-CPU profiling to measure sleep times etc. +This requires elevated privileges or both /sys/kernel/tracing to be readable and /proc/sys/kernel/perf_event_paranoid == -1.