DatabaseProcApplicationCreatedLinks
sybsystemprocssp_sysmon_collect  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_sysmon_collect
3         @interval_or_option char(12), /* Time interval string, option 
4         ** "begin_sample" or "end_sample" */
5         @section_name char(80), /* used to decide call to mda proc */
6         @applmon char(14), /* Application monitoring option */
7         @noclear int = 0 /* Whether to operate in no clear mode */
8     as
9     
10        /* --------- declare local variables --------- */
11        declare @status int /* hold sproc status codes */
12        declare @mda_procname char(50) /* call sp_sysmon_collect_mda */
13        declare @rtn_status int /* hold mda sproc return status codes */
14        declare @mda_status int /* check if mda is enabled */
15        declare @enabled_status int /* success of enabling monitoring */
16        declare @cache_wizard_section tinyint /* 1 indicates cache wizard section */
17        declare @monitor_usage_count int /* # of processes using monitor counters */
18    
19        /* --------- Setup Environment --------- */
20        set nocount on /* disable row counts being sent to client */
21    
22        /*
23        ** If the interval_or_option string is not an option (i.e. "begin_sample" or "end_sample")
24        ** then it must be an time interval string. Validate that.
25        */
26    
27        if (@interval_or_option != "begin_sample" and @interval_or_option != "end_sample")
28        begin
29            if (patindex("[0-9][0-9]:[0-5][0-9]:[0-5][0-9]", @interval_or_option) = 0 or
30                    patindex("00:00:00", @interval_or_option) = 1)
31            begin
32                raiserror 18179, @interval_or_option
33                return 1
34            end
35        end
36    
37        /*
38        ** In a transaction?, disallow since it might make recovery impossible
39        */
40        if @@trancount > 0
41        begin
42            /* 17260, "Can't run %1! from within a transaction." */
43            raiserror 17260, "sp_sysmon"
44            return 1
45        end
46        else
47            set chained off
48        set transaction isolation level 1
49        select @mda_procname = 'sp_sysmon_collect_mda'
50    
51        /*
52        ** Retrieve the current settings for 'enable monitoring'(356)
53        ** and 'per object statistics'(387) config options. We will
54        ** have to enable these if they are not enabled and restore them
55        ** to their original state at the end of sampling.
56        ** We use @mda_status as a bit map with the first bit representing 
57        ** config # 356 and the 2nd bit representing 387.
58        */
59        select @mda_status = isnull(cur.value, 0)
60        from master.dbo.sysconfigures con,
61            master.dbo.syscurconfigs cur
62        where con.config = 356
63            and con.config *= cur.config
64    
65        select @mda_status = @mda_status + 2 * isnull(cur.value, 0)
66        from master.dbo.sysconfigures con,
67            master.dbo.syscurconfigs cur
68        where con.config = 387
69            and con.config *= cur.config
70    
71        if (@section_name = "cache wizard")
72        begin
73            select @cache_wizard_section = 1
74        end
75        else
76        begin
77            select @cache_wizard_section = 0
78        end
79    
80    
81        /*
82        ** Clear out all monitor counters 
83        ** only if an interval is specified
84        ** or if the option is "begin_sample"
85        */
86        if (@interval_or_option != "end_sample")
87        begin
88            /*
89            ** Clear and enable monitor counters if not in noclear mode.  In 
90            ** noclear mode this will have been done by the sp_sysmon procedure.
91            */
92            if (@noclear = 0)
93            begin
94                /*
95                ** Clear monitor counter values to create
96                ** baseline.
97                */
98                dbcc monitor("clear", "all", "on")
99                dbcc monitor("clear", "spinlock_s", "on")
100               if (@applmon != "no_appl" and @cache_wizard_section != 1)
101               begin
102                   dbcc monitor("clear", "appl", "on")
103               end
104           end
105   
106           /* snapshot the monThread statistics */
107           if (@@kernelmode != "process" and
108                   @section_name in ("NULL", "kernel"))
109           begin
110               if (@interval_or_option != "begin_sample")
111               begin
112                   /*
113                   ** If user has specified an interval, this procedure will not
114                   ** return until data are collected in both start and end points.
115                   ** So, we can use a local worktable to save the baseline data.
116                   */
117                   insert into #tempThreadStats
118                   select th.InstanceID,
119                       th.ThreadID, th.ThreadPoolID,
120                       th.MinorFaults, th.MajorFaults,
121                       th.UserTime, th.SystemTime,
122                       th.VoluntaryCtxtSwitches,
123                       th.NonVoluntaryCtxtSwitches,
124                       tk.Name "TaskName"
125                   from master.dbo.monThread th, master.dbo.monTask tk
126                   where th.KTID *= tk.KTID
127                       and th.InstanceID *= tk.InstanceID
128   
129                   insert into #tempIOCStats
130                   select InstanceID,
131                       ControllerID, BlockingPolls, NonBlockingPolls,
132                       EventPolls, NonBlockingEventPolls, FullPolls,
133                       Events, Type
134                   from master.dbo.monIOController
135   
136                   insert into #tempWorkQueue
137                   select Name, TotalRequests, QueuedRequests, WaitTime
138                   from master.dbo.monWorkQueue
139               end
140               else
141               begin
142                   /*
143                   ** The option is "begin_sample". This procedure would return
144                   ** after collecting data at the start point. The data collection
145                   ** at the end point might be in another session. So, we cannot
146                   ** save the baseline data to a local worktable here. Considering
147                   ** "begin_sample" and "end_sample" must set @clear as 1, it
148                   ** would generate some inaccurate data if multiple sessions
149                   ** execute sp_sysmon with "begin_sample" and "end_sample"
150                   ** concurrently. Therefore, we can use a global worktable to
151                   ** save the baseline data in this case.
152                   */
153                   if not exists (select 1 from tempdb.dbo.sysobjects
154                           where name = 'tempThreadStats' and uid = 1)
155                   begin
156                       select th.InstanceID,
157                           th.ThreadID, th.ThreadPoolID,
158                           th.MinorFaults, th.MajorFaults,
159                           th.UserTime, th.SystemTime,
160                           th.VoluntaryCtxtSwitches,
161                           th.NonVoluntaryCtxtSwitches,
162                           tk.Name "TaskName"
163                       into tempdb.dbo.tempThreadStats
164                       from master.dbo.monThread th, master.dbo.monTask tk
165                       where th.KTID *= tk.KTID
166                           and th.InstanceID *= tk.InstanceID
167   
168                       /*
169                       ** When sp_sysmon 'begin_sample'/'end_sample' is executed in multiple
170                       ** sessions concurrently, the global work tables would cause some
171                       ** accurate report data. For this situation, we cannot completely 
172                       ** eliminate. As a mitigation, we would issue a warning message to
173                       ** user to let him/her know that the reported data might be inaccurate.
174                       ** To detect this situation, we will add a special row in tempThreadStats
175                       ** to record the session number running sp_sysmon 'begin_sample'/'end_sample'.
176                       ** For this row, we will use a special InstanceID 255 as a flag. In the
177                       ** ThreadID column, the value will be the session number running sp_sysmon
178                       ** 'begin_sample'/'end_sample'. For example,
179                       **     InstanceID      ThreadID
180                       **       255              2
181                       ** means there are 2 sessions running sp_sysmon 'begin_sample'/'end_sample'
182                       ** now. When a session finished the execution of "sp_sysmon 'end_sample'",
183                       ** we will decrease the session number. After the session number becomes to
184                       ** 0, it means there is no session running sp_sysmon 'begin_sample'/'end_sample'.
185                       ** In this case, we can remove the 3 global work tables safely.
186                       ** Here, we would initialize usage count in worktable.
187                       */
188                       insert tempdb.dbo.tempThreadStats(InstanceID, ThreadID,
189                           ThreadPoolID, MinorFaults, MajorFaults,
190                           UserTime, SystemTime, VoluntaryCtxtSwitches,
191                           NonVoluntaryCtxtSwitches)
192                       values (255, 1, 0, 0, 0, 0, 0, 0, 0)
193                   end
194                   else
195                   begin
196                       raiserror 17197, "tempdb.dbo.tempThreadStats"
197   
198                       /* Increase the session number running sp_sysmon 'begin_sample'/'end_sample'. */
199                       update tempdb.dbo.tempThreadStats
200                       set ThreadID = ThreadID + 1
201                       where InstanceID = 255
202                   end
203   
204                   if not exists (select 1 from tempdb.dbo.sysobjects
205                           where name = 'tempIOCStats' and uid = 1)
206                   begin
207                       select InstanceID,
208                           ControllerID, BlockingPolls, NonBlockingPolls,
209                           EventPolls, NonBlockingEventPolls, FullPolls,
210                           Events, Type
211                       into tempdb.dbo.tempIOCStats
212                       from master.dbo.monIOController
213                   end
214                   else
215                   begin
216                       raiserror 17197, "tempdb.dbo.tempIOCStats"
217                   end
218   
219                   if not exists (select 1 from tempdb.dbo.sysobjects
220                           where name = 'tempWorkQueue' and uid = 1)
221                   begin
222                       select Name, TotalRequests, QueuedRequests, WaitTime
223                       into tempdb.dbo.tempWorkQueue
224                       from master.dbo.monWorkQueue
225                   end
226                   else
227                   begin
228                       raiserror 17197, "tempdb.dbo.tempWorkQueue"
229                   end
230               end
231           end
232   
233           /*
234           ** If user has specified the interval and a section other than
235           ** cache wizard, there is no need to worry about the
236           ** sp_sysmon_collect_mda procedure
237           ** Else,  invoke sp_sysmon_collect_mda if it has been installed.
238           */
239           if (((@interval_or_option = "begin_sample") or
240                       (@cache_wizard_section = 1))
241                   and exists (select 1 from sybsystemprocs.dbo.sysobjects where
242                           sysstat & 7 = 4 and name like @mda_procname))
243           begin
244   
245               /*
246               ** We don't want the scan of sysattributes by
247               ** config_admin() nor the MDA collect operation to
248               ** affect monitoring. Hence disable monitoring and
249               ** disable MDA using mdaconfig. After the initial
250               ** snapshot is taken, enable monitoring and MDA.
251               */
252               select @status = mdaconfig('freeze', 'begin')
253               dbcc monitor("sample", "all", "off")
254               dbcc monitor("sample", "spinlock_s", "off")
255   
256               /* Enable MDA if not enabled */
257               if (@mda_status & 1 = 0)
258               begin
259                   select @enabled_status =
260                       config_admin(23, 356, 1, 0, NULL, NULL)
261               end
262   
263               if (@mda_status & 2 = 0)
264               begin
265                   select @enabled_status =
266                       config_admin(23, 387, 1, 0, NULL, NULL)
267               end
268   
269               /* Initial snapshot */
270               exec @rtn_status = @mda_procname @interval_or_option,
271                   @mda_status
272               /* Turn monitoring back on */
273               dbcc monitor("sample", "all", "on")
274               dbcc monitor("sample", "spinlock_s", "on")
275               select @status = mdaconfig('freeze', 'end')
276           end
277   
278           /*
279           ** if the option is "begin_sample", then
280           ** the job is done, so return 
281           */
282   
283           if (@interval_or_option = "begin_sample")
284           begin
285               return 0
286           end
287   
288           /*
289           ** Sleep while accumulating counter statistics
290           ** for the interval time specified
291           */
292   
293           waitfor delay @interval_or_option
294       end
295   
296       /*
297       **  Sample Performance Stats
298       */
299       dbcc monitor("sample", "spinlock_s", "off")
300       if (@applmon != "no_appl")
301       begin
302           dbcc monitor("sample", "appl", "off")
303       end
304       select @monitor_usage_count = @@monitors_active
305       dbcc monitor("sample", "all", "off")
306   
307       /*
308       ** Check to see whether the monitor counter usage count was decremented
309       ** when monitor counters were turned off.  If it was not, this is
310       ** probably because the user executed sp_sysmon begin_sample from
311       ** another login session.  Display a message warning the user that
312       ** the usage count was not decremented and suggesting that they
313       ** run dbcc monitor(decrement) to decrement it.
314       */
315       if (@@monitors_active = @monitor_usage_count)
316       begin
317           raiserror 19374
318       end
319   
320       dbcc monitor("select", "spinlock_s", "on")
321       dbcc monitor("select", "all", "on")
322   
323       select @rtn_status = 0
324   
325       /* snapshot the kernel statistics */
326       if (@@kernelmode != "process" and
327               @section_name in ("NULL", "kernel"))
328       begin
329           /*
330           ** If the option is "end_sample", the baseline data are in global worktables.
331           ** In this case, we need move data to local worktables for future process.
332           */
333           if (@interval_or_option = "end_sample")
334           begin
335               /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #tempThreadStats
336               select tempdb.dbo.tempThreadStats.InstanceID, tempdb.dbo.tempThreadStats.ThreadID, tempdb.dbo.tempThreadStats.ThreadPoolID, tempdb.dbo.tempThreadStats.MinorFaults, tempdb.dbo.tempThreadStats.MajorFaults, tempdb.dbo.tempThreadStats.UserTime, tempdb.dbo.tempThreadStats.SystemTime, tempdb.dbo.tempThreadStats.VoluntaryCtxtSwitches, tempdb.dbo.tempThreadStats.NonVoluntaryCtxtSwitches, tempdb.dbo.tempThreadStats.TaskName from tempdb.dbo.tempThreadStats
337               where InstanceID != 255
338   
339               /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #tempIOCStats
340               select tempdb.dbo.tempIOCStats.InstanceID, tempdb.dbo.tempIOCStats.ControllerID, tempdb.dbo.tempIOCStats.BlockingPolls, tempdb.dbo.tempIOCStats.NonBlockingPolls, tempdb.dbo.tempIOCStats.EventPolls, tempdb.dbo.tempIOCStats.NonBlockingEventPolls, tempdb.dbo.tempIOCStats.FullPolls, tempdb.dbo.tempIOCStats.Events, tempdb.dbo.tempIOCStats.[Type] from tempdb.dbo.tempIOCStats
341   
342               /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #tempWorkQueue
343               select tempdb.dbo.tempWorkQueue.Name, tempdb.dbo.tempWorkQueue.TotalRequests, tempdb.dbo.tempWorkQueue.QueuedRequests, tempdb.dbo.tempWorkQueue.WaitTime from tempdb.dbo.tempWorkQueue
344   
345               /*
346               ** Data in the 3 global worktables have been copied to local worktables.
347               ** So, they are not required any more. We can remove them here.
348               */
349               update tempdb.dbo.tempThreadStats set ThreadID = ThreadID - 1 where InstanceID = 255
350               if exists (select 1 from tempdb.dbo.tempThreadStats where InstanceID = 255 and ThreadID = 0)
351               begin
352                   drop table tempdb.dbo.tempThreadStats
353                   drop table tempdb.dbo.tempIOCStats
354                   drop table tempdb.dbo.tempWorkQueue
355               end
356           end
357   
358           /* diff the counters from the start of the sample */
359           update #tempThreadStats
360           set MinorFaults = n.MinorFaults - o.MinorFaults,
361               MajorFaults = n.MajorFaults - o.MajorFaults,
362               UserTime = n.UserTime - o.UserTime,
363               SystemTime = n.SystemTime - o.SystemTime,
364               VoluntaryCtxtSwitches = n.VoluntaryCtxtSwitches - o.VoluntaryCtxtSwitches,
365               NonVoluntaryCtxtSwitches = n.NonVoluntaryCtxtSwitches - o.NonVoluntaryCtxtSwitches
366           from #tempThreadStats o, master.dbo.monThread n
367           where o.ThreadID = n.ThreadID
368               and o.InstanceID = n.InstanceID
369   
370           /* set the TaskName to reflect the Engine where appropriate */
371           update #tempThreadStats
372           set t.TaskName = "Engine " + convert(varchar(4), e.EngineNumber)
373           from #tempThreadStats t, master.dbo.monEngine e
374           where e.ThreadID = t.ThreadID
375               and e.InstanceID = t.InstanceID
376   
377           update #tempIOCStats
378           set BlockingPolls = n.BlockingPolls - o.BlockingPolls,
379               NonBlockingPolls = n.NonBlockingPolls - o.NonBlockingPolls,
380               EventPolls = n.EventPolls - o.EventPolls,
381               NonBlockingEventPolls = n.NonBlockingEventPolls - o.NonBlockingEventPolls,
382               FullPolls = n.FullPolls - o.FullPolls,
383               Events = n.Events - o.Events
384           from #tempIOCStats o, master.dbo.monIOController n
385           where o.ControllerID = n.ControllerID
386               and o.InstanceID = n.InstanceID
387   
388           update #tempWorkQueue
389           set TotalRequests = n.TotalRequests - o.TotalRequests,
390               QueuedRequests = n.QueuedRequests - o.QueuedRequests,
391               WaitTime = n.WaitTime - o.WaitTime
392           from #tempWorkQueue o, master.dbo.monWorkQueue n
393           where o.Name = n.Name
394       end
395   
396       /*
397       ** Call sp_sysmon_collect_mda to store the snapshot at
398       ** the end of time interval only if the section is a
399       ** valid MDA section.
400       */
401       if (@cache_wizard_section = 1)
402       begin
403           if exists (select 1 from sybsystemprocs.dbo.sysobjects where
404                       sysstat & 7 = 4 and name = 'sp_sysmon_collect_mda')
405           begin
406               /*
407               ** Halt the MDA counters during the time we execute
408               ** sp_sysmon_collect_mda
409               */
410               select @status = mdaconfig('freeze', 'begin')
411               exec @rtn_status = @mda_procname "end_sample",
412                   @mda_status output
413               select @status = mdaconfig('freeze', 'end')
414   
415               /* Reset the config #356, 387 if it was set by us */
416               if (@mda_status & 1 = 0)
417               begin
418                   select @enabled_status =
419                       config_admin(23, 356, 0, 0, NULL, NULL)
420               end
421   
422               if (@mda_status & 2 = 0)
423               begin
424                   select @enabled_status =
425                       config_admin(23, 387, 0, 0, NULL, NULL)
426               end
427           end
428   
429           else
430           begin
431               select @rtn_status = 1
432               /* Print message that MDA is not installed */
433               raiserror 19122, "MDA", "installmontables", "(mon_role)"
434           end
435   
436           if @rtn_status = 1
437           begin
438               return @rtn_status
439           end
440       end
441       /* If we turned on monitoring during begin_sample
442       ** turn it off now. Note that we wouldn't turn this on
443       ** for the interval case unless the 'cache wizard' section
444       ** was specified.
445       */
446       else if ((@mda_status & 1 = 1) and
447               (@interval_or_option = "end_sample")
448               and exists (select 1 from sybsystemprocs.dbo.sysobjects where
449                       sysstat & 7 = 4 and name like @mda_procname))
450       begin
451           /* 99 indicates sp_sysmon_collect_mda should just return the stored
452           ** value of @mda_status and is chosen since it has the lower bits
453           ** 1,2 set.
454           */
455           select @mda_status = 99
456           exec @rtn_status = @mda_procname "end_sample",
457               @mda_status output
458   
459           /* Reset the config #356, 387 if it was set by us */
460           if (@mda_status & 1 = 0)
461           begin
462               select @enabled_status =
463                   config_admin(23, 356, 0, 0, NULL, NULL)
464           end
465   
466           if (@mda_status & 2 = 0)
467           begin
468               select @enabled_status =
469                   config_admin(23, 387, 0, 0, NULL, NULL)
470           end
471       end
472   
473       /*
474       ** If the interval is less than a second
475       ** do not produce the report
476       */
477   
478       if (@interval_or_option = "00:00:00")
479       begin
480           raiserror 18545, "sp_sysmon"
481           return 1
482       end
483   
484       return 0
485   

