Intel® Thread Checker for Windows* - Tips and Techniques

Page Contents:

I don't have source code. Can I use Intel® Thread Checker?
Yes. For example: You are using an executable file from another vendor, so you don't have source code to it. But you are interested in diagnostics about a library (.dll or .so file) that is loaded by the vendor's executable file. You may not even have source code for the library that gets loaded. You can still use Thread Checker to see if any threading diagnostics are detected.Of course, if you really want to correct threading issues, you'll need source code.

DOS* Shell Redirection for Input (<) or Output (>)
My application uses DOS* command-shell redirection for input (<) or output (>). Can I still use Intel® Thread Checker? Yes. Use a .BAT file as the application. For example, create a myStart.bat file with this line:
myProgram.exe < myInputFile > myOutputFile
And then follow the steps:
  1. Specify myProgram.exe as the Application to launch with the Intel® Thread Checker Wizard.
  2. Enable (check) Modify default configuration when done with wizard.
  3. Select Advanced Activity Configuration » Application/Module profiles.
  4. Select your application, which would be myProgram in this example, and then press the Configure... button.
  5. Disable (un-check) Add to Modules of Interest List, and then change the Application to Launch Filename: from myProgram.exe to myStart.bat.

Collecting Thread Checker Diagnostics Outside of the VTune™ Environment
To collect diagnostics outside of the VTune™ environment, follow this process:
  1. Compile your software using an Intel® Compiler and the /Qtcheck (on Microsoft Windows*) or -tcheck (on Linux*) switch. This option enables source instrumentation.
  2. Start your software as usual from the Windows*, DOS* or Linux* environment. For example, use Windows Explorer* to browse to your executable file and double-click on that file name.
  3. Run your software until it terminates normally. Don't forget to reduce your workload. Also because your software is instrumented, expect that it will run slower than usual.
  4. Exit (quit) your software, and a Thread Checker results ("*.thr") file is written to the working folder. If you are running on a Linux* system, transfer the .thr results file back to a Microsoft Windows* system (with Thread Checker installed) for viewing.
  5. To view the results file with Windows* Explorer, simply double-click the file. Alternatively you can start the VTune environment and open it with the File » Open File ... (NOT Open Project...) dialog. Important: Don't forget to set the file type to *.thr when using this dialog.
Keep in mind that when collecting data outside of the VTune environment, only software that has been source instrumented will be analyzed by Thread Checker. Therefore, threading errors in the not instrumented software may be missed. To ensure that all run-time code is instrumented, you must run from within the VTune environment or Microsoft .NET* Developer Environment.

Note: Many third-party libraries, such as MFC* (Microsoft Foundation Class*) libraries, create and use threads. Therefore, software that uses MFC should always be run from within the VTune environment or Microsoft .NET* Developer Environment

Analyze Multiple Processes or Executables
Intel® Thread Checker only supports one process (executable) when run from within either the VTune™ environment or Microsoft .NET* Developer Environment. Furthermore, Thread Checker only supports finding diagnostics within one process; that is it will not produce diagnostics for synchronization objects shared between processes. However if your software launches another process, Thread Checker can still be used to find threading diagnostics within either process. To use Thread Checker for either process, use source instrumentation and run your software outside of the VTune™ environment.

Using Intel® Thread Checker with Applications That Have to be started Outside of VTune
  1. Start VTune™ Performance Analyzer.
  2. Start Intel® Thread Checker Wizard to create a new project.
  3. Uncheck (de-select) Launch an Application.
  4. Check (select) Modify default configuration when done with wizard, and then click Next.
  5. Fill in your Modules of Interest. This should be your application and the DLLs (that you have symbols for) that your application depends on as it runs.
  6. Click Finish.
  7. Click Configure button to setup the Thread Checker data collector, and the select the Module Instrumentation tab.
  8. In the row with YourApp.exe, set the Force Instrumentation column to Yes. If you click No in this column, a drop down menu will appear to let you set it to Yes.

    Note: If you don't see the Force Instrumentation column, then you didn't Uncheck Launch an Application as described in step 3 above.
  9. Click OK for each of the two dialog boxes. Thread Checker will begin to instrument your software. Please be patient as this will take a while (usually several minutes).
  10. When Instrumentation has completed, Thread Checker will bring up a message box saying "It is time to run your application...". Click OK.
  11. Start your software in the usual manner from the Windows* desktop. Wait patiently for your software to complete and/or run your software until you have executed the code path(s) of interest. Execution speed will be much slower than normal as Thread Checker needs to collect a lot of data as it monitors all threads in your software; so don't forget to reduce your workload.

    Please Note: If you must abnormally terminate your software, you should use Windows Task Manager* and not the VTune environment Activity » Stop menu.
  12. When your software has terminated, go to the VTune environment and use the Activity » Stop menu (or Shift-F5) to stop Thread Checker data collection. Thread Checker results will be loaded and displayed in the VTune environment.
For more complete information about compiler optimizations, see our Optimization Notice.