Sql-server – Extended Events, CPU_TIME

extended-eventssql-server-2012

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

Best Answer

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.