convert Timestamp to Real time
select r.ring_buffer_address,
r.ring_buffer_type,
dateadd (ms, r.[timestamp] - sysinfo.sqlserver_start_time_ms_ticks, sysinfo.sqlserver_start_time) as record_time,
cast(r.record as xml) record
from sys.dm_os_ring_buffers r
cross join sys.dm_os_sys_info sysinfo
where ring_buffer_type='RING_BUFFER_RESOURCE_MONITOR'
order by 3 desc
select r.ring_buffer_address,
r.ring_buffer_type,
dateadd (ms, r.[timestamp] - sysinfo.ms_ticks, getdate()) as record_time,
cast(r.record as xml) record
from sys.dm_os_ring_buffers r
cross join sys.dm_os_sys_info sysinfo
where ring_buffer_type='RING_BUFFER_RESOURCE_MONITOR'
order by 3 desc
DATEADD (ms, -1 * ((sys.cpu_ticks / sys.cpu_ticks_in_ms) - r.timestamp), GETDATE()) as record_time -- sys.cpu_ticks_in_ms 在2008R2中才有
DECLARE @ts_now bigint = (SELECT cpu_ticks/(cpu_ticks/ms_ticks) FROM sys.dm_os_sys_info);
SELECT TOP(2)
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 '%<SystemHealth>%') AS x ) AS y ORDER BY record_id DESC;
convert Timestamp to Real time的更多相关文章
- SQL Server数据库(时间戳timestamp)类型 (转载)
timestamp介绍 公开数据库中自动生成的唯一二进制数字的数据类型. timestamp 通常用作给表行加版本戳的机制. 存储大小为 8 个字节. 不可为空的 timestamp 列在语义上等价于 ...
- PHP 使用用户自定义的比较函数对数组中的值进行排序
原文:PHP 使用用户自定义的比较函数对数组中的值进行排序 usort (PHP 4, PHP 5) usort — 使用用户自定义的比较函数对数组中的值进行排序 说明 bool ...
- 学习笔记:The Best of MySQL Forum
http://mysql.rjweb.org/bestof.html I have tagged many of the better forum threads. 'Better' is based ...
- How to get current timestamps in Java
How to get current timestamps in Java Timestamp timestamp = new Timestamp(System.currentTimeMillis() ...
- [leetcode-635-Design Log Storage System]
You are given several logs that each log contains a unique id and timestamp. Timestamp is a string t ...
- Java 时间工具类
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 1.Calendar 转化 String ...
- Go语言基础之3--时间和日期序列
一.时间和日期类型 1. time包 2. time.Time类型,用来表示时间 3. 获取当前时间, now := time.Now() 实例1-1 打印输出当前时间 package main i ...
- logstash 写入数据到elasticsearch 索引相差8小时解决办法
问题说明 Logstash用的UTC时间, logstash在按每天输出到elasticsearch时,因为时区使用utc,造成每天8:00才创建当天索引,而8:00以前数据则输出到昨天的索引 # 使 ...
- 函数索引引用的函数必须是immutable类型
用户在使用中,可能会用到基于函数的索引,但是函数是非 immutable 类型的,导致函数索引无法创建.如: test=# create index ind_t1 on t1(to_char(crea ...
随机推荐
- Shell 操作练习
#! /bin/sh ############################### # -- # # author jackluo # # net.webjoy@gmail.com # ###### ...
- SQL Server 中 with tmp 临时表的用法
SQL Server 中 with tmp 临时表的用法 ----------with临时表用法,有时候采用临时表比采用in的效率更高,避免了全表扫描. 实例中实现了查询普通题.大题.子题目的sql ...
- QMessageBox 使用方法
在Qt中经常需要弹出窗口,QMessageBox可以实现此功能,一共有三种窗口,information, question, 和 warning,critical, about分别对应感叹号,问号和叉 ...
- JS。 问题类型:穷举,迭代。两个关键词:break和continue
问题类型: 穷举:(在不知道什么情况下是我们需要的结果的时候只能够让它一个一个都给走一遍) 百鸡百钱:公鸡1钱,母鸡2钱,小鸡0.5钱. 思路: 公鸡买100只,母鸡,小鸡都是0只: 母鸡50只,公鸡 ...
- 常用NuGet插件
1.Install-Package System.Data.SQLite 2.Install-Package FluentData
- android之OptionsMenu
首先编写res/layout/Activity_main.xml 代码如下: <LinearLayout xmlns:android="http://schemas.android.c ...
- Python的包管理工具--PIP安装使用
最新安装方式 # wget https://bootstrap.pypa.io/get-pip.py # python get-pip.py // 使用该方式安装已经不再要求提前安装setuptoo ...
- Matplotlib for Python Developers
这个教程也很不错,http://reverland.org/python/2012/09/07/matplotlib-tutorial/ 也可以参考官网的Gallery,http://matplotl ...
- delphi下如何获得不带扩展名的文件名?
Edit1.Text:=ChangeFileExt(ExtractFileName(Application.ExeName),'') ; //获取到应用程序名后,将后缀名清空就可以啦.
- JS中的工厂模式
.一个栗子: var BicycleShop = function(){}; BicycleShop.prototype = { sellBicycle : function( model ){ va ...