Earlier versions of Adaptive Server did not include parameters with sp_monitor. Adaptive Server version 12.5.2 adds the parameters described in this section.
Before using the new parameters associated with sp_monitor,
you must set up monitoring tables and the related stored procedures
needed to enable these options, which are part of the installmontables script.
For more information, see “Installing Monitoring Tables” in Performance
and Tuning: Monitoring and Analyzing.
Displays statistics about Adaptive Server.
sp_monitor [ connection, [cpu | diskio | elapsed time ] ] [event, [spid ] ] [procedure, [ dbname, [ procname, [, summary | detail ] ] ] ] [ enable ] [ disable ] [ statement, [ cpu | diskio | elapsed time ] ] [ help], [ connection | statement | procedure | event ] ]
connection
displays information on each connection. connection uses the following monitoring tables:
monProcessSQLText
monProcessActivity
cpu | diskio | elapsed time
these parameters order the output of sp_monitor connection. cpu indicates the amount of CPU time consumed by each different connection. diskio indicates the number of physical reads performed by each connection. elapsed time indicates the sum of the CPU time and the wait times for each connection.
event
displays information about the events each task spent time waiting for, and the duration of the wait. This is reported in descending order of wait time in milliseconds. event uses the following monitoring tables:
monProcessWaits
monWaitEventInfo
spid
allows you to obtain event information for a specific task by entering its spid. You must specify the numeric value of spid within quotation marks.
procedure
displays statistics about stored procedures:
ProcName – the stored procedure being monitored.
DBNAME – the database in which the stored procedure is located.
NumExecs – the approximate number of executions of this specific stored procedure.
AvgCPUTime – the average CPU time that it takes for the stored procedure to execute.
AvgPhysicalReads – the average number of disk reads performed by the stored procedure.
AvgLogicalReads – the average number of logical reads performed by the stored procedure.
AvgMemUsed_KB – the average amount of memory in KB used by the stored procedure.
procedure uses the monSysStatement monitoring table.
dbname
displays information on procedures for the specified database.
procname
displays information on the specified procedure.
summary | detail
displays either summary information, which provides an average of all instances of the procedure, or detailed information, which provides information on every instance of the stored procedure.
enable
enables the new options for sp_monitor. It turns on the configuration parameter required to begin monitoring.
disable
disables monitoring.
statement
sp_monitor statement displays information on each statement. statement uses the following monitoring tables:
monProcessSQLText
monProcessStatement
cpu | diskio | elapsed time
These parameters help order the output of sp_monitor statement. cpu indicates the the cpu time consumed by different statements. diskio indicates the number of physical reads done by different statements. elapsed time indicates the sum of the CPU time and the wait times for different statements.
help
displays the syntax and examples for sp_monitor.
Example 1 This example shows how to display information about connections:
1> sp_monitor "connection" 2> go spid LoginName ElapsedTime LocksHeld SQLText ---- --------- ----------- --------- ----------------- 12 sa 90300 2 exec get_employee_salaries 27 sa 17700 1 exec get_employee_perks
By default, the output by default is sorted in the descending order of the ElapsedTime.
Example 2 This example identifies the connections performing the most physical reads:
1> sp_monitor "connection","diskio" 2> go spid LoginName Physical_Reads LocksHeld SQLText ---- --------- -------------- --------- -------------------------- 12 sa 117 2 exec get_employee_salaries 27 sa 1 0 exec get_employee_perks
Example 3 This example displays information about each statement:
1> sp_monitor "statement" 2> go spid LoginName ElapsedTime SQLText ---- --------- ----------- -------------------------- 12 sa 100 exec get_employee_salaries
Example 4 This example displays the events each task spent time waiting for and the duration of the wait, reported in descending order of wait times:
1> sp_monitor "event" 2> go SPID WaitTime Description ------ ----------- ------------------------------------------ 6 108200 hk: pause for some time 29 108200 waiting for incoming network data 10 107800 waiting while allocating new client socket 15 17100 waiting for network send to complete 14 5900 waiting for CTLIB event to complete 14 400 waiting for disk write to complete 7 200 hk: pause for some time 7 100 waiting on run queue after yield 12 100 waiting for network send to complete
Example 5 This example displays event data for spid 14:
1> sp_monitor "event","14" 2> go WaitTime Description ----------- ----------------------------------- 9000 waiting for CTLIB event to complete 600 waiting for disk write to complete 200 waiting for disk write to complete 100 waiting on run queue after yield 100 wait for buffer write to complete
Example 6 This example provides a summary of most recently run procedures, sorted in descending order of average elapsed time. This example provides historical monitoring information rather than the current state.
1> sp_monitor "procedure" 2> go Average Procedure Statistics ============================ ProcName DBName AvgElapsedTime AvgCPUTime AvgWaitTime AvgPhysicalReads AvgLogicalReads AvgPacketsSent NumExecs -----------------------------------------------------------------------neworder_remote tpcc 1833 16 1083 26 96 0 6 neworder_local tpcc 1394 13 1181 31 122 0 38 tc_startup tpcc 1220 3 1157 0 3 0 59 delivery tpcc 1000 0 800 23 49 0 2
You must run sp_monitor when a representative workload is running on the system.
Typically, you will run procedures in this sequence:
Run sp_monitor enable
Invoke sp_monitor options
Run sp_monitor disable when you have completed the monitoring
When you are using sp_monitor procedure, the number of rows returned can be very large; you may want to use the summary option instead of the detail option. It may also take a while for this command to complete on an active system.
You must have mon_role permissions to execute sp_monitor. For more information see “Monitoring Tables” Performance and Tuning: Monitoring and Analyzing.
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |