Freigeben über


The low-rent guide to WPF profiling

Since I posted my initial article on command-line profiling, I've found a number of folks copy/paste off of it fairly often, with moderate success.  If you don't want to know all of the 'why's' and just want to get your profile, run the the following steps and copy/paste the commands.

1.  Install VSTS Team Suite or VSTS Team Edition for Developers, and open a command prompt.

2.  Setup your environment.  Copy/paste the following 4 commands into the command window.

set PATH=%PATH%;"C:\Program Files\Microsoft Visual Studio 8\Team Tools\Performance Tools"

VSPerfClrEnv.cmd /sampleon

vsperfcmd /start:SAMPLE /output:MyOutput.vsp

vsperfcmd /globaloff

3. Launch the profiler. You have 2 options -- attaching or launching. Use 'b' to measure startup costs, otherwise, you should normally use'a'.

a. Attaching (to measure anything after startup).

VERY IMPORTANT - Launch your application from the -command window- before running the following 2 commands. If you don't, managed code won't be profiled.

vsperfcmd /attach:MyTest.exe

vsperfcmd /globalon

b. Launching (to measure startup time)

vsperfcmd /globalon

vsperfcmd /launch:MyTest.exe

4. Now that profiling is enabled, perform the action you want to measure.

5. Stop profiling, shutdown the profiler, and generate your VSP.

vsperfcmd /globaloff

vsperfcmd /shutdown

6. Close your application.

7. Pack symbols. (Make sure your in the directory where your VSP lives, which is the same directory 'vsperfcmd /start' was issued from)

xcopy /E "C:\Documents and Settings\timothyc\My Documents\Visual Studio 2005\Projects\MyTest\MyTest\bin\Release\*.PDB" .

vsperfreport /summary:all /packsymbols MyOutput.VSP

Comments

  • Anonymous
    September 26, 2006
    Hi, I have read the whole of your blog and the links that you provide and it doesn't mean a great deal to me. I am a designer with a good understanding of xaml but that's all. What I was hoping to learn, and I posted on EID forums, was the basics of what makes my application run more efficiently and they pointed me here.

    I primarily work with 3D and so far I have been guessing 1. geomerty complexity 2. materials (image files) which seem to have a massive effect 3. animation complexity 4. xaml code efficiency.

    but that is all supposition on my part through trial and error. I don't even know how my work is rendered? is it a live render or do, as I suspect, only certain elements get rendered? so the non moving objects are rendered first in and not again then only items with some kind of translation are rendred in real time.

    Sorry I could go on but you get the idea. Is there anywhere I can go that speaks my language and not this wonderful technospeak that baffles me?

    thank you very much and I am sure its a great blog - if only I could understand it. Thanks again

  • Anonymous
    September 27, 2006
    Thank you so very much for posting your comment.  This request is really interesting because it's not something I've personally heard before.  On the WPF perf team, we get lots of feedback from coders, but less so from designers.  It's really interesting to think about the perf experience from a different viewpoint.

    I'm going to go talk to some other folks who work with designers more often and see what I can't learn ... for both of us!

    Tim

  • Anonymous
    September 27, 2006
    Thank you very much Tim I appreciate it. I fully support the Microsoft model with regard to designer/developer but there is a huge amount you can do just as a designer, you don't actually need a coder if you understand design apps and xaml. I would never see myself building and app and the asking a coder to verify it. I work for myself, I can't afford the overhead and I have already created cool stuff without the use of c# or vb. Happy to share some of my work (in the form of a video) if you need more clarification on what I am doing.

    thanks again.

  • Anonymous
    May 29, 2009
    PingBack from http://paidsurveyshub.info/story.php?title=tim-cahill-wpf-performance-guidance-thoughts-amp-tips-the-low-rent

  • Anonymous
    June 19, 2009
    PingBack from http://mydebtconsolidator.info/story.php?id=15794