Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
MasayukiOzawa committed Nov 14, 2018
1 parent cbf5daf commit feb8ba6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Ring Buffer/Ring Buffer Type の取得.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SELECT
[type]
FROM
(
SELECT
record.value('(/Record/@type)[1]', 'varchar(500)') AS [type]
FROM
(
SELECT
timestamp,
CAST(record AS xml) AS record
FROM
sys.dm_os_ring_buffers
) AS T
) AS T2
GROUP BY type
15 changes: 15 additions & 0 deletions Ring Buffer/Ring Buffer の情報取得.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT
DATEADD (ms, -1 * (si.ms_ticks - [timestamp]), GETDATE()) AS utc_time,
T.*
FROM
(
SELECT
timestamp,
CAST(record AS xml) AS record
FROM
sys.dm_os_ring_buffers
) AS T
CROSS JOIN
sys.dm_os_sys_info si
WHERE
record.exist('/Record[@type="RING_BUFFER_MEMORY_BROKER"]') > 0
28 changes: 28 additions & 0 deletions Ring Buffer/System Health の target の取得.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DROP TABLE IF EXISTS #system_health
CREATE TABLE #system_health (c1 int primary key, target_data xml)
CREATE PRIMARY XML INDEX system_health_xml_index ON #system_health (target_data)

INSERT INTO #system_health
SELECT
1,
CAST(target_data AS xml) AS target_data
FROM
sys.dm_xe_session_targets
WHERE
event_session_address =
(SELECT address FROM sys.dm_xe_sessions WHERE name = 'system_health')
AND
target_name = 'ring_buffer'
GO

SELECT target_event
FROM (
SELECT
CAST(event.query('data(./@name)') AS varchar(100)) AS target_event
FROM
(
SELECT * FROM #system_health
) AS T
OUTER APPLY target_data.nodes('//event') AS T2(event)
) AS T2
GROUP BY target_event

0 comments on commit feb8ba6

Please sign in to comment.