Use the begin_sample and end_sample parameters to invoke sp_sysmon to start sampling, issue queries, and end the sample and print the results at any point in time. For example:
sp_sysmon begin_sample
execute proc1
execute proc2
select sum(total_sales) from titles
sp_sysmon end_sample
On systems with many CPUs and high activity, counters
can overflow if the sample period is too long.
If you see negative numbers in sp_sysmon output, reduce the sample time.