Intel has a free tool called the Intel VTune Profiler that can be used to monitor a system’s CPU utilization. Although handy, this tool has not historically been supported for use on virtual machines. More recently, however, it has become possible to run the VTune Profiler performance analyzer on a Hyper-V virtual machine. In this article, I will show you how.
It's easy enough to download the Intel VTune Profiler. To complete the download, however, you will have to create an Intel account.
Once downloaded, the deployment process is relatively straightforward. Simply run the executable file that you downloaded. When you do, you will be prompted to select the components that you wish to deploy, as shown in the image below. It is worth noting that the Intel VTune Profiler is not a lightweight monitoring utility. If you opt to deploy all of the available components then it will require roughly about 1.6GB of storage space, as shown in the image.
Once you choose the components that you wish to install, you will be asked whether or not you want to allow Intel to collect your data. Make your selection, click Next, and the tool will be installed.
If you launch the VTune Profiler right now and attempt to configure an analysis, you will likely receive an error message indicating that hardware collection of CPU events is not possible on the system. The error goes on to state that microarchitecture performance insights will not be available. You can see what this error looks like in the image below.
The reason why this error message appears is because VTune Profiler performance analyzer is being run on a virtual machine, and the underlying CPU architecture is not being fully exposed to the VM.
If you want to be able to perform CPU analysis on your virtual machine, the first thing that you will have to do is to figure out if your physical hardware is supported for monitoring. As a general rule, any Intel Xeon-based server should be compatible, as long as it is running the Broadwell architecture (PMU version 3), or something newer. Intel has a chart illustrating the various microarchitectures and their monitoring capabilities. The list is a bit dated, but may be helpful nonetheless.
Once you have verified your hardware architecture, you will need to make sure that your software is up to the job. As a general rule, both the Hyper-V host and the guest operating must be running either Windows Server 2019 or Windows 10 version 1809 or higher.
It is also worth noting that nested virtualization must not be enabled for the virtual machine. If you aren’t sure whether or not nested virtualization is enabled for a particular VM, you can find out easily enough. To do so, open an elevated PowerShell session on the Hyper-V host (not inside of the VM) and then enter the following command:
Get-VMProcessor <VM name> | Select-Object ExposeVirtualizationExtensions
Upon executing this command, you should see a result of False, as shown in the image below.
Now that you have made sure that your Hyper-V host and your virtual machine meet the stated system requirements, it is time to actually enable Intel performance monitoring. The first step in doing so is to shut down the virtual machine.
Once you have shut down the virtual machine, you will have to configure the performance monitoring components that you plan to use. This process is just a little bit tricky to do because you will have to base the configuration on your server’s physical processors. Again, I would recommend going reviewing the components that are supported by each architecture.
If you aren’t quite sure what to do at this point, then my advice would be to try enabling all of the available components except for IPT. To do so, open an elevated PowerShell session and enter the following command:
Set-VMProcessor <VM Name> -Perfmon @("pmu", "lbr", "pebs")
If you want to enable one specific component (rather than all of these components), you would simply modify the command above to reference the one single component that you want to enable. If for example, you only wanted to enable PMU, then you would use this command:
Set-VMProcessor <VM Name> -Perfmon @("pmu")
There can sometimes be a bit of trial and error involved in enabling the various components. If you find that your virtual machine will not initialize after running one of these commands, then it is really easy to put everything back to normal. Just use this command to disable the components that you have enabled:
Set-VMProcessor <VM Name> -Perfmon @()
Once you have disabled all of the components, try enabling components one at a time until you find one that works with your server.
The screen capture below shows what it looked like when I enabled the components on my own server. As you can see, I enabled everything except for IPT.
This command enables everything except for IPT.
Incidentally, if you do decide to enable IPT, then the command for doing so is:
Set-VMProcessor <VM Name> -Perfmon @("ipt")
It is worth noting, however, that enabling IPT (Intel Processor Trace) requires you to have a CPU that supports both IPT and PT2GPA. You will also need Windows Server version 1903 or higher or Windows 10 version 1903 or higher.
When you finish enabling the components that you want to use, go ahead and start your VM and launch the Intel VTune Profiler. If you are inexperienced with this tool, it contains a handy onscreen guide that you can use to get yourself started. You can see what the analysis looks like in the image below.
The Intel VTune Profiler can require a bit of getting used to. Even so, Intel provides an excellent tutorial and most admins will likely find that they are able to effectively use the tool after only a few minutes.
Featured image: Designed by Rawpixel.com / Freepik
There’s a lot of information in log files. Maybe too much information. Use PowerShell to…
Error messages don’t always tell you what caused the problem with Azure.. Azure services status…
Is your organization faced with making tough decisions about staffing, remote work, and other matters?…
With artificial intelligence, there’s no looking back. And these forward-looking startups are at the leading…
There are fewer things more evil than blackmailing patients of a psychotherapy clinic. But this…
COVID-19 has forced many to shelter-in-place — including IT pros who might otherwise look for…