NmpCore can be started from a command line, using the command:
NmpCore [<options>] <process>
To start NmpCore, the command line must at least specify the process to profile. It can be specified using the following command line arguments:
|
Argument |
Short form |
Description |
|
/attach
<pid> |
/a |
Attach to a running process using the profiling API. Specify the process using process id or process name, e.g. /a 1234, or /a SomeProcess.exe. Requires that the process runs under .NET Framework 4.0 and has concurrent GC disabled. For more information, see Attach to Process using Profiling API. |
|
/program <program name> <args> |
/p |
Profile a standalone program. This must be the last command line argument to NmpCore, since all additional arguments will be passed to the started program. |
|
/asp |
/asp |
Profile an ASP.NET application, hosted by IIS. Using this option will cause NmpCore to stop the IIS service and restart it with profiling enabled. |
|
/service <service name> |
/svc |
Profile a Windows Service. Using this option will cause NmpCore to stop the specified service and restart it with profiling enabled. |
Additional command line options can also be included to define the session settings, and to define how snapshots should be collected and how a session file should be created.
Some common options are:
|
Argument |
Short form |
Description |
|
/collectandstop <count> |
/cs |
Collects the specified number of snapshots and then stops the profiler. The snapshot collection interval is specified using the /autocollect argument. If the /autocollect argument is not included, the default collection interval of 10 minutes is used. |
|
/autocollect <interval> |
|
Enables automatic snapshot collection and sets the collection time interval (in minutes). |
|
/sessionfile <file path> |
|
Specifies the name of the session of the session file that should be created. If no session file name is specified, as Save as window will be shown when the profiling has stopped. |
|
/peaksnapshot [+/-] |
|
Enables or disables peak snapshot collection. |
|
/controlpanel [+/-] |
|
Shows or hides the NmpCore control panel. The control panel provides a user interface for collecting snapshots manually and for stopping the profiler. It is shown by default unless the /collectandstop argument has been provided. |
|
/register |
|
Temporarily registers NmpCore. In order to profile a process running under .NET Framework prior to version 4.0 (2.0/3.0/3.5), NmpCore has to be registered. This option will cause an elevation prompt if User Access Control is enabled. To prevent the prompt each time NmpCore is run, use the /persistentregister option instead. |
|
/persistentregister |
|
Persistent registration of NmpCore. Same as the /register option, but the registration is not removed when NmpCore exits. Subsequent uses of NmpCore will not require any registration. |
In additional to the above command line arguments, all other command line arguments for .NET Memory Profiler can be used, except for /noui and /open. For more information, see Available Command Line Options.