DatabaseProcApplicationCreatedLinks
sybsystemprocssp_sysmon  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_sysmon
3         @interval_or_option char(12) = "", /* Time interval string, option
4         ** "begin_sample" or "end_sample"
5         */
6         @section char(80) = "NULL", /* Optional section name		*/
7         @applmon varchar(14) = "no_appl", /* Parameter to enable/disable
8         ** application on monitoring or number of top
9         ** objects to print output in the case of
10        ** "cache wizard"
11        ** Valid values are:
12        **    "no_appl" - Application monitoring
13        **                disabled (default)
14        **    "appl_only" - Only applications monitored
15        **    "appl_and_login" - Both applications and
16        **                       logins monitored
17        **    Any valid number
18        */
19        @filter varchar(255) = "NULL", /* This parameter will be used only when the
20        ** section is 'cache wizard'
21        */
22        @dumpcounters char(6) = "n",
23        @option varchar(7) = NULL /* Accepts a qualifier such as 'noclear' */
24    with EXECUTE AS OWNER
25        as
26            declare @CacheID smallint /* Cache ID to map to buffer_N group */
27            declare @CacheName varchar(255) /* Cache Name from cache id lookup */
28            declare @DiskName varchar(40) /* Disk Name */
29            declare @PhysName varchar(127) /* Physical disk Name from cache id lookup */
30            declare @grp int /* For manipulation of the disk group*/
31            declare @Seconds int /* Interval converted to seconds */
32            declare @Stat int /* status from sysconfigures */
33            declare @RunStat int /* status from sysconfigures */
34            declare @return int /* return value */
35            declare @Cache_Status char(24) /* cache status */
36            declare @Cache_Type char(24) /* cache type */
37            declare @ConfigSize char(24) /* config size */
38            declare @RunSize char(24) /* run size */
39            declare @Cfg_Cache_Repl char(24) /* config value of cache replacement policy*/
40            declare @Run_Cache_Repl char(24) /* run value of cache replacement policy */
41            declare @msg varchar(255) /* message variable */
42            declare @mda_procname char(50) /* call sp_sysmon_analyze_mda */
43            declare @rtn_status int /* hold mda sproc return status codes */
44            declare @ClrStatTime datetime /* time monitor counters cleared */
45            declare @GetStatTime datetime /* time monitor counters sampled */
46            declare @blankline char(1) /* to print blank line */
47            declare @rptline char(80) /* formatted stats line for print statement */
48            declare @sample_time datetime /* Time when sample was performed */
49            declare @clockticks int
50            declare @sample_period varchar(20) /* length of time sample lasted */
51            declare @section_line char(80)
52            declare @noclear int /* whether to operate in noclear mode*/
53            declare @clear int /* whether to operate in clear mode*/
54            declare @counters_cleared datetime /* time counters were cleared */
55            declare @start_table datetime /* time baseline table creation started */
56            declare @end_table datetime /* time baseline index creation ended */
57            declare @table_time int /* time spent creating index */
58            declare @difference_time int /* diff betwen interval and table creation */
59            declare @collect_interval char(12) /* interval parameter passed to collect */
60            declare @tempdbname varchar(30) /* assigned temporary database */
61            declare @system_view char(16), /* SDC system view */
62                @instid smallint, /* SDC instance ID */
63                @outstr varchar(255), /* for SDC dbcc set_scope */
64                @scope varchar(16) /* for SDC dbcc set_scope */
65    
66            declare @header_printed int /* report header printed indicator */
67            declare @i int /* loop counter */
68            declare @active_instances int /* SDC active instance # */
69            declare @active_instance_num int /* counter for SDC active instance */
70            declare @instancename varchar(30) /* instance name */
71            declare @curpos int /* Current position while printing the version string */
72    
73            select @section_line = "==============================================================================="
74            select @blankline = " "
75    
76            /* If no interval or option was passed, display usage */
77            if (@interval_or_option = "")
78            begin
79                raiserror 18179, @interval_or_option
80                return 1
81            end
82    
83            /*
84            ** Determine whether to operate in clear or noclear mode.
85            ** Any parameter except for @interval_or_option can specify the
86            ** these options, so each parameter needs to be checked.
87            ** If the clear or noclear option was specified, reset the
88            ** parameter to its default value if appropriate.
89            */
90            select @noclear = 0
91            select @clear = 0
92    
93            if (@section = 'noclear')
94            begin
95                select @noclear = 1
96                select @section = "NULL"
97            end
98            else if (@applmon = 'noclear')
99            begin
100               select @noclear = 1
101               select @applmon = 'no_appl'
102           end
103           else if (@filter = 'noclear')
104           begin
105               select @noclear = 1
106               select @filter = "NULL"
107           end
108           else if (@option = 'noclear')
109           begin
110               select @noclear = 1
111           end
112           else if (@dumpcounters = 'noclear')
113           begin
114               select @noclear = 1
115           end
116   
117           if (@section = 'clear')
118           begin
119               select @clear = 1
120               select @section = "NULL"
121           end
122           else if (@applmon = 'clear')
123           begin
124               select @clear = 1
125               select @applmon = 'no_appl'
126           end
127           else if (@filter = 'clear')
128           begin
129               select @clear = 1
130               select @filter = "NULL"
131           end
132           else if (@option = 'clear')
133           begin
134               select @clear = 1
135           end
136           else if (@dumpcounters = 'clear')
137           begin
138               select @clear = 1
139           end
140   
141           select @header_printed = 0
142   
143           /*
144           ** Verify that at most one of clear and noclear options has
145           ** been specified. 
146           */
147           if (@noclear = 1 and @clear = 1)
148           begin
149               /*
150               ** Invalid parameters.  Both noclear and clear cannot be specified
151               ** at the same time.
152               */
153               raiserror 19449
154               return 1
155           end
156   
157           if (@interval_or_option = 'begin_sample'
158                   or @interval_or_option = 'end_sample')
159           begin
160               /*
161               ** If begin_sample or end_sample are specified then we
162               ** must clear the counters.  Make sure that the noclear
163               ** option was not specified and set the mode to clear if
164               ** it was not.
165               */
166               if (@noclear = 1)
167               begin
168                   /*
169                   ** sp_sysmon cannot be executed with the no clear option unless
170                   ** a sample interval is specified.
171                   */
172                   raiserror 19361
173                   return 1
174               end
175   
176               select @clear = 1
177           end
178   
179           /*
180           ** If we have gotten this far and neither clear nor noclear were
181           ** specified, set the mode to noclear by default
182           */
183           if (@noclear = 0 and @clear = 0)
184           begin
185               select @noclear = 1
186           end
187   
188           /*
189           ** Validate the value of section
190           */
191           if (@interval_or_option = "begin_sample" and @section != "NULL")
192           begin
193               raiserror 18546 @msg, "sp_sysmon", @section
194           end
195   
196           if (@section not in ("kernel", "wpm", "parallel", "taskmgmt", "appmgmt", "esp", "housekeeper", "monaccess", "xactsum", "xactmgmt", "indexmgmt", "mdcache", "locks", "dcache", "pcache", "memory", "recovery", "diskio", "netio", "repagent", "cache wizard", "NULL"))
197           begin
198               raiserror 18532 @msg, "sp_sysmon", @section
199               raiserror 18534 @msg, "sp_sysmon"
200               return 1
201           end
202   
203           /* determine command scope: instance or clusterwide */
204   
205           select @system_view = NULL
206           select @instid = NULL
207           select @scope = NULL
208           select @active_instances = 1
209           select @instancename = @@servername
210   
211   
212   
213   
214           /*
215           ** Operating in noclear mode. Enable monitor counters and create 
216           ** baseline table to save monitor counter values from start of session.  
217           ** When not in noclear mode the counters are cleared and enabled in
218           ** sp_sysmon_collect.
219           */
220           create table #temp_sysmon_baseline(
221               group_name char(25),
222               field_id smallint,
223               value bigint
224   
225           )
226   
227           /*
228           ** create temp tables for kernel information
229           */
230           if ((select object_id("#tempThreadStats")) is not NULL)
231           begin
232               drop table #tempThreadStats
233           end
234   
235           create table #tempThreadStats(
236               InstanceID int,
237               ThreadID int,
238               ThreadPoolID int,
239               MinorFaults bigint,
240               MajorFaults bigint,
241               UserTime bigint,
242               SystemTime bigint,
243               VoluntaryCtxtSwitches bigint,
244               NonVoluntaryCtxtSwitches bigint,
245               TaskName varchar(30) null)
246   
247           if ((select object_id("#tempIOCStats")) is not NULL)
248           begin
249               drop table #tempIOCStats
250           end
251   
252           create table #tempIOCStats(
253               InstanceID int,
254               ControllerID int,
255               BlockingPolls bigint,
256               NonBlockingPolls bigint,
257               EventPolls bigint,
258               NonBlockingEventPolls bigint,
259               FullPolls bigint,
260               Events bigint,
261               Type varchar(30))
262   
263           if ((select object_id("#tempWorkQueue")) is not NULL)
264           begin
265               drop table #tempWorkQueue
266           end
267   
268           create table #tempWorkQueue(
269               Name varchar(30),
270               TotalRequests int,
271               QueuedRequests int,
272               WaitTime int)
273   
274           if (@noclear = 1)
275           begin
276               dbcc monitor("sample", "all", "on")
277               dbcc monitor("sample", "spinlock_s", "on")
278               if (@applmon != "no_appl")
279               begin
280                   dbcc monitor("sample", "appl", "on")
281               end
282   
283               dbcc monitor("select", "all", "on")
284               dbcc monitor("select", "spinlock_s", "on")
285               if (@applmon != "no_appl")
286               begin
287                   dbcc monitor("select", "appl", "on")
288               end
289   
290               dump tran tempdb with truncate_only
291   
292               /*
293               ** If assigned temporary database is different than system
294               ** tempdb, then dump that one as well.
295               */
296               select @tempdbname = db_name(@@tempdbid)
297               if (@tempdbname != "tempdb")
298               begin
299                   dump tran @tempdbname with truncate_only
300               end
301   
302               /*
303               ** Measure table creation time and subtract
304               ** this from the time interval specified by the user.
305               ** If processing takes longer than the specified sample
306               ** interval then raise an error and terminate.
307               */
308               select @start_table = getdate()
309   
310               /*
311               ** Copy counter values at beginning of sample
312               ** into the sysmon_monitors table
313               */
314   
315               insert into #temp_sysmon_baseline
316               select group_name, field_id, value
317               from master.dbo.sysmonitors holdlock
318   
319   
320               select @end_table = getdate()
321               select @table_time = datediff(second, @start_table, @end_table)
322   
323               /*
324               ** Adjust collection interval to account for table and
325               ** index creation time. Reverse the sign on the @table_time
326               ** value to get the dateadd function to perform subtraction.
327               ** This will subtract the value of @table_time from the value
328               ** of @interval_or_option specified by the user.  This will
329               ** adjust the period of time that sp_sysmon waits by subtracting
330               ** time already spent building the baseline table from the 
331               ** sample interval specified by the user.
332               */
333               select @collect_interval = convert(char(12),
334                   dateadd(second,
335                       - (@table_time),
336                       convert(datetime,
337                       @interval_or_option)),
338                   108)
339   
340               select @difference_time = datediff(second, @collect_interval,
341                       @interval_or_option)
342   
343               if (@difference_time < 0)
344               begin
345                   /*
346                   ** The specified interval is less than the time
347                   ** required to generate the baseline (%1! seconds).
348                   ** Please specify a longer sample interval.
349                   */
350                   raiserror 19363, @table_time
351                   /* restore dbcc execution scope */
352                   if (@scope = "instance")
353                   begin
354                       dbcc set_scope_in_cluster('instance')
355                   end
356                   else if (@scope = "cluster")
357                   begin
358                       dbcc set_scope_in_cluster('cluster')
359                   end
360   
361                   return 1
362               end
363           end
364           else
365           begin
366               select @collect_interval = @interval_or_option
367           end
368   
369           /*
370           ** Execute sp_sysmon_collect 
371           */
372   
373           exec @return = sp_sysmon_collect @collect_interval,
374               @section,
375               @applmon,
376               @noclear
377   
378           /* restore dbcc execution scope */
379           if (@scope = "instance")
380           begin
381               dbcc set_scope_in_cluster('instance')
382           end
383           else if (@scope = "cluster")
384           begin
385               dbcc set_scope_in_cluster('cluster')
386           end
387   
388   
389           /*
390           ** If there was an error or if the option was "begin_sample", return
391           */
392   
393           if @return = 1 or @interval_or_option = "begin_sample"
394           begin
395               return @return
396           end
397   
398           select @GetStatTime = getdate()
399   
400           /*
401           ** Place monitors information into a temp table. 
402           **
403           ** WARNING: If you modify this to make changes in table schema,
404           ** please look at 'crttemptables' file where the #tempmonitors
405           ** is created for other sub-sysmon stored procedures.
406           */
407   
408           /*
409           ** Create #tempmonitors table
410           **
411           ** A create table command is used here rather than cloning the sysmonitors
412           ** table using a select-into command in order to be compatible with
413           ** the application monitor behavior.  The application monitors are deleted
414           ** whenever a select is performed on the sysmonitors table.  As a result
415           ** a select-into cannot be used to create the #tempmonitors table because
416           ** doing so will also delete the application monitors from the sysmonitors
417           ** table.
418           **
419           ** WARNING: The schema of the #tempmonitors table must exactly match the
420           ** schema of the sysmonitors table as defined in syscoldata.c. If the schema of
421           ** the sysmonitors table is changed the create table command below must be
422           ** updated.
423           */
424           select @i = 0
425           select @active_instance_num = 0
426   
427           while @active_instance_num < @active_instances /* for each instance */
428           /* { */
429           begin
430   
431   
432   
433               if ((select object_id("#tempmonitors")) is not NULL)
434               begin
435                   drop table #tempmonitors
436               end
437   
438               create table #tempmonitors(
439                   field_name char(79),
440                   group_name char(25),
441                   field_id smallint,
442                   value int,
443                   description varchar(255) null,
444   
445                   nodeid tinyint null)
446   
447   
448               if (@noclear = 0)
449               begin
450                   /*
451                   ** OPERATING IN CLEAR THE MONITOR COUNTERS MODE
452                   ** Copy sysmonitors to #tempmonitors if not operating in
453                   ** no clear mode
454                   */
455                   /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #tempmonitors
456                   select [master].dbo.sysmonitors.field_name, [master].dbo.sysmonitors.group_name, [master].dbo.sysmonitors.field_id, [master].dbo.sysmonitors.value, [master].dbo.sysmonitors.description, [master].dbo.sysmonitors.nodeid
457                   from master.dbo.sysmonitors holdlock
458   
459               end
460               else
461               begin
462                   /*
463                   ** Create clustered index on baseline table.  This is done
464                   ** at this point so that this work is performed outside of the
465                   ** sample interval.  Work performed during index creation will
466                   ** not be reflected in the sysmon reports and time required to
467                   ** create the baseline table during the sample is reduced.
468                   */
469                   create clustered index tsbi
470                       on #temp_sysmon_baseline
471   
472                   (group_name, field_id)
473   
474   
475                   /*
476                   ** OPERATING IN NOCLEAR MODE - Only used when a time interval
477                   ** is given.  Generate delta values for all monitor counters
478                   ** except those for the configuration values, control
479                   ** and high water marks and insert into #tempmonitors.
480                   ** The case statement will handle cases of counter wrap and 
481                   ** situations in which counter delta's are greater than the
482                   ** capacity of the value column.
483                   */
484                   insert into #tempmonitors
485                   select s.field_name,
486                       s.group_name,
487                       s.field_id,
488                       case
489                           when (s.value >= b.value)
490                           then
491                           case
492                               when ((convert(numeric, s.value) - convert(numeric, b.value))
493                                       >= convert(numeric, 2147483648))
494                               /*
495                               ** The end counter value is greater than the start
496                               ** value, but the difference is greater than the
497                               ** maximum signed integer value.  In this case, set
498                               ** the value of the delta to -1.
499                               */
500                               then (- 1)
501                               else
502                                   /*
503                                   ** The common case: end counter value is greater
504                                   ** then start counter value and the delta is less
505                                   ** than or equal to the maximum signed integer value.
506                                   */
507                                   (s.value - b.value)
508                           end
509                           else
510                               case
511                                   when ((convert(numeric, b.value) - convert(numeric, s.value))
512                                           < convert(numeric, 2147483648))
513                                   /*
514                                   ** The counter wrapped (its value exceeded the maximum
515                                   ** signed integer value) during the sample period and
516                                   ** the total change in value exceeds the maximum 
517                                   ** signed integer value.  In this case, set the
518                                   ** delta value to -1.
519                                   */
520                                   then (- 1)
521                                   else
522                                       /*
523                                       ** The counter wrapped during the sample period
524                                       ** and the delta is less than or equal to the
525                                       ** maximum signed integer value.  In this case
526                                       ** calculate the delta by subtracting the current
527                                       ** value of the counter from its value at the
528                                       ** beginning of the sample period and then subtract
529                                       ** that value from the total range of the signed
530                                       ** integer.  This gives the actual change in
531                                       ** value during the sample period.
532                                       */
533                                       (convert(int, (4294967295
534                                       - (convert(numeric, b.value)
535                                       - convert(numeric, s.value)))))
536                               end
537                       end as value,
538                       s.description,
539   
540                       s.nodeid
541   
542                   from master.dbo.sysmonitors s holdlock,
543                       #temp_sysmon_baseline b
544                   where b.group_name = s.group_name
545                       and b.field_id = s.field_id
546                       and b.group_name not in ('config', 'resource_stats', 'control')
547                       and field_name not like "max%"
548                       and field_name not like "%hwm"
549   
550   
551                   /*
552                   ** Copy the static values into the
553                   ** #tempmonitors table without performing
554                   ** deltas
555                   */
556                   /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #tempmonitors
557                   select [master].dbo.sysmonitors.field_name, [master].dbo.sysmonitors.group_name, [master].dbo.sysmonitors.field_id, [master].dbo.sysmonitors.value, [master].dbo.sysmonitors.description, [master].dbo.sysmonitors.nodeid
558                   from master.dbo.sysmonitors
559                   where (group_name in ('config', 'resource_stats', 'control')
560                           or field_name like "max%"
561                           or field_name like "%hwm")
562   
563   
564   
565                   /*
566                   ** Check to see whether the monitor counters have been cleared
567                   ** since the beginning of this session.  This is not
568                   ** guaranteed to detect every time that the counters have been
569                   ** cleared.  But if engine_0 clock_ticks is lower now than
570                   ** when the sample was begun, then we know that the counters
571                   ** have been cleared.
572                   */
573                   select @clockticks = value from
574                       #tempmonitors
575                   where group_name = "engine_0"
576                       and field_name = "clock_ticks"
577   
578                   if (@clockticks <= 0)
579                   begin
580                       /*
581                       ** It appears that the monitor counters have been cleared
582                       ** since the beginning of the sample period.  The
583                       ** sp_sysmon report cannot be run successfully.
584                       ** Please re-run the sp_sysmon report ensuring
585                       ** that the monitor counters are not cleared during
586                       ** the sample period.
587                       */
588                       raiserror 19362
589                       print " "
590                       return 1
591                   end
592               end
593   
594               /*
595               ** Create index on tempmonitors columns used in queries
596               ** during report generation
597               */
598   
599               begin
600                   create clustered index tmci
601                       on #tempmonitors
602                   (group_name, field_id)
603               end
604   
605               /*
606               ** Calculate length of the sample period based on engine 0 clock ticks
607               ** at start of sample period.  Subtract this from the end time to 
608               ** obtain the start of the sample period.
609               */
610   
611               begin
612                   select @Seconds = convert(int, value * (1.0 * @@timeticks / 1000000))
613                   from #tempmonitors
614                   where field_name = 'clock_ticks'
615                       and group_name = 'engine_0'
616               end
617   
618               /*
619               ** Check the length of the sample period. If it is 0, we will raise error 18545
620               ** and will not produce the report.
621               */
622               if (@Seconds = 0)
623               begin
624                   raiserror 18545, "sp_sysmon"
625                   return 1
626               end
627   
628               /*
629               ** Print report header
630               */
631               if (@header_printed = 0)
632               begin
633                   print @section_line
634                   print "      Sybase Adaptive Server Enterprise System Performance Report"
635                   print @section_line
636                   print @blankline
637   
638                   select @rptline = "Server Version:" + space(8) + substring(@@version, 1, 56)
639                   print @rptline
640   
641                   /*
642                   ** The maximum length of sysmon output is limited in 80 characters. Except
643                   ** for the 23 leading characters which includes the string "Server Version"
644                   ** and the 8 space characters, only 56 characters can be displayed for version
645                   ** string. If version string length is longer than 56, above statement will
646                   ** only print the first 56 characters and other characters will be truncated.
647                   ** This would cause incomplete version string. To fix this issue, the version
648                   ** string will be broken to multiple lines to display to make sure each line
649                   ** would display maximum 56 characters.
650                   */
651                   select @curpos = 57
652                   while (@curpos < len(@@version))
653                   begin
654                       select @rptline = space(23) + substring(@@version, @curpos, 56)
655                       print @rptline
656                       select @curpos = @curpos + 56
657                   end
658   
659                   select @ClrStatTime = dateadd(second, - (@Seconds), @GetStatTime)
660   
661                   select @sample_period = convert(char(12),
662                       dateadd(second, @Seconds, "00:00:00"),
663                       108)
664   
665                   select @rptline = "Run Date:" + space(14) +
666                       convert(char(12), @GetStatTime, 107)
667                   print @rptline
668   
669                   if (@interval_or_option != "end_sample")
670                   begin
671                       select @rptline = "Sampling Started at:  " +
672                           space(1) + convert(char(12), @ClrStatTime, 107) +
673                           space(1) + convert(char(8), @ClrStatTime, 108)
674                   end
675                   else
676                   begin
677                       select @rptline = "Statistics Cleared at:" +
678                           space(1) + convert(char(12), @ClrStatTime, 107) +
679                           space(1) + convert(char(8), @ClrStatTime, 108)
680                   end
681                   print @rptline
682   
683                   if (@interval_or_option != "end_sample")
684                   begin
685                       select @rptline = "Sampling Ended at:    " +
686                           space(1) + convert(char(12), @GetStatTime, 107) +
687                           space(1) + convert(char(8), @GetStatTime, 108)
688                   end
689                   else
690                   begin
691                       select @rptline = "Statistics Sampled at:" +
692                           space(1) + convert(char(12), @GetStatTime, 107) +
693                           space(1) + convert(char(8), @GetStatTime, 108)
694                   end
695                   print @rptline
696   
697                   select @rptline = "Sample Interval:      " + space(1) + @sample_period
698                   print @rptline
699   
700                   if (@noclear = 1)
701                   begin
702                       select @rptline = "Sample Mode:          " + space(1) + "No Clear"
703                   end
704                   else
705                   begin
706                       select @rptline = "Sample Mode:          " + space(1) + "Reset Counters"
707                   end
708                   print @rptline
709   
710                   if (@noclear = 1)
711                   begin
712                       if (@system_view is NULL or @system_view != "cluster")
713                       begin
714                           select @counters_cleared = dateadd(ss,
715                                   - (value / (1000000 / @@timeticks)),
716                                   getdate())
717                           from master.dbo.sysmonitors
718                           where group_name = 'engine_0'
719                               and field_name = 'clock_ticks'
720                       end
721   
722   
723                       select @rptline = "Counters Last Cleared:" +
724                           space(1) + convert(char(12), @counters_cleared, 107) +
725                           space(1) + convert(char(8), @counters_cleared, 108)
726                       print @rptline
727                   end
728   
729                   select @header_printed = 1
730               end
731   
732   
733   
734               if @instancename is not null
735               begin
736                   select @rptline = "Server Name:" + space(11) + @instancename
737               end
738               else
739               begin
740                   select @rptline = "Server Name:" + space(11) + "Server is Unnamed"
741               end
742               print @rptline
743   
744   
745               begin
746                   select @Seconds = convert(int, value * (1.0 * @@timeticks / 1000000))
747                   from #tempmonitors
748                   where field_name = 'clock_ticks'
749                       and group_name = 'engine_0'
750               end
751   
752               /*
753               ** End printing report header
754               */
755               /*
756               ** Create a temp table with all muxthreads information
757               */
758               if ((select object_id("#muxthreadsinfo")) is not NULL)
759               begin
760                   drop table #muxthreadsinfo
761               end
762   
763               create table #muxthreadsinfo(
764                   InstanceID int,
765                   enginename varchar(15),
766                   engineid int,
767                   threadid int,
768                   tpname varchar(80))
769   
770               insert into #muxthreadsinfo
771               select
772                   me.InstanceID,
773                   "engine_" + convert(varchar(4), me.EngineNumber),
774                   me.EngineNumber, mt.ThreadID, mt.ThreadPoolName
775               from master.dbo.monEngine me, master.dbo.monThread mt
776               where me.ThreadID = mt.ThreadID
777                   and me.InstanceID = mt.InstanceID
778   
779               /*
780               ** create a temp table for cache information
781               */
782               if ((select object_id("#cachemap")) is not NULL)
783               begin
784                   drop table #cachemap
785               end
786   
787               create table #cachemap(
788                   cid smallint,
789                   name varchar(255),
790                   group_name varchar(255),
791                   cache_status char(24) null,
792                   cache_type char(24) null,
793                   cache_config_size char(24) null,
794                   cache_run_size char(24) null,
795                   config_replacement char(24) null,
796                   run_replacement char(24) null)
797   
798               /*
799               ** fetch all cache related information
800               */
801               if (@system_view is NULL or @system_view != "cluster")
802               begin
803                   declare cache_info cursor for
804                   select convert(varchar(30), co.name), convert(char(24), co.value),
805                       co.status, cu.status,
806                       convert(char(24), cu.value)
807                   from master.dbo.sysconfigures co, master.dbo.syscurconfigs cu
808                   where parent = 19
809                       and co.config = 19
810                       and co.config = cu.config
811                       and co.name = cu.comment
812                   order by co.name
813                   for read only
814               end
815   
816   
817               open cache_info
818               fetch cache_info into @CacheName, @ConfigSize, @Stat, @RunStat, @RunSize
819               while (@@sqlstatus = 0)
820               begin
821                   select @CacheID = config_admin(15, 0, 0, 0, NULL, @CacheName)
822   
823                   if (@Stat & 2 = 2)
824                   begin
825                       select @Cache_Type = "Mixed"
826                   end
827   
828                   if (@Stat & 4 = 4)
829                   begin
830                       select @Cache_Type = "Log Only"
831                   end
832   
833                   if (@Stat & 1 = 1)
834                   begin
835                       select @Cache_Type = "Default"
836                   end
837   
838                   if (@Stat & 32 = 32)
839                   begin
840                       select @Cache_Status = "Active"
841                   end
842   
843                   if (@Stat & 64 = 64)
844                   begin
845                       select @Cache_Status = "Pend/Act"
846                   end
847   
848                   if (@Stat & 128 = 128)
849                   begin
850                       select @Cache_Status = "Act/Del"
851                   end
852   
853   
854                   /*
855                   **  Determine configured cache replacement policy
856                   */
857                   if (@Stat & 256 = 256)
858                   begin
859                       select @Cfg_Cache_Repl = "relaxed LRU"
860                   end
861                   else if (@Stat & 65536 = 65536) /* inmemory_storage */
862                   begin
863                       select @Cfg_Cache_Repl = "none"
864                   end
865                   else
866                   begin
867                       select @Cfg_Cache_Repl = "strict LRU"
868                   end
869   
870                   /*
871                   **  Determine running cache replacement policy
872                   */
873                   if (@RunStat & 256 = 256)
874                   begin
875                       select @Run_Cache_Repl = "relaxed LRU"
876                   end
877                   else if (@RunStat & 65536 = 65536) /* inmemory_storage */
878                   begin
879                       select @Run_Cache_Repl = "none"
880                   end
881                   else
882                   begin
883                       select @Run_Cache_Repl = "strict LRU"
884                   end
885   
886   
887                   insert into #cachemap values (@CacheID, @CacheName, "buffer_" +
888                       convert(varchar(3), @CacheID),
889                       @Cache_Status,
890                       @Cache_Type,
891                       @ConfigSize,
892                       @RunSize,
893                       @Cfg_Cache_Repl,
894                       @Run_Cache_Repl)
895                   fetch cache_info into @CacheName, @ConfigSize, @Stat, @RunStat, @RunSize
896               end
897               close cache_info
898               deallocate cursor cache_info
899   
900   
901   
902               /*
903               ** create a temp table for device information 
904               **
905               ** WARNING: If you modify this to make changes in table schema,
906               ** please look at 'crttemptables' file where the #devicemap
907               ** is created for other sub-sysmon stored procedures.
908               */
909               if ((select object_id("#devicemap")) is not NULL)
910               begin
911                   drop table #devicemap
912               end
913   
914               create table #devicemap(name char(265),
915                   phyname char(127),
916                   group_name char(255))
917   
918               /*
919               ** fetch all device related information
920               */
921   
922               if (@system_view is NULL or @system_view != "cluster")
923               begin
924                   declare disk_info cursor for
925                   select name, phyname, vdevno
926                   from master.dbo.sysdevices
927                   where (status & 16) != 16
928                   for read only
929               end
930   
931   
932               open disk_info
933               fetch disk_info into @DiskName, @PhysName, @grp
934               while (@@sqlstatus = 0)
935               begin
936                   insert into #devicemap values (@DiskName, @PhysName, "disk_" + convert(char(10), @grp))
937                   fetch disk_info into @DiskName, @PhysName, @grp
938               end
939               close disk_info
940               deallocate cursor disk_info
941   
942               /*
943               ** Place config information into a temp table.
944               **
945               ** WARNING: If you modify this to make changes in table schema,
946               ** please look at 'crttemptables' file where the #tempconfigures
947               ** is created for other sub-sysmon stored procedures.
948               */
949               if ((select object_id("#tempconfigures")) is not NULL)
950               begin
951                   drop table #tempconfigures
952               end
953   
954               select c.name as name, convert(varchar(255), r.value) as value into #tempconfigures
955               from master..sysconfigures c, master..syscurconfigs r
956               where r.config = c.config and c.parent != 19
957                   and not (c.parent in (1, 10, 14, 0) and r.value = 0)
958   
959   
960   
961   
962               /*
963               ** place pool information into a temp table
964               */
965               if ((select object_id("#pool_detail_per_cache")) is not NULL)
966               begin
967                   drop table #pool_detail_per_cache
968               end
969               select name, convert(varchar(8), substring(co.comment, 1,
970                       charindex("K", co.comment) - 1)) as io_size
971               into #pool_detail_per_cache
972               from master.dbo.sysconfigures co
973               where co.parent = 19
974                   and co.comment like "%Buffer Pool%"
975   
976   
977               /*
978               ** Handle the new sections
979               */
980               if @section = "cache wizard"
981               begin
982                   /*
983                   ** If the user specified the new sections, and did not specify
984                   ** the parameters, set them to default.
985                   */
986                   if @applmon = "no_appl"
987                   begin
988                       select @applmon = "10"
989                   end
990   
991                   select @mda_procname = 'sp_sysmon_analyze_mda'
992   
993                   if exists (select 1 from sybsystemprocs.dbo.sysobjects where
994                               sysstat & 7 = 4 and name = @mda_procname)
995                   begin
996                       exec @rtn_status = @mda_procname @Seconds, 'Y', @section,
997                           @applmon,
998                           @filter
999                       return @rtn_status
1000                  end
1001              end
1002              else
1003              begin
1004  
1005                  /*
1006                  ** Execute sp_sysmon_analyze 
1007                  */
1008                  exec sybsystemprocs..sp_sysmon_analyze @Seconds, 'Y', @section,
1009                      @applmon, @instid
1010              end
1011  
1012  
1013  
1014  
1015              if ((select object_id("#tempmonitors.tmci")) is not NULL)
1016              begin
1017                  drop index #tempmonitors.tmci
1018              end
1019              if ((select object_id("#temp_sysmon_baseline.tsbi")) is not NULL)
1020              begin
1021                  drop index #temp_sysmon_baseline.tsbi
1022              end
1023  
1024              select @active_instance_num = @active_instance_num + 1
1025              select @i = @i + 1
1026          end
1027          /* } */
1028  
1029          if (@section = "NULL")
1030          begin
1031              print "=============================== End of Report ================================="
1032          end
1033  
1034          if (@dumpcounters = "y")
1035          begin
1036  
1037              print ""
1038              print "==================== Start of Raw Monitor Counter Output ======================"
1039              print ""
1040              select field_name, group_name, field_id, value from #tempmonitors
1041              where value != 0
1042  
1043          end
1044  
1045          return 0
1046  

