Exercise 2: Performance Analysis

In this exercise, you will analyze the performance of the application developed in the previous exercise to discover its CPU and I/O utilization. You will use the Windows Performance Toolkit to perform the analysis without modifying the application code or using any third-party profilers.

To complete this exercise, you must have the Microsoft Windows Performance Toolkit installed on your system. Note that on a 32-bit system, the 32-bit version of Windows Performance Toolkit should be installed; on a 64-bit system, the 64-bit version of the Windows Performance Toolkit should be installed.

Task 1 – Instrumenting the Application

To instrument the application, you will use the Windows Performance Toolkit command-line tool (xperf.exe) with the “BASE” collection profile.

  1. Launch the complete application from Exercise 1.

    Note:
    If you did not complete the exercise, you can use the application from the complete solution provided in the %TrainingKitInstallfolder%\InstrumentationAndPerformance\Ex1-PerfCounters\End folder, choosing the language of your preference (C# or VB).

  2. Select a source and destination directory for the file copy operation.
  3. Open a command line with administrator privileges (type “Command Prompt” into the Start Menu search box and then right-click the first result and select “Run as administrator”).
  4. Navigate to the installation directory of the Windows Performance Toolkit (if you installed the toolkit to the default installation directory, you can use the command cd C:\Program Files\Microsoft Windows Performance Toolkit).
  5. Run the following command to turn on the base instrumentation profile.xperf -on BASE

  6. Click the Copy button in the application to start the copy operation.
  7. When the copy operation completes, go back to the command prompt and run the following command to generate the collected instrumentation data into the result.etl file.xperf -d result.etl

  8. Run the following command to open the Windows Performance Toolkit UI.xperf result.etl

  9. From the list on the left, choose “Disk Utilization by Process” and “CPU Sampling by Process”.

    Figure 6

    Analyzing the instrumentation data

  10. From the combo boxes that appear in the top right corner of each of the two graphs, select the FileCopier.exe process only.

    Note:
    You will need to get the FileCopier process id from the Task Manager’s Processes section. To open it, right-click the taskbar, and select Start Task Manager.

    Figure 7

    Selecting just the FileCopier process in both graphs

  11. Inspect the CPU utilization in correlation to the disk utilization, and determine whether the disk or CPU is a bottleneck in the application.
  12. Select a region of the disk utilization graph and right-click it, then select Summary Table and inspect the various disk accesses performed by the process.
  13. Select a region of the disk utilization graph and right-click it, then select Detail Graph and inspect the disk head activity when the files were being copied by the application.
  14. When done, go back to the command prompt and run the following command to delete the instrumentation file.del result.etl

In this exercise, you have analyzed the performance characteristics of an application without modifying its source code by using the Windows Performance Toolkit’s command line and graphical user interface.