Use new Pause and Resume API from Intel VTune Amplifier XE 2011

Since some users only collect performance data in specific sections of their code, they like to use "Pause and Resume API" to control data collection. VTune™ Performance Analyzer supports this powerful function. As a next generation of performance analyzing tool, Intel VTune™ Amplifier XE 2011 also supports this feature, however some APIs names have changed.

The main change is that the new tool uses static linking libraries instead of dynamic libraries. In addition, libraries name have changed.

Where is the include file?

Amplifier XE 2011\include\ittnotify.h, for Windows

vtune_amplifier_xe/include/ittnotify.h, for Linux

The user has to add new item into INCLUDE PATH of project's property.

itt_api_1.jpg


Where is the library file?

Amplifier XE 2011\lib32(lib64)\ittnotify.lib, for Windows

vtune_amplifier_xe/lib32(lib64)/libittnotify.a, for Linux


The user has to add new item into LIB PATH of project's property.

itt_api_2.jpg

The user also has to add new library name into Linker's Input dialog

itt_api_3.jpg
 

Please see a simple example below that shows how Pause and Resume API work in user's code.



// test_itt_api.cpp : Defines the entry point for the console application.

//

 

#include "stdafx.h"

#include "ittnotify.h"

 

void foo_data_collected()

{

         for (int i=0; i<10000000L; i++);

}

 

void foo_data_not_collected()

{

         for (int i=0; i<10000000L; i++);

}

 

int _tmain(int argc, _TCHAR* argv[])

{

          // Assume that data collector was paused in user interface

          foo_data_not_collected();

 

          // Now resume data collecting

          __itt_resume();

          foo_data_collected();

 

          // Pasue data collecting again

          __itt_pause();

          foo_data_not_collected();

 

          // Resume data collecting again

          __itt_resume();

          foo_data_collected();

 

          // The user shouldn't see data collecting in foo_data_not_collected() in result

 

          return 0;

}


After building above code and selecting Hotspots as Analysis Type, click "Start Paused" button to collect data. Data will be collected when __itt_resume() is executed.

itt_api_4.jpg

Now we can observe the result of Hotspots Analysis; only function foo_data_collected() data is captured.

itt_api_5.jpg

Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.