Scripts to generate the CPU usage of a database.
DECLARE @ts_now bigint = (SELECT cpu_ticks/(cpu_ticks/ms_ticks)FROM sys.dm_os_sys_info);
SELECT TOP(30) SQLProcessUtilization AS [SQL Server Process CPU Utilization],
SystemIdle AS [System Idle Process],
100 - SystemIdle - SQLProcessUtilization AS [Other Process CPU Utilization],
DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS [Event Time]
FROM (
SELECT record.value('(./Record/@id)[1]', 'int') AS record_id,
record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int')
AS [SystemIdle],
record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]',
'int')
AS [SQLProcessUtilization], [timestamp]
FROM (
SELECT [timestamp], CONVERT(xml, record) AS [record]
FROM sys.dm_os_ring_buffers
WHERE ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR'
AND record LIKE '%
) AS y
ORDER BY record_id DESC;
Currently the CPU usage is showing per minutes.
To change the CPU usage table to every 10 minutes.
change the value below from -1 to -10.


3 comments:
McAfee offers a high level of security and has an advanced scanning feature. The McAfee firewall secures the users from unknown websites. It also gives the users a full report about the threats which the antivirus had already blocked from the system. The retail card of McAfee will permit the users to download, install and activate McAfee product to their system by inserting a compact disk or going to its website.
MCAFEE.COM/ACTIVATE
Today the Microsoft Office is the basic need of every computer users. Microsoft Office is available in the various versions like- Microsoft Office 2007, Microsoft Office 2010, Microsoft Office 2013, Microsoft Office 2016, Microsoft Office 365 and the Microsoft Office released your latest version that is Microsoft Office 2019 on 24 September 2018.
OFFICE.COM/SETUP
Microsoft Office is the ideal merger of office productivity and first-rate services provided by Microsoft. The latest version, Office 2019, is greatly appreciated by its users. Older versions such as Office 2016, Office 2013, and Office 2010, are remarkable in their own way as well. It provides cloud-based service in the Office 365 version, and its packages are available for home and business alike. It provides additional features for the Business and Enterprise versions, such as social networking opportunities and business email services. Microsoft Office is one amongst the most popular toolset used by people across the world. If you want to get Office setup, visit Office.com/setup.
OFFICE.COM/SETUP
Post a Comment