QBenchlib/Perf: open the perffd with PERF_FLAG_FD_CLOEXEC
This flag was introduced in the Linux kernel version 3.14. Trying to use perf_event_open() now with a kernel older than that will cause EINVAL errors, but 3.14 is from 2014, so most likely old enough for all of Qt 6. For that, I updated the copied header from v6.0. Change-Id: I3c79b7e08fa346988dfefffd171f895201ceb4f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 8995045c62bb673af1e74bce79e3c500e0217bae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
98fdf50c30
commit
033b1ba4dd
867
src/testlib/3rdparty/linux_perf_event_p.h
vendored
867
src/testlib/3rdparty/linux_perf_event_p.h
vendored
File diff suppressed because it is too large
Load Diff
@ -477,14 +477,13 @@ void QBenchmarkPerfEventsMeasurer::init()
|
|||||||
|
|
||||||
void QBenchmarkPerfEventsMeasurer::start()
|
void QBenchmarkPerfEventsMeasurer::start()
|
||||||
{
|
{
|
||||||
|
|
||||||
initPerf();
|
initPerf();
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
// pid == 0 -> attach to the current process
|
// pid == 0 -> attach to the current process
|
||||||
// cpu == -1 -> monitor on all CPUs
|
// cpu == -1 -> monitor on all CPUs
|
||||||
// group_fd == -1 -> this is the group leader
|
// group_fd == -1 -> this is the group leader
|
||||||
// flags == 0 -> reserved, must be zero
|
// flags == 0 -> reserved, must be zero
|
||||||
fd = perf_event_open(&attr, 0, -1, -1, 0);
|
fd = perf_event_open(&attr, 0, -1, -1, PERF_FLAG_FD_CLOEXEC);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
|
perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user