RESULT SETS
sp_sysmon_rset_001

DEFECTS
 QJWI 5 Join or Sarg Without Index 776
 MEST 4 Empty String will be replaced by Single Space 3
 MEST 4 Empty String will be replaced by Single Space 77
 MEST 4 Empty String will be replaced by Single Space 1037
 MEST 4 Empty String will be replaced by Single Space 1039
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 MTYP 4 Assignment type mismatch value: bigint = int 316
 MULT 4 Using literal database 'tempdb' 290
 QPR1 4 Potential Recompilation: index creation after access to table 600
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {parent}
956
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {parent}
973
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs bigint 489
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 808
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 809
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 956
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 973
 TNOI 4 Table with no index master..monEngine master..monEngine
 TNOI 4 Table with no index master..monThread master..monThread
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 TNOI 4 Table with no index master..sysmonitors master..sysmonitors
 VRUN 4 Variable is read and not initialized @msg 193
 MGTP 3 Grant to public master..monEngine  
 MGTP 3 Grant to public master..monThread  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public master..syscurconfigs  
 MGTP 3 Grant to public master..sysdevices  
 MGTP 3 Grant to public master..sysmonitors  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MLCH 3 Char type with length>30 char(80) 6
 MLCH 3 Char type with length>30 char(50) 42
 MLCH 3 Char type with length>30 char(80) 47
 MLCH 3 Char type with length>30 char(80) 51
 MLCH 3 Char type with length>30 char(79) 439
 MLCH 3 Char type with length>30 char(265) 914
 MLCH 3 Char type with length>30 char(127) 915
 MLCH 3 Char type with length>30 char(255) 916
 MNER 3 No Error Check should check @@error after insert 315
 MNER 3 No Error Check should check return value of exec 373
 MNER 3 No Error Check should check @@error after insert 455
 MNER 3 No Error Check should check @@error after insert 484
 MNER 3 No Error Check should check @@error after insert 556
 MNER 3 No Error Check should check @@error after insert 770
 MNER 3 No Error Check should check @@error after insert 887
 MNER 3 No Error Check should check @@error after insert 936
 MNER 3 No Error Check should check @@error after select into 954
 MNER 3 No Error Check should check @@error after select into 969
 MNER 3 No Error Check should check return value of exec 1008
 MUCO 3 Useless Code Useless Brackets 77
 MUCO 3 Useless Code Useless Brackets 93
 MUCO 3 Useless Code Useless Brackets 98
 MUCO 3 Useless Code Useless Brackets 103
 MUCO 3 Useless Code Useless Brackets 108
 MUCO 3 Useless Code Useless Brackets 112
 MUCO 3 Useless Code Useless Brackets 117
 MUCO 3 Useless Code Useless Brackets 122
 MUCO 3 Useless Code Useless Brackets 127
 MUCO 3 Useless Code Useless Brackets 132
 MUCO 3 Useless Code Useless Brackets 136
 MUCO 3 Useless Code Useless Brackets 147
 MUCO 3 Useless Code Useless Brackets 157
 MUCO 3 Useless Code Useless Brackets 166
 MUCO 3 Useless Code Useless Brackets 183
 MUCO 3 Useless Code Useless Brackets 191
 MUCO 3 Useless Code Useless Brackets 196
 MUCO 3 Useless Code Useless Brackets 230
 MUCO 3 Useless Code Useless Brackets 247
 MUCO 3 Useless Code Useless Brackets 263
 MUCO 3 Useless Code Useless Brackets 274
 MUCO 3 Useless Code Useless Brackets 278
 MUCO 3 Useless Code Useless Brackets 285
 MUCO 3 Useless Code Useless Brackets 297
 MUCO 3 Useless Code Useless Brackets 343
 MUCO 3 Useless Code Useless Brackets 352
 MUCO 3 Useless Code Useless Brackets 356
 MUCO 3 Useless Code Useless Brackets 379
 MUCO 3 Useless Code Useless Brackets 383
 MUCO 3 Useless Code Useless Brackets 433
 MUCO 3 Useless Code Useless Brackets 448
 MUCO 3 Useless Code Useless Brackets 489
 MUCO 3 Useless Code Useless Brackets 492
 MUCO 3 Useless Code Useless Brackets 500
 MUCO 3 Useless Code Useless Brackets 511
 MUCO 3 Useless Code Useless Brackets 520
 MUCO 3 Useless Code Useless Brackets 533
 MUCO 3 Useless Code Useless Brackets 559
 MUCO 3 Useless Code Useless Brackets 578
 MUCO 3 Useless Code Useless Brackets 622
 MUCO 3 Useless Code Useless Brackets 631
 MUCO 3 Useless Code Useless Brackets 652
 MUCO 3 Useless Code Useless Brackets 669
 MUCO 3 Useless Code Useless Brackets 683
 MUCO 3 Useless Code Useless Brackets 700
 MUCO 3 Useless Code Useless Brackets 710
 MUCO 3 Useless Code Useless Brackets 712
 MUCO 3 Useless Code Useless Brackets 758
 MUCO 3 Useless Code Useless Brackets 782
 MUCO 3 Useless Code Useless Brackets 801
 MUCO 3 Useless Code Useless Brackets 819
 MUCO 3 Useless Code Useless Brackets 823
 MUCO 3 Useless Code Useless Brackets 828
 MUCO 3 Useless Code Useless Brackets 833
 MUCO 3 Useless Code Useless Brackets 838
 MUCO 3 Useless Code Useless Brackets 843
 MUCO 3 Useless Code Useless Brackets 848
 MUCO 3 Useless Code Useless Brackets 857
 MUCO 3 Useless Code Useless Brackets 861
 MUCO 3 Useless Code Useless Brackets 873
 MUCO 3 Useless Code Useless Brackets 877
 MUCO 3 Useless Code Useless Brackets 909
 MUCO 3 Useless Code Useless Brackets 922
 MUCO 3 Useless Code Useless Brackets 934
 MUCO 3 Useless Code Useless Brackets 949
 MUCO 3 Useless Code Useless Brackets 965
 MUCO 3 Useless Code Useless Brackets 1015
 MUCO 3 Useless Code Useless Brackets 1019
 MUCO 3 Useless Code Useless Brackets 1029
 MUCO 3 Useless Code Useless Brackets 1034
 MUIN 3 Column created using implicit nullability 220
 MUIN 3 Column created using implicit nullability 235
 MUIN 3 Column created using implicit nullability 252
 MUIN 3 Column created using implicit nullability 268
 MUIN 3 Column created using implicit nullability 438
 MUIN 3 Column created using implicit nullability 763
 MUIN 3 Column created using implicit nullability 787
 MUIN 3 Column created using implicit nullability 914
 QAFM 3 Var Assignment from potentially many rows 573
 QAFM 3 Var Assignment from potentially many rows 612
 QAFM 3 Var Assignment from potentially many rows 714
 QAFM 3 Var Assignment from potentially many rows 746
 QAPT 3 Access to Proxy Table master..monEngine 775
 QAPT 3 Access to Proxy Table master..monThread 775
 QCRS 3 Conditional Result Set 1040
 QCTC 3 Conditional Table Creation 438
 QCTC 3 Conditional Table Creation 763
 QCTC 3 Conditional Table Creation 787
 QCTC 3 Conditional Table Creation 914
 QCTC 3 Conditional Table Creation 954
 QCTC 3 Conditional Table Creation 969
 QNAJ 3 Not using ANSI Inner Join 542
 QNAJ 3 Not using ANSI Inner Join 775
 QNAJ 3 Not using ANSI Inner Join 807
 QNAJ 3 Not using ANSI Inner Join 955
 QNUA 3 Should use Alias: Column field_name should use alias s 547
 QNUA 3 Should use Alias: Column field_name should use alias s 548
 QNUA 3 Should use Alias: Column parent should use alias co 808
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: #temp_sysmon_baseline.tsbi clustered
(group_name, field_id)
Intersection: {group_name}
546
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: #tempmonitors.tmci clustered
(group_name, field_id)
Intersection: {group_name}
575
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: #tempmonitors.tmci clustered
(group_name, field_id)
Intersection: {group_name}
614
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: #tempmonitors.tmci clustered
(group_name, field_id)
Intersection: {group_name}
748
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {name}
994
 VUNU 3 Variable is not used @sample_time 48
 VUNU 3 Variable is not used @outstr 63
 CRDO 2 Read Only Cursor Marker (has for read only clause) 804
 CRDO 2 Read Only Cursor Marker (has for read only clause) 925
 MDYE 2 Dynamic Exec Marker exec @rtn_status 996
 MRST 2 Result Set Marker 1040
 MSUB 2 Subquery Marker 993
 MTR1 2 Metrics: Comments Ratio Comments: 36% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 82 = 90dec - 10exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 432 2
 PRED_QUERY_COLLECTION 2 {me=master..monEngine, mt=master..monThread} 0 771
 PRED_QUERY_COLLECTION 2 {c=master..syscurconfigs, c2=master..sysconfigures} 0 804
 PRED_QUERY_COLLECTION 2 {c=master..syscurconfigs, c2=master..sysconfigures} 0 954

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysmonitors (1)  
reads table master..monThread (1)  
writes table tempdb..#tempIOCStats (1) 
writes table tempdb..#tempThreadStats (1) 
reads table master..sysconfigures (1)  
calls proc sybsystemprocs..sp_sysmon_analyze  
   calls proc sybsystemprocs..sp_sysmon_taskmgmt  
      reads table tempdb..#muxthreadsinfo (1) 
      read_writes table tempdb..#tmpThreadPool (1) 
      reads table tempdb..#tempmonitors (1) 
      reads table master..monThreadPool (1)  
   calls proc sybsystemprocs..sp_sysmon_netio  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_xactmgmt  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_memory  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_maccess  
      reads table tempdb..#tempmonitors (1) 
      reads table tempdb..#tempconfigures (1) 
   calls proc sybsystemprocs..sp_sysmon_index  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_appmgmt  
      reads table tempdb..#tempmonitors (1) 
      read_writes table tempdb..#tempappl (1) 
   calls proc sybsystemprocs..sp_sysmon_pcache  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_locks  
      reads table tempdb..#tempmonitors (1) 
      read_writes table tempdb..#foo (1) 
   calls proc sybsystemprocs..sp_sysmon_parallel  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_repagent  
      reads table tempdb..#tempmonitors (1) 
      reads table master..sysdatabases (1)  
      read_writes table tempdb..#tempdatabases (1) 
   calls proc sybsystemprocs..sp_sysmon_xactsum  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_dcache  
      calls proc sybsystemprocs..sp_sysmon_dcache_sum  
         reads table tempdb..#tempmonitors (1) 
         reads table master..sysconfigures (1)  
      calls proc sybsystemprocs..sp_sysmon_dcache_dtl  
         read_writes table tempdb..#foo (1) 
         reads table tempdb..#tempmonitors (1) 
         reads table tempdb..#cachemap (1) 
         reads table tempdb..#pool_detail_per_cache (1) 
   calls proc sybsystemprocs..sp_sysmon_kernel_threaded  
      read_writes table tempdb..#tmpLoad (1) 
      reads table tempdb..#tempmonitors (1) 
      reads table tempdb..#tempIOCStats (1) 
      reads table master..monEngine (1)  
      reads table tempdb..#tempWorkQueue (1) 
      read_writes table tempdb..#tmpThreadPool (1) 
      read_writes table tempdb..#tmpEngUtilization (1) 
      reads table master..monSysLoad (1)  
      reads table master..monThread (1)  
      reads table tempdb..#muxthreadsinfo (1) 
      reads table master..monThreadPool (1)  
      reads table tempdb..#tempThreadStats (1) 
   calls proc sybsystemprocs..sp_sysmon_diskio  
      reads table tempdb..#tempmonitors (1) 
      reads table tempdb..#devicemap (1) 
   read_writes table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_kernel  
      reads table tempdb..#tempmonitors (1) 
      reads table master..syscurconfigs (1)  
   calls proc sybsystemprocs..sp_sysmon_recovery  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_mdcache  
      reads table tempdb..#tempmonitors (1) 
      read_writes table tempdb..#tmp_res_monitor (1) 
      calls proc sybsystemprocs..sp_monitorconfig  
         calls proc sybsystemprocs..sp_aux_checkroleperm  
            reads table master..syscurconfigs (1)  
            reads table master..sysconfigures (1)  
         read_writes table tempdb..#resource_result_tbl (1) 
         calls proc sybsystemprocs..sp_validateconfigname  
            calls proc sybsystemprocs..sp_getmessage  
               calls proc sybsystemprocs..sp_validlang  
                  reads table master..syslanguages (1)  
               reads table master..syslanguages (1)  
               reads table sybsystemprocs..sysusermessages  
               reads table master..sysmessages (1)  
            writes table sybsystemprocs..sp_validateconfigname_rset_001 
            reads table master..sysconfigures (1)  
            reads table master..syscurconfigs (1)  
         writes table sybsystemprocs..sp_monitorconfig_rset_001 
         read_writes table tempdb..#resource_monitor_tbl (1) 
         reads table master..syscurconfigs (1)  
         reads table master..sysconfigures (1)  
         calls proc sybsystemprocs..sp_getmessage  
         writes table sybsystemprocs..sp_monitorconfig_rset_002 
         calls proc sybsystemprocs..sp_exec_SQL  
            writes table sybsystemprocs..sp_exec_SQL_rset_001 
   calls proc sybsystemprocs..sp_sysmon_hk  
      reads table master..sysengines (1)  
      reads table tempdb..#tempmonitors (1) 
   calls proc sybsystemprocs..sp_sysmon_esp  
      reads table tempdb..#tempmonitors (1) 
      reads table tempdb..#tempconfigures (1) 
   calls proc sybsystemprocs..sp_sysmon_wpm  
      reads table tempdb..#tempconfigures (1) 
      reads table tempdb..#tempmonitors (1) 
