Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_G_5
Beginner
134 Views

Cannot see function names when profiling C# managed code

Hello,
I am unable to see any function names when doing a Hotspots Analysis of C#.  I am trying the VTune sample project serial_nqueens_csharp with VTune 2016 and Visual Studio 2015.  I see the sample project only has solutions/projects for vs2008 and vs2010 - not sure if that is relevant.  By comparison everything in VTune is working fine for C++ profiling.

Here is what it looks like on the Basic Hotspots Summary tab for serial_nqueens_csharp:

    Function                     Module CPU        Time
    -----------------------------------------------------
    [Outside any known module]   [Unknown]         3.515s
    func@0x6427830d8bc           mscorlib.ni.dll   0.249s
    -----------------------------------------------------

This is from the Bottom-Up tab:

    CPU Time
    1 of 1: 100.0% (3.515s of 3.515s)

    null ! [Outside any known module] - [unknown source file]
    null ! [Unknown stack frame(s)] - [unknown source file]
    MSCOREE.DLL ! CorExeMain_Exported + 0x68 - [unknown source file]
    KERNEL32.dll ! BaseThreadInitThunk + 0xc - [unknown source file]
    ntdll.dll ! RtlUserThreadStart + 0x20 - [unknown source file]

Visual Studio is generating the pdb file (serial_nqueens_csharp.pdb) alongside the exe but VTune just doesn't seem to be processing it to get the symbols.  Did support for C# get dropped for versions past vs2010?

I have had the same issue in "VTune Amplifier XE 2015 update2" before upgrading to "VTune Amplifier XE 2016 update2" which still has the problem.  Please advise!

Thanks,
-Mike

0 Kudos
4 Replies
Peter_W_Intel
Employee
134 Views

I guess that you worked in Visual Studio* (my version is 2013), you need to open serial_nequeens_csharp.sln in your environment, then build "Debug", you can see  serial_nqueens_csharp.exe and serial_nqueens_csharp.pdb generated in vc10\bin\Debug.

Yes. I can repeat your problem in Visual Studio, said [Outside any know module] 4.17s ... Vtune's result is under "vc10\My Amplifier XE Results - serial nqueens_csharp", result cannot resolve the function name since pdb file locates at another path.

Using command line to solve this problem quickly:

cd vc10\bin\Debug

>amplxe-cl -c hotspots -- serial_nqueens_csharp.exe

>amplxe-cl -R hotspots -r r000hs | more

[cpp]

Function                                                   CPU Time  CPU Time:Ef
fective Time  CPU Time:Effective Time:Idle  CPU Time:Effective Time:Poor  CPU Ti
me:Effective Time:Ok  CPU Time:Effective Time:Ideal  CPU Time:Effective Time:Ove
r  CPU Time:Spin Time  CPU Time:Overhead Time  Module                     Functi
on (Full)                                                                   Sour
ce File        Start Address
---------------------------------------------------------  --------  -----------
------------  ----------------------------  ----------------------------  ------
--------------------  -----------------------------  ---------------------------
-  ------------------  ----------------------  -------------------------  ------
--------------------------------------------------------------------------  ----
-------------  -------------
Intel::VTuneAmplifierXE::Samples::SerialNQueens::SetQueen    3.907s
      3.907s                            0s                        3.907s
                  0s                             0s                            0
s                  0s                      0s  serial_nqueens_csharp.exe  Intel:
:VTuneAmplifierXE::Samples::SerialNQueens::SetQueen(int32[], int32, int32)  seri
al_nqueens.cs  0x7ff00190f10
System::Math::Abs                                            0.581s
      0.581s                            0s                        0.581s
                  0s                             0s                            0
s                  0s                      0s  mscorlib.dll               System
::Math::Abs(int32)                                                          [Unk
nown]          0x7fee316d8c0

[/cpp]

Peter_W_Intel
Employee
134 Views

If you want to locate the symbols, PDB file is not at current directory, you can do -

[cpp]

C:\\temp\\serial_nqueens_csharp\\vc10\My Amplifier XE Results - serial_nqueens_csharp>

amplxe-cl -c hotspots -search-dir=..\\bin\\debug -- ..\\bin\\debug\\serial_nqueens_csharp.exe

C:\\temp\\serial_nqueens_csharp\\vc10\\My Amplifier XE Results - serial_nqueens_csharp>

amplxe-cl -R hotspots -r r001hs|more

Function                                                   CPU Time  CPU Time:Effective Time  CPU Time:Effective Time:Idle  CPU Time:Effective Time:Poor  CPU Time:Effective Time:Ok  CPU Time:Effective Time:Ideal  CPU Time:Effective Time:Over
  CPU Time:Spin Time  CPU Time:Overhead Time  Module                     Function (Full)                                                                   Source File        Start Address
---------------------------------------------------------  --------  -----------
------------  ----------------------------  ----------------------------  ------
--------------------  -----------------------------  ---------------------------
-  ------------------  ----------------------  -------------------------  ------
--------------------------------------------------------------------------  ----
-------------  -------------
Intel::VTuneAmplifierXE::Samples::SerialNQueens::SetQueen    4.063s
      4.063s                            0s                        4.063s
                  0s                             0s                            0
s                  0s                      0s  serial_nqueens_csharp.exe  Intel:
:VTuneAmplifierXE::Samples::SerialNQueens::SetQueen(int32[], int32, int32)  seri
al_nqueens.cs  0x7ff00170f10
System::Math::Abs                                            0.426s
      0.426s                        0.004s                        0.422s
                  0s                             0s                            0
s                  0s                      0s  mscorlib.dll               System
::Math::Abs(int32)                                                          [Unk
nown]          0x7fee316d8c0

[/cpp]

Michael_G_5
Beginner
134 Views

 

This is a great tip, thanks.  It demonstrated that there was nothing wrong with the core VTune product for profiling C# code.  But that the issue is just a quirk of the VTune gui that is integrated with Visual Studio.

This is the way that was found to fix it through Visual Studio 2015

  • VTune -> New Analysis -> Analysis Target
  • Untick "Inherit settings from Visual Studio project"
  • Then switch "Managed code profiling mode" to "Managed".

Even though it is a C# project the "Managed code profiling mode" is set to "Native" and the control is grayed out until the "Inherit settings ...' is unticked.  Have to leave "Inherit settings" unticked otherwise the profiling mode switches back automatically to "Native".

Thanks again.

 

134 Views

Hello Mike,

You are great in the problem triage and root cause! ;-)

We acknowledge the issue with inheritance "Managed code profiling mode" from Visual Studio. The fix will be released in future VTune Amplifier product update.

Thanks and Regards, Katya

 

Reply