I'm trying to use Visual Studio 2022 and its profiling tools to profile my C++ app, built with a CMake project.
I build my project in RelWithDebInfo mode, and MSVC_x64_x64 toolset.
I added this fragment:
if (MSVC)
set_target_properties(${BUILD_TARGET} PROPERTIES LINK_FLAGS "/PROFILE")
endif()
to my CMake file, and with this addition I can choose "Debug->Performance Profiler->Target:{my exe}+CPU usage->Run".
However, after I finish capturing profiling data, I get information, that my program spent 100% of time in function "Idle":
+ Idle (PID: 0) 4767 (100,00%) 3335 (69,96%) Idle
- [System call]
ntoskrnl.dll!0xfffff806317fad1e 926 (19,43%) 926 (19,43%) ntoskrnl
And no info about my code whatsoever. What am I doing wrong?
Or is it not possible to debug CMake projects using Visual Studio?
@EDIT
It seems to be a bug in VS2022. I downloaded VS2019 and it's working just fine.
@EDIT
It was already reported a few times, and seems to be related to some bug in Windows 10 kernel. Solutions got already implemented and will be available in the next update.