We need to configure a couple of things before we can properly use the VTune Amplifier. We need to run a batch file to setup some system environment variables. We also need to add some environment variables of our own which point to the Microsoft Symbols server. This is required so VTune can show us the function names of system modules while we are analyzing our demo application. We also need to ensure the SEP driver is installed correctly.
- [Instructor] There are a couple of things we need to do. We only need to do this once for the first-time setup and then afterwards, we can simply create projects through the VTune Amplifier. Here we need to first run this amplxe-vars batch file. So, open up a command prompt as Admin and navigate to the VTune installation directory. So, I'm going to copy the path and type cd and then paste the path and hit enter.
Once there, let's run that batch file and hit enter. You'll see some copyright information. Now, we need to go to the control panel and under View by, make sure you select Small icons. Then, go to system, then, on the left, Advanced system settings. Under the Advanced tab, click on Environment Variables and under the system variables section, you want to locate the VTune Amplifier variable that was just set, which is here.
So, running that batch file, you should see this variable added to your system variables. We're now going to add two more system variables. To do this, click on New, and for the variable name, the first variable we're going to add is _NT_SYMBOL_PATH. For the value, we're going to put srv. So what this variable does is we're specifying the path to the Microsoft Symbols Server so we can grab symbols.
Symbols are needed for us to see function names inside VTune. Without symbols, we will not see any function names, so this is a very important key step. Once done, click OK. And now we're going to add one more variable. Click on New, and then for the variable name, let's put _NT_SYMCACHE_PATH. For the value, put C:\SymCache. What this variable does is we're going to cache all the symbols that we grab from the Microsoft server, and we're going to save them locally onto our machine.
This way, symbols will load much faster, rather than needing a internet connection to grab the symbols from the Microsoft server every single time we open VTune. Once done, click OK, then OK and OK. After setting up our environment variables, we need to run another file in order to enable hardware-based event sampling using the SEP driver. Remember, SEP is the driver that performs the data collection. To do this, let's go back to the command prompt, and let's change directories into the bin32 folder.
Inside here, we're going to run amplxe-sepreg. And hit enter. This will show you some command line options. The first one we're going to use is -c to check the dependencies. You should see some status OK messages. Next, we're going to run the same command, only with the -i option, and now, you should see more status OK messages. Next, we need to open up the applications project we'll be profiling, and rebuild the binaries.
To do that, go to the Exercise Files folder for this video, and double-click on tachyon. Then, under vc10, locate the Visual Studio solution, and double-click it to open. Three projects will open, and we are simply going to rebuild all of them to generate the Win32 release binaries so we can profile the application. At the very top, let's click on the Build tab.
Go to Batch Build. Then, Select All, and then, select Rebuild to rebuild the project. I'm going to drag this up so I can see the output. Once all of the projects have successfully been rebuilt, let's go back to the project directory, and find the analyze_locks_Win32_Release and open that. Then, let's double-click this analyze_locks executable file to launch the application.
This is the application that we will profile, inspect, and optimize in this course. And we discuss this application in more depth later on. For now, we have insured we have built the binaries that VTune Amplifier needs. Next, we stick around inside Visual Studio, and look at the application we will be profiling.
By the end of this course you will know how to use the Locks and Waits analysis on your own application and improve the efficiency of parallel task execution on Windows.
- Installing VTune Amplifier
- Choosing options for the Locks and Waits analysis
- Working with the VTune Amplifier GUI
- Viewing the analysis summary
- Removing the lock
- Conducting lock-removed analysis
- Comparing results