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:

  1. Profile IIS from the ANTS Performance Profiler graphical user interface; see Profiling ASP.NET applications running on IIS.
  2. When you have finished profiling, on the File menu, click Save Session Settings.
  3. Use the /project argument on the command line to load the saved session settings.
  4. 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 /verbose, /html, /out, /force or /outputwidth, those switches will be ignored, the help message will be printed, and 0 will be returned as the process exit code.

/html

Causes help to be output as HTML.

Must be used with the /help switch.

/quiet (Alias: /q)

Quiet mode - no output.

/verbose (Alias: /v)

Verbose mode.

/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.

/argfile:<argfile>

File containing the XML argument specification.

/out:<fileName>

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.

/attach:<pid>

The Windows process ID of the .NET 4+ process to attach to. (Available in ANTS Performance Profiler 8.2 and later.)

/arguments:<arguments> (Alias: /args)

The arguments to pass to the executable.

/workingDirectory:<workingDirectory> (Alias: /wd)

The working directory to use when profiling the application.

/port:<port>

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

/express

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.

/service:<service>

The name of a Windows service to profile.

/complus:<complus>

The name of a COM+ server to profile.

/silverlight:<silverlight>

The URL of a site containing a Silverlight application to profile.

/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.

/threshold:<threshold>

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.

/csv:<csv>

The name of a file to write a summary of the profiler results as CSV data to.

/xml:<xml>

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.

/calltree:<calltree>

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.

/data:<data>

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.

/expressArchitecture:<architecture>

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.

/silverlightOrigin:<origin>

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. 

/windowsStore:<applicationId>

Specify the application ID of the Windows Store app to profile. Note: the application ID must be unique to your application.

Exit Codes

If an error occurs, the following exit codes may be displayed:

0 Success.

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.

   For example, /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.