Profiling from the Command Line using dotTrace Performance

Did you know that you can run dotTrace Performance from the command line? Why would you want to run it from the command line? Maybe you want to share the same profiling configuration across the team? Maybe you want to run it as part of your build process? Maybe you want to run dotTrace as part of a larger testing process with other command line tools?

There are lots of reasons why you might want to run dotTrace Performance from the command line. Let’s look at how we can do exactly this.

Profiling from the command line is divided into two steps. First we create a configuration file that specifies the options we want to use. Next we launch dotTrace Performance using that profiling configuration file.

Creating a profiling configuration file

  1. To create a profiling configuration file, open a command prompt and change to the dotTrace installation directory:
    cd c:Program Files (x86)JetBrainsdotTracev5.2Bin
  2. Run Configuration2Xml.exe with the full path of the configuration file that you want to create:
    .Configuration2Xml.exe <ConfigFilePath>
    For example:
    .Configuration2Xml.exe c:codeProfilingConfiguration.xml
    N.B. Running Configuration2Xml.exe with an existing profiling configuration file will edit the file rather than overwriting it.
  3. The Profile Application dialog will open. Select the type of application that you want to profile and click OK:
    Profile Application
  4. The Profiler Configuration dialog will open. Select the profiler options that you want to use and click Save:
    dotTrace Profiler Configuration
  5. Configuration2Xml.exe will create the specified profiling configuration XML file.
    dotTrace XML configuration file

Profiling

  1. To start profiling, run dotTraceProfiler.exe with the profiling configuration file:
    .dotTraceProfiler.exe <ConfigFilePath>
    For example:
    .dotTraceProfiler.exe c:codeProfilingConfiguration.xml
  2. Once the application exits, a DTP file will be written in the current working directory, which can be opened and analyzed in dotTrace Performance.


For additional control of profiling, dotTraceProfiler.exe has a number of optional command line arguments:

  • /showcontroller: Open the profile controller dialog where you can start/stop profiling, capture snapshots, and detach/kill the profiled process.
    dotTrace controller
  • /output=<OutputPath>: Specify the file name and/or directory where snapshots should be saved.
  • /rawformat: Use an uncompressed snapshot format for faster processing and saving at the expense of increased file size.

dotTrace Performance can easily be orchestrated from the command line and integrated into your development process. Profile with pleasure!

This entry was posted in dotTrace Tips&Tricks, How-To's and tagged , , . Bookmark the permalink.

2 Responses to Profiling from the Command Line using dotTrace Performance

  1. Alec says:

    /showcontroller: Open the profile controller dialog where you can start/stop profiling, capture snapshots, and detach/kill the profiled process.

    This part doesn’t look like something that can run on a build server and I can’t find any documentation reference on the command line.

    How can the following situations be handled completely with the command line with no user intervention.

    IIS is running multiple app pools so the PID of the specific w3wp must be passed in to collect data on the right one. I want to start a capture, collect data for a minute, and then stop and save a snapshot.

    What if I want to use the new feature to attach to a running process?

  2. jkovacs says:

    @alec – I’ve spoken to the development team. I’ve got good news and bad news. The bad news is that your scenario isn’t possible at the moment using the current command line support. The good news is that the dev team thinks that it’s a good idea and plans to add support for your scenario in a future version.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">