Profiling from the command line (API)
Published 14 May 2018
Profiling from the command line is only available in ANTS Performance Profiler Professional edition.
To run a profiling session from the command line, run Profile.exe with the appropriate options.
For example, to profile an executable called SimpleApp.exe using line-level timings and saving results as a CSV file, use:
Profile.exe /e:"C:\testing\SimpleApp.exe" /ll /csv:"C:\testing\results.csv"
Profiling applications from the command line is useful if you want to integrate performance profiling in an automated test procedure. For more information on this, see Integrating ANTS Performance Profiler in a test procedure.
Profiling IIS from the command line
Applications that run on IIS Express or the ASP.NET web development server (Cassini) can be profiled directly from the command line. You cannot currently profile applications which run on IIS 5, 6, 7, 7.5, or 8 from the command line.
To work around this limitation:
- Profile IIS from the ANTS Performance Profiler graphical user interface; see Profiling ASP.NET applications running on IIS.
- When you have finished profiling, on the File menu, click Save Session Settings.
- Use the
/projectargument on the command line to load the saved session settings.
- Interact with your application (for example through a web browser or client application. You can interact with your code manually or via automated calls, if your application can be run from the command line).
This will execute the managed code to be profiled.
Arguments for IIS Express profiling are included below.
List of command line arguments
/help (Alias: /?)
Displays this help message. Use in conjunction with
/verbose for more detailed information.
If this switch is used with any switches other than
outputwidth, those switches will be ignored, the help message will be printed, and 0 will be returned as the process exit code.
Causes help to be output as HTML.
Must be used with the
/quiet (Alias: /q)
Quiet mode - no output.
/verbose (Alias: /v)
/force (Alias: /f)
Forces overwriting of output files that already exist. If this flag is not set and a file already exists then program will exit with an exit code indicating an I/O error.
File containing the XML argument specification.
Redirects console output to the specified file.
/project:<project> (Alias: /p)
A performance profiler session settings that will be used to begin profiling.
(Session settings files were called 'projects' in version 7.4 and earlier.)
/executable:<filepath/executable> (Alias: /e)
The filepath to an executable to run in the profiler.
/arguments:<arguments> (Alias: /args)
The arguments to pass to the executable.
/workingDirectory:<workingDirectory> (Alias: /wd)
The working directory to use when profiling the application.
The port that web applications running on IIS Express or the ASP.NET web development server (Cassini) should be profiled on (default: 8013).
/cassini (Alias: /webdev)
Profile on the ASP.NET web development server (Cassini).
/cassiniPath:<cassiniPath> (Alias: /cpath)
The location of the ASP.NET project to use with the ASP.NET web development server (Cassini).
/cassiniVirtualDirectory:<cassiniVirtualDirectory> (Alias: /cvd)
The virtual directory to use for the ASP.NET web development server (Cassini).
/cassiniNetVersion:<cassiniNetVersion> (Alias: /cnv)
If Visual Studio 2010 or later is installed, this is the version of .NET to use when running on the web development server (Cassini). Default: 0
Profile on the IIS Express webserver.
/expressSitePath (Alias: /epath)
The path where the website can be located on the disk.
/expressConfigPath (Alias: /config)
The path to an applicationHost.config file to load.
/expressSiteName (Alias: /site)
The site name to load from an applicationHost.config file. By default the first site found will be used.
/expressNetVersion (Alias: /env)
The version of .NET (2.0 or 4.0) to use when running IIS Express. If you are using .NET 3.5, choose .NET 2.0. If you are using .NET 4.5, choose .NET 4.0.
The name of a Windows service to profile.
The name of a COM+ server to profile.
The URL of a site containing a Silverlight application to profile.
Note: Silverlight support was removed in ANTS Performance Profiler 10.1.
/RecordSqlIo (Alias: /rs)
Record SQL and File I/O events.
/profileSubprocesses (Alias: /sp)
Profile both the target and any child processes spawned.
/timeout:<timeout> (Alias: /t)
The number of seconds to wait before terminating the target process. Set to 0 to indicate that no timeout should be used. The default is 120 seconds.
/lineLevel (Alias: /ll)
The profiler should record line-level timings as well as method-level timings.
/methodLevel (Alias: /ml)
Record only method-level timings (the default).
/onlyWithSource (Alias: /ows)
Record only values for methods which have source code files specified in their debugging data (pdb) files.
/sampling (Alias: /sm)
Use sampling to produce approximate profiling results quickly.
/includeSource:<includeSource> (Alias: /is)
Whether or not the results will include the source code. Permitted values are on and off. The default is on.
/inlining:<inlining> (Alias: /in)
Whether or not the profiler will allow .NET to inline functions. Turning this off will produce results for more methods, at the expense of a less accurate reflection of the processes performance. Permitted values are on and off. The default is on.
/compensate:<compensate> (Alias: /comp)
Whether or not the profiler should adjust results to account for its own overhead. Permitted values are on and off. The default is on.
/simplify:<simplify> (Alias: /simp)
Whether or not the profiler will simplify certain complicated stack traces to reduce resource requirements. Permitted values are on and off. The default is on.
/avoidTrivial:<avoidTrivial> (Alias: /notriv)
Whether or not the profiler will avoid extremely trivial functions to reduce resource requirements. These functions have a low hit count and a running time of only a few processor cycles. Permitted values are on and off. The default is on.
/aspxPages:<aspxPages> (Alias: /aspx)
Whether or not the profiler will profile the compiled contents of ASPX pages as well as the code that lies behind them. Turning this option on may considerably increase the amount of time the application spends in the JIT. Permitted values are on and off. The default is off.
The threshold time in percent that a method must have used in order to be included in the report. Set to 0 to include all results. The default is 0.1.
The name of a file to write a summary of the profiler results as CSV data to.
The name of a file to write a summary of the profiler results as XML data to.
/htmlreport:<htmlreport> (Alias: /h)
The name of a file to write a summary of the profiler results as an HTML report.
The name of a file to write a summary of the call tree results as XML data to.
/calltreehtml:<calltreehtml> (Alias: /cth)
The name of a file to write a summary of the call tree results as an HTML report.
/dbcallshtml:<dbcallshtml> (Alias: /dbh)
The name of a file to write a summary of the database calls profiler results as an HTML report.
The name of a file to save the profiler results to. The contents of this file can be inspected using the ANTS Performance Profiler desktop application.
When profiling IIS Express, set to '32' to profile a 32-bit application in the 32-bit version of IIS Express or '64' to profile a 64-bit application in the 64-bit version of IIS Express.
When profiling Silverlight, optionally enter a URL to set the 'origin' parameter to pass to sllauncher.exe. Use this if you have problems with permissions to set the URL the application should be treated as running from.
Note: Silverlight support was removed in ANTS Performance Profiler 10.1.
Specify the application ID of the Windows Store app to profile. Note: the application ID must be unique to your application.
Profiling will stop when the w3wp process (IIS) terminates. This option is only valid with saved IIS projects.
If an error occurs, the following exit codes may be displayed:
1 General error code.
3 Illegal argument duplication. Some arguments may not appear more than once in a command-line. If such arguments appear more than once this exit code will be returned.
8 Unsatisfied argument dependency or violated exclusion when user runs command line.
/arg2 depends on
/arg1 but you have specified
/arg2 without specifying
/arg1, or alternatively
/arg2 cannot be used with
/arg1 but you have tried to use them both.
32 Value out of range. Numeric value supplied for an argument that is outside the range of valid values for that argument.
33 Value overflow. The magnitude of a value supplied for an argument is too large and causes an overflow.
34 Invalid value. The value supplied for an argument is invalid.
35 No / invalid software license or trial period has expired.
64 General command-line usage error.
65 Data error. Some input data required by the tool is invalid or corrupt.
69 A resource or service required to run the tool is unavailable.
73 Failed to create report.
74 IO error occurred. Generally returned if the program attempts to write to a file that already exists without the user having specified the /force option.
77 Action cannot be completed because the user does not have permission.
126 Execution failed because of an unknown error.
130 Execution stopped because the user pressed Ctrl+Break.
Exporting results to HTML, XML and CSV files
You can save profiling results to HTML, XML, and CSV files. For more information about saving profiling results in different formats, see Saving profiling results.