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 ...
随机推荐
- "504 Gateway Time-out"
"504 Gateway Time-out”是什么意思? 意思为:网关超时!
- Nginx配置文件nginx.conf中文详解(总结)
PS:这篇是目前最完整的Nginx配置参数中文说明.更详细的模块参数请参考:http://wiki.nginx.org/Main #定义Nginx运行的用户和用户组 ...
- JDBC连接执行 MySQL 存储过程报权限错误:User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted,
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国 ...
- mongodb复制集配置
#more /opt/mongodb3.0/mongodb_im_conf_47020/mongodb3.0_im_47020.cnf dbpath = /opt/mongodb3.0/mongodb ...
- 使用Android Studio和Genymotion模拟器搭建Andriod开发环境
一.Android Studio下载 1.打开http://www.android.com/ 2.依照下图步骤打开下载页面 a.在页脚部分点击“App Developer Resources” b.点 ...
- UVALive 7472
题意 有n个循环 给出x a b c xi+1=(a*x+b)%c 要求是从这些循环中各取一个数 使加和最大并且给出一个m 满足sum%m!=0 n的范围是4次方 c的范围是3次方 训练赛的时候看了一 ...
- PHP程序员必须清楚的问题汇总
PHP程序员必须清楚的问题汇总 投稿:hebedich 字体:[增加 减小] 类型:转载 这篇文章主要介绍了PHP程序员必须清楚的问题汇总,需要的朋友可以参考下 你是否正在准备寻找一份PH ...
- A20板子上的触摸屏设备号变化后解决
- html 符号大全
░ ▒ ▬ ♦ ◊ ◦ ♠ ♣ ▣ ۰•● ❤ ●•۰► ◄ ▧ ▨ ♨ ◐ ◑ ↔ ↕ ▪ ▫ ☼ ♦ ♧♡♂♀♠♣♥❤☜☞☎☏⊙◎ ☺☻☼▧▨♨◐◑↔↕▪ ▒ ◊◦▣▤▥ ▦▩◘ ◈◇♬♪♩♭♪の ...
- ubuntu lnmp
apt-get update apt-get upgrade apt-get install libxml2 libxml2-dev apt-get install make apt-get inst ...