writes table tempdb..#pool_detail_per_cache (1) 
writes table tempdb..#tempWorkQueue (1) 
calls proc sybsystemprocs..sp_sysmon_analyze_mda  
   calls proc sybsystemprocs..sp_sysmon_dcachestats  
      read_writes table tempdb..#syscacheconfig (1) 
      reads table master..syscurconfigs (1)  
      read_writes table tempdb..#recommendations_tab (1) 
      reads table tempdb..#tempmonitors (1) 
      read_writes table tempdb..#tempcachestats (1) 
      read_writes table tempdb..#tempobjstats (1) 
      reads table master..sysconfigures (1)  
      read_writes table tempdb..#tempcachedobjstats (1) 
      read_writes table tempdb..#tempbufpoolstats (1) 
      read_writes table tempdb..#obj_details (1) 
reads table sybsystemprocs..sysobjects  
writes table tempdb..#tempconfigures (1) 
reads table master..syscurconfigs (1)  
writes table sybsystemprocs..sp_sysmon_rset_001 
reads table master..monEngine (1)  
calls proc sybsystemprocs..sp_sysmon_collect  
   reads table master..monEngine (1)  
   reads table master..syscurconfigs (1)  
   writes table tempdb..#tempThreadStats (1) 
   writes table tempdb..#tempIOCStats (1) 
   reads table master..sysconfigures (1)  
   reads table master..monTask (1)  
   reads table sybsystemprocs..sysobjects  
   reads table master..monWorkQueue (1)  
   reads table master..monIOController (1)  
   reads table master..monThread (1)  
   writes table tempdb..#tempWorkQueue (1) 
   calls proc sybsystemprocs..sp_sysmon_collect_mda  
      reads table tempdb..sysobjects (1)  
      reads table master..monOpenObjectActivity (1)  
      reads table master..monCachePool (1)  
      reads table master..monDataCache (1)  
      reads table master..monCachedObject (1)  
   reads table tempdb..sysobjects (1)  
reads table master..sysdevices (1)  
writes table tempdb..#devicemap (1) 
writes table tempdb..#muxthreadsinfo (1) 
read_writes table tempdb..#tempmonitors (1) 
read_writes table tempdb..#temp_sysmon_baseline (1) 
writes table tempdb..#cachemap (1)