HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Extended Events, CPU_TIME

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cpu_timeextendedevents

Problem

I want to create a new session in Extended Events to track Queries that use lots of CPU_Time, but whats the Unit of CPU_TIME? ms? Microseconds?...

Duration seems to be Microseconds but I don't really know CPU_TIME and can't find any information regarding this...

Thanks,
Jimm

Solution

The sys.dm_xe_object_columns DMV shows metadata for each of the columns available for each event. Included is a "description" column, which is useful in answering your question.

select 
    name
    , object_name
    , type_name
    , description 
from
    sys.dm_xe_object_columns
where
    name = 'cpu_time' -- any XE column name here


This will show you all of the extended event objects that have a cpu_time column, and the description will tell you what unit of measure the column uses.

You can see here that units may vary depending on the object. For example:

  • sql_statement_completed: Indicates the CPU time (in microseconds) that is consumed by the statement.



  • sql_batch_completed: The CPU time (in milliseconds) used by the batch.

Code Snippets

select 
    name
    , object_name
    , type_name
    , description 
from
    sys.dm_xe_object_columns
where
    name = 'cpu_time' -- any XE column name here

Context

StackExchange Database Administrators Q#148572, answer score: 9

Revisions (0)

No revisions yet.