Profiling with VTune

From Apache OpenOffice Wiki
Jump to: navigation, search

Introduction

VTune is a utility for profiling applications, available for all Windows platforms and for Linux. If you don't have a licensed version yet, you may download an evaluation version from www.intel.com. Usually, you can get it from here

Preparations

Install the latest version of OpenOffice.org. Use a product build, because debug builds might use less compiler optimizations, and have a lot of overhead starting with simple assertions and ending in expensive integrity checks in some modules.

Depending on how deeply you want to analyze OOo modules, you might need some debug information (but still a product build!).

In opposite to debuggers, it seems that VTune doesn't find PDB files in their original location or via the _NT_SYMBOL_PATH, so you must copy them next to the DLL. Make sure to copy the DLL and PDB files to the correct directory (program, Basis\program or URE\bin).

 Hint for engineers at Sun Hamburg: 
 All PDB files are located on a network share, so you can copy them easily by calling 
   for %xy in (*.dll) copy o:\%WORK_STAMP%\wntmsci12.pro\pdb.%UPDMINOR%\%@NAME[%xy].pdb
 in the different program directories (4NT shell required).

For profiling, what you really want to profile is soffice.bin, not the loader soffice.exe. But VTune doesn't allow you to choose soffice.bin for profiling, so you need to delete soffice.exe and rename soffice.bin to soffice.exe.

If you want to make a call graph analysis, you also need to link soffice.bin a little bit differently: In the desktop module, delete wntmsci12.pro\bin\soffice.exe, set environment variable LINK=/fixed:no and rebuild the module. The resulting soffice.exe is what you normally find as soffice.bin in the installation set, while officeloader.exe is what you normally find there as soffice.exe.

Working with VTune

Without the launcher, soffice will not find the libraries in the other layers, so you need to set the PATH manually:

 set PATH=%PATH%;<ooo-root>\openoffice.org 3\Basis\program;<ooo-root>\openoffice.org 3\URE\bin

This could be done system wide, but assuming that you might work with different OOo versions, it's better to do it in a shell, and then also start VTune from that shell so it has the same PATH environment.

In VTune, start a new project and select the appropriate Wizard. For a quick overview the Sampling Wizard might be sufficient, while for deeper analysis you might want to choose the Call Graph Wizard. On the second next dialog page, select the program you want to profile (see „Preparations“ above for hints on soffice.bin/exe). You might want to check „Modify default configuration“ instead of „Run Activity when done“.

In the „Advanced Activity Configuration“ / „Configure Call Graph“, decide which level of details you want/need.

 Attention: There seems to be a bug in VTune when you instrument msvcr90.dll. 
 The application will crash. As a work around, choose „Configure Call Graph“, 
 and set instrumentation level for msvcr90.dll to „minimal“.

When all settings are done, let OOo run, and see afterward what VTune will tell you.

More details / hints on this to come later...

Personal tools