Profiling code in a Windows sidebar environment

Does anyone know how I can generate the code for my Windows sidebar gadget?

I played with the code profiling tool in IE8 "Developer Tools" and the code profiling included in Visual Studio 2010, but I can’t find a way to enable the System.* API that my gadget relies on (as standard in the sidebar environment). The gadget also relies on cross-domain AJAX requests; which is usually enabled in a sidebar environment.

By code profiling, I mean first of all:

  • Function Call Count
  • Function execution time

I tried using Visual Studio 2010 and Performance Wizards:

  • The "Instrumentation" mode is used with the selected "ASP.NET Application or JavaScript". However, the gadget opens in Internet Explorer instead of the Windows sidebar
  • Using Instrumentation mode with the Executable file option selected and Sidebar.exe selected. However, I get the error message "Error VSP1030: Invalid, invalid or missing PDB file was found for C: \ Users \ Matt \ Desktop \ Windows Sidebar \ sidebar.exe"
  • Selected processor selection mode with selected ASP.NET or JavaScript application. However, the gadget opens in Internet Explorer instead of the Windows sidebar

When using the "Attach to process" option in the "Analysis → Profiler" menu, I can successfully connect to the sidebar.exe process, but the profiler returns information about the actual sidebar process and no information about my gadget.

I do not have a Project / Solution file for my gadget.

Regards, Matt

+4
source share
1 answer

I am on the VS Profiler team, so feel free to ask any clarifying questions.

If you need accurate indicators (lead time, number of calls), you should use the toolkit. Using the toolkit, the profiler will show you data for any binary files that you use, as well as one level of calls (for example, if you call string.Concat directly from your instrumental binary file, the profiler will show you how many times you called it and how long ( collectively) caused by calls). The profiler will not show you data for binary files that you are not using.

Have you tried profiling tools? What data do you see?

If you want, you can also try a statistical approach to profiling: sampling. Sampling is lighter than a tool, and is often good as a first pass to understand at a high level where your processor works most. When fetching, the profiler takes snapshots of the call stack at specific intervals (this is like splitting into a debugger to see what is currently running). Then it combines the snapshots to create a call tree.

If you give me a better idea of ​​how you are trying to profile, I can help you more. Are you using a profiler from VS or from the command line? Do you have a VS / project solution for your sidebar gadget?

You can also check our blog or our MSDN for more information.


Update:

The profiling functionality of the JavaScript profiler was primarily focused on IE8, so I'm not sure that it will collect data against another process, such as sidebar.exe, which (I assume) hosts the IE IE engine. However, you should at least be able to use a profiler to collect data against your managed code.

For the toolkit, you will need the second option ("Executable file"), and in the Performance Explorer you will want to have two goals:

  • sidebar.exe, not instrumental (since you do not have PDB) - you can right-click the target and uncheck the "Tool" box to suppress hardware
  • foo.dll (no matter what you call the Gadget DLL), you need to manually add this target (right-click on the "Targets" folder, select "Add Target Binary File ..."), but be sure to turn on the "Tool" and make sure his PDB is next to him.

To learn more about performance goals, see this blog post . With this setting, just click the "Start profiling" button. The toolkit must be successful, and you should get trace profiling data for your gadget.

For selection, you can start or join the process. Joining a process only works if:

  • The process runs on CLR v4; or
  • The process has the correct profiling environment variables (see below what this means)

Profiling the CLR process to V4 requires some environment variables to be set in the target process. Essentially, you will need to kill the sidebar.exe process and then restart it using the profiler command-line tools. A step-by-step guide on how to do this is available on MSDN .

Another option, fetching, can be done from the command line (see the MSDN article again) or from the VS user interface. Select "Processor Selection" with "Executable (.EXE)", then close all currently running instances of sidebar.exe, right-click on the newly created target in Performance Explorer, select "Properties" and change the command if necessary. Then you should run the profiler.

Let me know if you have more problems. Sorry, this is not easier.

+2
source

Source: https://habr.com/ru/post/1309584/


All Articles