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

For more complete information about compiler optimizations, see our Optimization Notice.

Comments

's picture

The API looks good and even works on Windows. But on Linux, using VTune Amplifier XE 2011 (build 128765), it does not link. The link fails unable to find the __itt_resume_ptr_ or __itt_pause_ptr_. Both entries are there in the objdump output of the libittnotify.a in the lib64 directory but they are marked as .data.

If you have any info on this, please let me know. bdavies@intel.com

Bob Davies

Sergey Kostrov's picture

Thanks for the example! Is that some kind of Automation?

Peter Wang (Intel)'s picture

The working mode is to start data collection in "pause" mode from commad line or GUI, user code decides where to do collect collection and where not to do. Can we say it "Automation"?

's picture

I have the same problem on Linux. unable to link __itt_resume_ptr__3_0 or __itt_pause_ptr__3_0
could you help me with this please?

Oleg Iegorov

Peter Wang (Intel)'s picture

For completely trying example code (C/C++ code and Fortran code) step by step, please see http://software.intel.com/en-us/articles/how-to-call-resume-and-pause-api-from-fortran-code/