none
VS2010 stand-alone profiler /processon:<PID> switch not working

    Question

  • Hi,

    I have .NET 4.0 binaries (AnyCPU) running as Service on Win 2008 R2 Server (x64) and i am using VS2010 stand-alone profiler. I use the commands from the x64 folder of VS2010 stand-alone profiler.

    I have instrumented my binaries - however, the same deployed binaries are used to run multiple services - so there are multiple instances running for that binary. I want to collect profiling data only for one of the service.

    I start profiling monitor with VsPerfCmd /start:trace /output:myservice.vsp /user:SYSTEM /CS:0 /globaloff

    Note the /globaloff switch - i dont want to collect data for service startup. Then I start the service(s).

    Then I switch on data collection for the service i am interested in:

    VsPerfCmd /processon:<service pid>

    After running some use cases, I shutdown service and shutdown profiler. However, no data is collected in the VSP file [error - File contains no data buffers]

    If i start profiler without the /Globaloff switch everything works fine - but I get data for startup sequence and also other processes information in the VSP.

    What am i doing wrong?

    Thanks.

    Friday, December 28, 2012 2:29 PM

All replies

  • Hi _YatishK,

    As you said that it worked well if you don’t use the /Globaloff, I doubt that it is related to the steps with it.

    Chris shared us the detailed steps with /globalon and /globaloff in this thread “Visual Studio 2005 Crashes when analysing the vsp generated after Instrumentation.”, like the following contents:

    vsinstr myprogram.exe (only needs to be done once each time you build your application)

    vsperfclrenv /traceon (only if you're profiling a managed application)

    vsperfcmd /start:trace /output:Report.vsp

    vsperfcmd /globaloff (pause profiling)

    <start your application>

    <get to the beginning of the scenario you care about>

    vsperfcmd /globalon (resume profiling)

    <exercise your scenario>

    vsperfcmd /shutdown

    Reference:

    GlobalOn and GlobalOff: it also shared us a sample in this MSDN document.

    Hope it could provide useful information.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 31, 2012 6:14 AM
    Moderator
  • Hi Jack,

    Thanks a lot for your reply. The /GlobalOn and /GlobalOff switches work fine. However, as I had mentioned the same binary is being used by multiple services. Meaning if there is MyService.exe which I have instrumented, there are 5 services which run the same MyService.exe. Which means at a given time there are 5 instances of MyService.exe running (I have to keep all 5 services running for my test case to complete correctly - I cannot turn them off).

    If I use just the /GlobalOff and /GlobalOn switches as you have shown, data for all the 5 instances is collected in the VSP. I dont want that - I want to collect data for only one instance.

    Like in sampling mode you can say /attach:<pid>, and collect data only for one process. I want to collect data only for one process in Instrumentation. Thats why i was loooking at /ProcessOn:<pid> switch - which is not working for me and hence I posted the original question.

    So, if I re-phrase my question - What should be the correct procedure to collect profiling data only from one instance(process) of an executable (running as service) when there are multiple instances running at the same time?

    I hope question is clear now.

    Thanks a lot.

    Tuesday, January 01, 2013 10:07 PM
  • Hi _YatishK,

    Sorry for my misunderstanding about this issue.

    We could starts (/processon) or stops (/processoff) data collection for the process specified by the PID. So your steps would be correctly like the “Controlling Data collection” in this document. Maybe you could try to profile a simple process with it, and then check the result. If it worked well, so we could make sure that it is not related to the steps in the command line. To make sure that it is not related to the Environment, how about profiling it in other machine?

    In addition, would you mind sharing us the detailed Performance error message? Maybe we could find more useful information, thanks for your understanding.

    Sincerely,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 02, 2013 2:40 AM
    Moderator
  • Hi _YatishK,

    I am writing to check the status of the issue on your side. 

    What about this problem now?

    Would you mind letting us know the result of the suggestion?

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 07, 2013 3:10 AM
    Moderator
  • Hi Jack,

    Sorry for the delay, I got stuck with some other issues and could not spend more time here.

    Currently, I am getting around the problem by just using /Global{on|off}, which collects data for all five instances and then while analyzing VSP in visual studio, I apply filter so that it shows data only for one process. However, since I collect data for all instances, VSP file gets large in size. Thats why I wanted to collect data only for one instance.

    As soon as I get some time, I'll try the tests you've mentioned and also I want to try the new VS2012 stand alone profiler.

    I'll get back as soon as I can, but could take couple days.

    Thanks a lot for your understanding.

    Regards,
    Yatish.

    Monday, January 07, 2013 7:01 PM
  • Hi Yatish,

    Glad to receive your reply.

    Since you will follow up this issue in couple days, would you mind changing the issue type to General Discussion?

    If you have more time to look at the issue and provide more information, please feel free to change the issue type back to Question by opening the Options list at the top of the post editor window, and changing the type. 

    If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 08, 2013 2:03 AM
    Moderator
  • Hi Jack,

    I tested with a sample winforms application - tested on Widows 2008 R2 server and also on Windows 7 x64. I also tested with VS 2012 stand alone profiler - all results are negative and I dont get eny data in  the VSP file if I use /processon:PID.

    Below is the output of one of my sessions command window. You will see I started three instances of WinApp.exe and then set /processon for one of the PIDs. Then I made some user interaction with that process. Then I set /GlobalOff again and then closed all three processes and shutdown profiler. There is no data in the VSP.

    D:\winapp>PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\x64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools
    D:\winapp>vsinstr WinApp.exe
    Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x64
    Copyright (C) Microsoft Corp. All rights reserved.
    
    Warning VSP2006: Could not locate PDB for  D:\winapp\WinApp.exe
    File to Process:
       D:\winapp\WinApp.exe --> D:\winapp\WinApp.exe
    Original file backed up to D:\winapp\WinApp.exe.orig
    
    Warning VSP2001: D:\winapp\WinApp.exe is a strongly named assembly.  It will need to be re-signed before it can be executed.
    Successfully instrumented file D:\winapp\WinApp.exe.
    
    D:\winapp>sn -R WinApp.exe MyKey.snk
    
    Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Assembly 'WinApp.exe' successfully re-signed
    
    D:\winapp>VSPerfCLREnv /traceon
    Enabling VSPerf Trace Profiling of managed applications (excluding allocation profiling).
    
    Current Profiling Environment variables are:
    COR_ENABLE_PROFILING=1
    COR_PROFILER={d9db81db-81fe-4611-815d-144ad522e1b1}
    COR_LINE_PROFILING=0
    COR_INTERACTION_PROFILING=0
    COR_GC_PROFILING=0
    
    D:\winapp>VsPerfcmd /start:trace /output:c:\VSP\TestWinapp.VSP /Globaloff
    Microsoft (R) VSPerf Command Version 11.0.50727 x64
    Copyright (C) Microsoft Corp. All rights reserved.
    
    
    Global logging control
    ------------------------------------------------------------
    Setting global profile state to OFF.
    
    D:\winapp>WinApp.exe
    
    D:\winapp>WinApp.exe
    
    D:\winapp>WinApp.exe
    
    D:\winapp>VsPerfcmd /processon:3024
    Microsoft (R) VSPerf Command Version 11.0.50727 x64
    Copyright (C) Microsoft Corp. All rights reserved.
    
    
    Process logging control
    ------------------------------------------------------------
    Setting process 3024 profile state to ON.
    
    D:\winapp>VsPerfcmd /Globaloff
    Microsoft (R) VSPerf Command Version 11.0.50727 x64
    Copyright (C) Microsoft Corp. All rights reserved.
    
    
    Global logging control
    ------------------------------------------------------------
    Setting global profile state to OFF.
    
    D:\winapp>VsPerfcmd /Shutdown
    Microsoft (R) VSPerf Command Version 11.0.50727 x64
    Copyright (C) Microsoft Corp. All rights reserved.
    
    
    Shutting down the Profile Monitor
    ------------------------------------------------------------
    
    D:\winapp>set _NT_SYMBOL_PATH=srv*C:\symss*http://msdl.microsoft.com/download/symbols
    
    D:\winapp>"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerfReport.exe" c:\VSP\TestWinapp.VSP /packsymbols
    
    Microsoft (R) VSPerf Report Generator, Version 11.0.0.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    File opened
    Successfully opened the file.
    File contains no data buffers
    File contains no data buffers
    Analysis completed
    File contains no data buffers
    File contains no data buffers
    Analysis completed
    File contains no data buffers
    File contains no data buffers
    Analysis completed

    Tuesday, January 22, 2013 1:32 PM
  • Hi Jack,

    I performed the tests and your suggestions. I also shared the error messages.

    Wanted to check if you have any feedback for me?

    Thanks.

    Regards,
    Yatish.

    Tuesday, January 29, 2013 10:37 PM