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
- To create a profiling configuration file, open a command prompt and change to the dotTrace installation directory:
cd c:Program Files (x86)JetBrainsdotTracev5.2Bin
- Run Configuration2Xml.exe with the full path of the configuration file that you want to create:
N.B. Running Configuration2Xml.exe with an existing profiling configuration file will edit the file rather than overwriting it.
- The Profile Application dialog will open. Select the type of application that you want to profile and click OK:
- The Profiler Configuration dialog will open. Select the profiler options that you want to use and click Save:
- Configuration2Xml.exe will create the specified profiling configuration XML file.
- To start profiling, run dotTraceProfiler.exe with the profiling configuration file:
- 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.
- /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!