I'm trying to profile a .NET Core 2.0 application on Linux using VTune as described on https://blogs.msdn.microsoft.com/dotnet/2017/10/23/net-core-performance-profiling-with-intel-vtune-a... The profiler runs, but when I view the results none of my .NET Core assemblies are shown and instead most of the time is spent in "[Outside any known module]":
When I run the same binaries on Windows I get method names in top-down view:
I'm running VTune Amplifier 2018 Update 3 on Windows 7 x64 and Ubuntu 16.04 x64. The Ubuntu machine is a VM running in Virtual Box.
Windows command line: "C:\Program Files (x86)\IntelSWTools\VTune Amplifier 2018\bin64\amplxe-cl.exe" -collect hotspots -mrte-mode managed -- dotnet My.dll
echo 0 | sudo tee /proc/sys/kernel/watchdog >/dev/null
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope >/dev/null
echo 0 | sudo tee /proc/sys/kernel/kptr_restrict >/dev/null
amplxe-cl -collect hotspots -mrte-mode managed -run-pass-thru=--no-altstack -r ~/vtune/out -- My.dll
Yes, but that fails on Linux:
I should have mentioned that the Linux machine is a VM, running in VirtualBox - edited that in now. I'm not sure how to enable the "vPMU feature" and that link doesn't tell me. When I run Advanced Hotspots on Windows (from the GUI) it shows very few of my assembly's methods - the main thread seems to be missing, but some methods that run on background threads are shown.
I also found no information about PMU virtualization enabling on VirtualBox.
Also in topic about VM profiling there is no VirtualBox mentioned as supported. https://software.intel.com/en-us/vtune-amplifier-help-on-virtual-machine
Are you able to change the VM to VMWare?
I tried it on an AWS Linux instances and the result is the same - no .NET assemblies in basic hotspot analysis, "make sure vPMU is enabled" when trying advanced analysis. Even if it did run in VMware that wouldn't help me, because AWS is where I'm actually experiencing the performance problem I need to profile (though the application may eventually be run on a physical server, too).
Unfortunately you are not able to collect .Net stacks on linux with hotspots.
To enable advanced hotspots VTune Amplifier need access to hardware counters. So the solutions for you: run collection in virtual machine with PMU virtualization or on physical machine.
That's very disappointing - both the limitation itself and the fact that it's not properly documented. I wasted a lot of time trying to do something that, apparently, never had a chance of working.
Firstly, VTune should have clearly told me: Hey, I see you're running basic hotspot analysis on a .NET Core application on Linux! Guess what? The results are going to be useless! Try advanced instead.
Secondly, the error message about PMU when running advanced analysis, or the linked page, should have clearly said that there is no way to enable PMU on hypervisors other than the supported ones listed there.
EM, thank you for your feedback. Support of .NET Core apps in VTune is available on Windows and Linux and it's limited by the Launch mode and Advanced Hotspots analysis type (more details). Sorry about wasting of your time. I absolutely agree with your concern: VTune should inform clearly if a certain capabilities are not available for .NET Core. It's a subject for improvement for us. About the error message about PMU, typically it's not a problem to enable event-based sampling on the virtual machine if you virtualize performance counters (more details) but you run app in Amazon cloud and have not control on the hypervisor. Do you have a chance to you use either the Bare metal instances or C5 instances in Amazon cloud? Can you run profiling on your own Windows-based machine? Are interested in Basic Hotspots or other analysis types also?
I cannot run the profiling only on Windows, because the problem I'm trying to troubleshoot is that our application performs significantly differently on Windows and Linux. This is why I have 2 AWS instances of the same type, one Windows and one Linux, to hopefully do a fair comparison. I may be able to test it on C5 instances, yes. Is it known to work on those? I'd just like to check that, before I spend the time setting it up.
Additionally, there is the problem that Advanced Analysis does not produce meaningful results even on my physical Windows 7 machine. As I mentioned above, the results contain very few of my methods - the main method and its callees are missing, but some background thread methods are present.
By the way, I see warnings like this on Windows, both for my assemblies and some NuGet packages:
We tested VTune on a AWS Linux-based C5 instance (it works just fine) and did not test on Windows instance. We may perform testing on AWS Windows-based instance but please expect that it will take some time. Regarding meaningful results on a physical Windows 7 machine, did you run Advanced Analysis in Launch mode but not Attach, right?
Yes, that was for Launch mode. When I run Advanced Analysis in Attach mode I don't see any of my methods or modules at all. I've really tried everything I could think of and I can only get some meaningful results when:
* Running on Windows
* As Administrator
* In Launch Mode
* With Basic Hotspot analysis