Database | Proc | Application | Created | Links |
sybsystemprocs | sp_helpthread ![]() | ![]() | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** Messages for "sp_helpthread" 4 ** 18365, "The kernel mode that is currently in use does not support thread pools." 5 ** 18367, "The specified thread pool does not exist." 6 ** 7 */ 8 create procedure sp_helpthread 9 @threadpool varchar(30) = NULL /* thread pool name */ 10 as 11 12 declare @msg varchar(1024) 13 14 begin 15 16 if @@trancount = 0 17 begin 18 set chained off 19 end 20 21 set transaction isolation level 1 22 23 set nocount on 24 25 IF @@kernelmode = 'process' 26 begin 27 /* 18365, "The kernel mode that is currently in use does not support thread pools." */ 28 raiserror 18365 29 return (1) 30 end 31 32 /* 33 ** If threadpool name not given, get them all. 34 */ 35 if @threadpool is null 36 begin 37 select @threadpool = "%" 38 end 39 40 /* 41 ** Does the threadpool exist? 42 */ 43 if not exists (select * 44 from master.dbo.monThreadPool 45 where ThreadPoolName like @threadpool) 46 begin 47 /* 18367, "The specified thread pool does not exist." */ 48 raiserror 18367 49 return (1) 50 end 51 52 /* 53 ** Display threadpool information. 54 */ 55 56 create table #spt_thread 57 ( 58 thread_id int, 59 osthread_id int, 60 state varchar(30), 61 affinity int NULL, 62 instance_id tinyint 63 ) 64 65 /* 66 ** Initialize #spt_threadpool from monThreadPool. 67 */ 68 select ThreadPoolName "Name", Type, Size "CurrentSize", 69 TargetSize "TargetSize", IdleTimeout, 70 ThreadPoolDescription "Description" 71 into #spt_threadpool 72 from master.dbo.monThreadPool 73 where ThreadPoolName like @threadpool 74 75 exec sp_autoformat @fulltabname = #spt_threadpool, 76 @selectlist = "Name, Type, CurrentSize, TargetSize, IdleTimeout, Description", 77 @orderby = "order by Name" 78 79 print "" 80 /* 81 ** Display thread info when @threadpool is specified. 82 */ 83 if @threadpool != "%" 84 begin 85 insert into #spt_thread 86 select ThreadID, OSThreadID, State, ThreadAffinity, InstanceID 87 from master.dbo.monThread 88 where ThreadPoolName like @threadpool 89 90 exec sp_autoformat @fulltabname = #spt_thread, 91 @selectlist = "thread_id, osthread_id, state, affinity, instance_id", 92 @orderby = "order by thread_id" 93 end 94 95 drop table #spt_threadpool 96 drop table #spt_thread 97 98 return (0) 99 end 100 101
exec sp_procxmode 'sp_helpthread', 'AnyMode' go Grant Execute on sp_helpthread to public go
DEPENDENCIES |
PROCS AND TABLES USED reads table master..monThread (1) ![]() reads table master..monThreadPool (1) ![]() calls proc sybsystemprocs..sp_autoformat ![]() reads table tempdb..syscolumns (1) ![]() read_writes table tempdb..#colinfo_af (1) calls proc sybsystemprocs..sp_autoformat ![]() reads table master..syscolumns (1) ![]() reads table tempdb..systypes (1) ![]() reads table master..systypes (1) ![]() calls proc sybsystemprocs..sp_namecrack ![]() writes table tempdb..#spt_threadpool (1) writes table tempdb..#spt_thread (1) |