DEFECTS
 PERR 6 Parsing Error Could not find definition for table tempdb..tempThreadStats 188
 PERR 6 Parsing Error Could not find definition for table tempdb..tempThreadStats 199
 PERR 6 Parsing Error Could not find definition for table tempdb..tempThreadStats 336
 PERR 6 Parsing Error Could not find definition for table tempdb..tempIOCStats 340
 PERR 6 Parsing Error Could not find definition for table tempdb..tempWorkQueue 343
 PERR 6 Parsing Error Could not find definition for table tempdb..tempThreadStats 349
 PERR 6 Parsing Error Could not find definition for table tempdb..tempThreadStats 350
 QJWI 5 Join or Sarg Without Index 63
 QJWI 5 Join or Sarg Without Index 69
 QJWI 5 Join or Sarg Without Index 126
 QJWI 5 Join or Sarg Without Index 165
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 MULT 4 Using literal database 'tempdb' tempdb..sysobjects 153
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 163
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 188
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 199
 MULT 4 Using literal database 'tempdb' tempdb..sysobjects 204
 MULT 4 Using literal database 'tempdb' tempdb..tempIOCStats 211
 MULT 4 Using literal database 'tempdb' tempdb..sysobjects 219
 MULT 4 Using literal database 'tempdb' tempdb..tempWorkQueue 223
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 336
 MULT 4 Using literal database 'tempdb' tempdb..tempIOCStats 340
 MULT 4 Using literal database 'tempdb' tempdb..tempWorkQueue 343
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 349
 MULT 4 Using literal database 'tempdb' tempdb..tempThreadStats 350
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 62
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 68
 QTYP 4 Comparison type mismatch Comparison type mismatch: other vs int 201
 QTYP 4 Comparison type mismatch Comparison type mismatch: other vs int 337
 QTYP 4 Comparison type mismatch Comparison type mismatch: other vs int 349
 QTYP 4 Comparison type mismatch Comparison type mismatch: other vs int 350
 TNOI 4 Table with no index master..monEngine master..monEngine
 TNOI 4 Table with no index master..monIOController master..monIOController
 TNOI 4 Table with no index master..monTask master..monTask
 TNOI 4 Table with no index master..monThread master..monThread
 TNOI 4 Table with no index master..monWorkQueue master..monWorkQueue
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 MGTP 3 Grant to public master..monEngine  
 MGTP 3 Grant to public master..monIOController  
 MGTP 3 Grant to public master..monTask  
 MGTP 3 Grant to public master..monThread  
 MGTP 3 Grant to public master..monWorkQueue  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public master..syscurconfigs  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MGTP 3 Grant to public tempdb..sysobjects  
 MLCH 3 Char type with length>30 char(80) 5
 MLCH 3 Char type with length>30 char(50) 12
 MNER 3 No Error Check should check @@error after insert 117
 MNER 3 No Error Check should check @@error after insert 129
 MNER 3 No Error Check should check @@error after insert 136
 MNER 3 No Error Check should check @@error after select into 156
 MNER 3 No Error Check should check @@error after insert 188
 MNER 3 No Error Check should check @@error after update 199
 MNER 3 No Error Check should check @@error after select into 207
 MNER 3 No Error Check should check @@error after select into 222
 MNER 3 No Error Check should check @@error after insert 335
 MNER 3 No Error Check should check @@error after insert 339
 MNER 3 No Error Check should check @@error after insert 342
 MNER 3 No Error Check should check @@error after update 349
 MNER 3 No Error Check should check @@error after update 359
 MNER 3 No Error Check should check @@error after update 371
 MNER 3 No Error Check should check @@error after update 377
 MNER 3 No Error Check should check @@error after update 388
 MUCO 3 Useless Code Useless Brackets 27
 MUCO 3 Useless Code Useless Brackets 29
 MUCO 3 Useless Code Useless Brackets 71
 MUCO 3 Useless Code Useless Brackets 86
 MUCO 3 Useless Code Useless Brackets 92
 MUCO 3 Useless Code Useless Brackets 100
 MUCO 3 Useless Code Useless Brackets 107
 MUCO 3 Useless Code Useless Brackets 110
 MUCO 3 Useless Code Useless Brackets 239
 MUCO 3 Useless Code Useless Brackets 257
 MUCO 3 Useless Code Useless Brackets 263
 MUCO 3 Useless Code Useless Brackets 283
 MUCO 3 Useless Code Useless Brackets 300
 MUCO 3 Useless Code Useless Brackets 315
 MUCO 3 Useless Code Useless Brackets 326
 MUCO 3 Useless Code Useless Brackets 333
 MUCO 3 Useless Code Useless Brackets 401
 MUCO 3 Useless Code Useless Brackets 416
 MUCO 3 Useless Code Useless Brackets 422
 MUCO 3 Useless Code Useless Brackets 446
 MUCO 3 Useless Code Useless Brackets 460
 MUCO 3 Useless Code Useless Brackets 466
 MUCO 3 Useless Code Useless Brackets 478
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 163
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 188
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 199
 MZMB 3 Zombie: use of non-existent object tempdb..tempIOCStats 211
 MZMB 3 Zombie: use of non-existent object tempdb..tempWorkQueue 223
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 336
 MZMB 3 Zombie: use of non-existent object tempdb..tempIOCStats 340
 MZMB 3 Zombie: use of non-existent object tempdb..tempWorkQueue 343
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 349
 MZMB 3 Zombie: use of non-existent object tempdb..tempThreadStats 350
 QAFM 3 Var Assignment from potentially many rows 59
 QAFM 3 Var Assignment from potentially many rows 65
 QAPT 3 Access to Proxy Table master..monTask 125
 QAPT 3 Access to Proxy Table master..monThread 125
 QAPT 3 Access to Proxy Table master..monIOController 134
 QAPT 3 Access to Proxy Table master..monWorkQueue 138
 QAPT 3 Access to Proxy Table master..monTask 164
 QAPT 3 Access to Proxy Table master..monThread 164
 QAPT 3 Access to Proxy Table master..monIOController 212
 QAPT 3 Access to Proxy Table master..monWorkQueue 224
 QAPT 3 Access to Proxy Table master..monThread 366
 QAPT 3 Access to Proxy Table master..monEngine 373
 QAPT 3 Access to Proxy Table master..monIOController 384
 QAPT 3 Access to Proxy Table master..monWorkQueue 392
 QISO 3 Set isolation level 48
 QJWT 3 Join or Sarg Without Index on temp table 367
 QJWT 3 Join or Sarg Without Index on temp table 374
 QJWT 3 Join or Sarg Without Index on temp table 385
 QJWT 3 Join or Sarg Without Index on temp table 393
 QNAJ 3 Not using ANSI Inner Join 366
 QNAJ 3 Not using ANSI Inner Join 373
 QNAJ 3 Not using ANSI Inner Join 384
 QNAJ 3 Not using ANSI Inner Join 392
 QNAO 3 Not using ANSI Outer Join 60
 QNAO 3 Not using ANSI Outer Join 66
 QNAO 3 Not using ANSI Outer Join 125
 QNAO 3 Not using ANSI Outer Join 164
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {name}
242
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {name}
404
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysobjects.ncsysobjects unique
(name, uid)
Intersection: {name}
449
 VNRD 3 Variable is not read @status 413
 VNRD 3 Variable is not read @rtn_status 456
 VNRD 3 Variable is not read @enabled_status 468
 MDYE 2 Dynamic Exec Marker exec @rtn_status 270
 MDYE 2 Dynamic Exec Marker exec @rtn_status 411
 MDYE 2 Dynamic Exec Marker exec @rtn_status 456
 MSUB 2 Subquery Marker 153
 MSUB 2 Subquery Marker 204
 MSUB 2 Subquery Marker 219
 MSUB 2 Subquery Marker 241
 MSUB 2 Subquery Marker 403
 MSUB 2 Subquery Marker 448
 MTR1 2 Metrics: Comments Ratio Comments: 38% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 46 = 50dec - 6exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 226 2

DEPENDENCIES
PROCS AND TABLES USED
reads table master..monWorkQueue (1)  
reads table master..monIOController (1)  
writes table tempdb..#tempThreadStats (1) 
writes table tempdb..#tempWorkQueue (1) 
writes table tempdb..#tempIOCStats (1) 
reads table master..sysconfigures (1)  
calls proc sybsystemprocs..sp_sysmon_collect_mda  
   reads table master..monOpenObjectActivity (1)  
   reads table master..monCachePool (1)  
   reads table master..monDataCache (1)  
   reads table tempdb..sysobjects (1)  
   reads table master..monCachedObject (1)  
reads table sybsystemprocs..sysobjects  
reads table master..monTask (1)  
reads table master..monThread (1)  
reads table master..syscurconfigs (1)  
reads table master..monEngine (1)  
reads table tempdb..sysobjects (1)  

CALLERS
called by proc sybsystemprocs..sp_sysmon