This class is designed to gather performance statistics for any type of routine or code block.
The data for this class is stored in ^%SYS.PTools.Stats, ^%SYS.PTools.StatsD and ^%SYS.PTools.StatsI.
These globals default to the %SYS NameSpace, you might want to map them to a different NameSpace to avoid filling %SYS.
By calling pairs of the Start() and Stop() methods we will record GlobalRef, commands executed, TotalTime, and some process info for each code block.
You need to manually add the calls to the Start() and Stop() methods to your code.
Each method takes 3 parameters:
Namespace - Current namespace the code is being executed in
RoutineName - Name of the routine you are gathering stats for
ModuleName - Name of the sub block with a given routine, Defaults to 1
For example when the code below is executed we will put three entries into the %SYS_PTools.Stats table, one for each call to Stop().
Test ;
DO ##class(%SYS.PTools.Stats).Start("Samples","Test","Full Routine")
DO ##class(%SYS.PTools.Stats).Start("Samples","Test","Part 1")
DO ##class(Sample.Person).Populate(1000)
DO ##class(%SYS.PTools.Stats).Stop("Samples","Test","Part 1")
DO ##class(%SYS.PTools.Stats).Start("Samples","Test","Part 2")
DO ##class(Sample.Person).PrintPersons()
DO ##class(%SYS.PTools.Stats).Stop("Samples","Test","Part 2")
DO ##class(%SYS.PTools.Stats).Stop("Samples","Test","Full Routine")
QUIT
Number of Milliseconds spent waiting for Disk reads in this Module for the given query
the Modules are nested and the count for the outer ones is cumulative
Sections of the SQL statement, these should match up the the Module names in the Query Plan output
When used with this class it can be used to distinguish block of code within a give routine
this will default to 1 if nothing is provided
Generates a comma delimited file containing the data from the %SYS_PTools.Stats table
By default the file will be created in the mgr directory of the Cache Instantance
You can pass in a value for FileName if you want to override the default