In Part 1 and Part 2 of this series, I discussed the fundamentals of profiling and provided an introduction to VTune. Now it’s time to create, configure, and run an analysis. Since we are interested in finding performance hotspots, we have two analysis types to choose from: Basic Hotspots and Advanced Hotspots. The former uses time-based sampling and the latter uses event-based sampling. Throughout this series, I’ll use both of them starting with Basic Hotspots. In a real world scenario, if you can use Advanced Hotspots, then you can just use that instead and enjoy the smaller sampling interval and lighter overhead.
- Profiling mode: This can be either Auto, Native, Mixed, or Managed. A program is said to be native if its code is available in an executable binary form. Otherwise, if the code requires emulation such as Java or .NET, it is described as managed. This parameter tells VTune what kind of code to profile. In Managed mode, only managed code is profiled and so if this is the only code you care about, you can improve profiling performance by choosing it. In Native and Mixed modes, everything is profiled but eventually only the data relevant to the profiling mode is kept and displayed. In Auto mode, VTune will figure out by itself the most suitable mode it can determine by looking at the input binary.
- Analyze child processes: This is easy. If the program being profiled forked or created a new process, this specifies whether VTune should profile that process too.
- Duration time estimate: Specifies an estimate of the execution time of the target without profiling. VTune uses this estimate to potentially increase the sampling interval to reduce the size of the resulting profile.
- Profile size limit: Specifies a threshold for the profile size in MBs. Once crossed, VTune suspends data collection but the target continues to run. At that point, VTune can start analyzing and displaying the collected data.
Some of the options are self-explanatory while others are important and need to be discussed but only supported in EBS-based analysis types and so will be discussed in a future part of this series.
For the password cracking program, the default options are good enough. Select the Basic Hotspots analysis type and start the analysis with the default sampling interval (about 10 ms). The program will run and will take some amount of time to terminate. When it does terminate, VTune will automatically process and display the results, which will be explained in the next part.
Note that since the target prints output to the terminal, it will run a lot faster if there was no terminal to write to. VTune redirects the output of the target to its own terminal. Therefore, if VTune itself doesn’t have a terminal to write to, the same will happen to the target. So it’s important to launch VTune from the terminal.