Reply to Re: Capture CPU Utilization in TSQL

Your name:

Reply:


Posted by Erland Sommarskog on 01/02/07 22:54

SQLJunkie (vsinha73@gmail.com) writes:
> I have spent a good amount of time scouring google groups but this is
> all I have found:
> SELECT
> (CAST(@@CPU_BUSY AS float)
> * @@TIMETICKS
> / 10000.00
> / CAST(DATEDIFF (s, SP2.Login_Time, GETDATE()) AS float)) AS
> CPUBusyPct
> FROM
> master..SysProcesses AS SP2
> WHERE
> SP2.Cmd = 'LAZY WRITER'
>
> Problem is this gives me total amount of time CPU in %) has been busy
> since the server last started. What I want is the % for the instant -
> the same number we see in Task Manager and PerfMon.

Performance counters are in sysperfinfo on SQL 2000 and
sys.dm_os_performance_counters on SQL 2005, but I could find the item
you are looking for in these views.

But I saw in Books Online for SQL 2005 that these values are cumultative. To
get the present value, sample with some interval. I guess you could to
the same: query @@CPU_BUSY twice with a second or so in between.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация