Invoke sp_sysmon

You can invoke sp_sysmon by using fixed time intervals, or by using the begin_sample and end_sample parameters.

Fixed Time Intervals

Use fixed time intervals to provide a sample for a specified number of minutes.

For example, you can run sp_sysmon for 10 minutes and print information for all counters:
sp_sysmon “00:10:00”
To print only the RepAgent section of the report, enter:
sp_sysmon “00:10:00”, repagent

begin_sample and end_sample

Use begin_sample and end_sample to invoke sp_sysmon to start and end sampling, issue queries, and print results at any point in time.

For example, to start and end the sample for the RepAgent group of counters, enter:
sp_sysmon begin_sample
go
execute proc1
go
sp_sysmon end_sample,repagent