Intel® VTune™ Profiler

User Guide

ID 766319
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

View Source Objects from Command Line

For better understanding of a performance problem, it is important to associate a hotspot with the source code and exact machine instruction(s) that caused this hotspot. To do this, you can open the source/assembly code directly from the command line. Use the -source-object option to switch a report to the source or assembly view mode, including associated performance data. Here is the command syntax for viewing source objects in the command line:

vtune -report <report_name> -source-object <object_type>[=]<value> -result-dir <result_path>

where

  • report_name is the specified report type (hotspots or hw-events)
  • object_type is the object type name. Possible values are: module, source-file, function.
  • value is the application unit name for which source or assembly data should be displayed
  • result_dir is a directory where your result file is located

Examples

Example 1: Report Displaying Source Data

This example generates a hotspots report that displays source data for the grid_intersect function. The report is filtered to display only data columns with source, instructions, cpi values in the title. Since the result directory is not specified, the most recent hotspots analysis result is used.

vtune -report hotspots -source-object function=grid_intersect -column=source,instructions,cpi
Source Line  Source                                Instructions Retired  CPI Rate
-----------  ------------------------------------------------------------------------  --------------------  --------
461          }
462
463
464          /* the real thing */
465          static void grid_intersect(grid * g, ray * ry)
466          {                                                                                   48,867,664     1.301
467
468
469            flt tnear, tfar, offset;
470            vector curpos, tmax, tdelta, pdeltaX, pdeltaY, pdeltaZ, nXp, nYp, nZp;
471            gridindex curvox, step, out;
472            int voxindex;
473            objectlist * cur;
474
475            if (ry->flags & RT_RAY_FINISHED)                                                   7,469,004     1.822
...

Example 2: Report with Grouped Assembly Data

This example generates a hardware events report that displays assembly data grouped by basic block and then address. The report is filtered to display only data columns with block, source, function, instructions, assembly, cpi, address values in the title.

vtune -report hotspots -r /home/results/r002hs -source-object function=grid_intersect -group-by=basic-block,address -column=block,source,function,instructions,assembly,cpi,address

Basic Block  Instructions Retired  CPI Rate  Assembly                                           Source Line  Function (Full)  Source File  Function Range Size  Start Address
-----------  --------------------  --------  -------------------------------------------------  -----------  ---------------  -----------  -------------------  -------------
0x40d340               39,900,000     2.238  Block 1                                            [Unknown]    [Unknown]        [Unknown]    [Unknown]            0
0x40d340                3,800,000     2.000  sub esp, 0xd8                                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d346                        0            mov eax, dword ptr [0x4130e0]                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d34b                7,600,000     0.750  xor eax, esp                                       466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d34d                3,800,000     4.500  mov dword ptr [esp+0xd4], eax                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d354                5,700,000     0.333  push esi                                           466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d355                1,900,000     1.000  mov esi, dword ptr [esp+0xe4]                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d35c                1,900,000    10.000  push edi                                           466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d35d                3,800,000     0.500  mov edi, dword ptr [esp+0xe4]                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d364                1,900,000     2.000  mov dword ptr [esp+0x74], edi                      466          grid_intersect   grid.cpp     0x646                0x40d340
0x40d368                3,800,000     3.500  test byte ptr [esi+0x8], 0x8                       475          grid_intersect   grid.cpp     0x646                0x40d340
0x40d36c                5,700,000     0.667  jnz 0x40d96f <Block 64>                            475          grid_intersect   grid.cpp     0x646                0x40d340
0x40d372                9,500,000     3.800  Block 2                                            [Unknown]    [Unknown]        [Unknown]    [Unknown]            0
0x40d372                        0     0.000  lea eax, ptr [esp+0x50]                            478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d376                                     push eax                                           478          [Unknown]        [Unknown]    [Unknown]            [Unknown]
0x40d377                1,900,000    11.000  lea eax, ptr [esp+0x8c]                            478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d37e                1,900,000     0.000  push eax                                           478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d37f                3,800,000     1.000  push esi                                           478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d380                        0            push edi                                           478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d381                1,900,000     1.000  call 0x40e4a0 <grid_bounds_intersect>              478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d386               15,200,000     2.375  Block 3                                            [Unknown]    [Unknown]        [Unknown]    [Unknown]            0
0x40d386               13,300,000     2.286  add esp, 0x10                                      478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d389                1,900,000     3.000  test eax, eax                                      478          grid_intersect   grid.cpp     0x646                0x40d340
0x40d38b                                     jz 0x40d96f <Block 64>                             478          [Unknown]        [Unknown]    [Unknown]            [Unknown]
0x40d391                3,800,000     2.000  Block 4                                            [Unknown]    [Unknown]        [Unknown]    [Unknown]            0
0x40d391                        0     0.000  movsd xmm0, qword ptr [esp+0x88]                   481          grid_intersect   grid.cpp     0x646                0x40d340
0x40d39a                3,800,000     1.000  comisd xmm0, qword ptr [esi+0x48]                  481          grid_intersect   grid.cpp     0x646                0x40d340
0x40d39f                        0            jnbe 0x40d96f <Block 64>                           481          grid_intersect   grid.cpp     0x646                0x40d340
0x40d3a5                5,700,000     2.000  Block 5                                            [Unknown]    [Unknown]        [Unknown]    [Unknown]            0
0x40d3a5                1,900,000     1.000  sub esp, 0x8                                       484          grid_intersect   grid.cpp     0x646                0x40d340
0x40d3a8                1,900,000     1.000  lea eax, ptr [esp+0x10]                            484          grid_intersect   grid.cpp     0x646                0x40d340