What is PreviousCState in Context Switch Event and is this exposed by TraceProcessing?

23 views Asked by At

When looking through the Context Switch Event definition at https://learn.microsoft.com/en-us/windows/win32/etw/cswitch I found a PreviousCState property.

[EventType{36}, EventTypeName{"CSwitch"}]
class CSwitch : Thread_V2
{
  uint32 NewThreadId;
  uint32 OldThreadId;
  sint8  NewThreadPriority;
  sint8  OldThreadPriority;
  uint8  PreviousCState; <--- What is this?
  sint8  SpareByte;
  sint8  OldThreadWaitReason;
  sint8  OldThreadWaitMode;
  sint8  OldThreadState;
  sint8  OldThreadWaitIdealProcessor;
  uint32 NewThreadWaitTime;
  uint32 Reserved;
};

I know that Windows abstracts in the CPU Power profile settings the C States away. Is this the actual CPU C-State or the OS abstracted C-State and is this somewhere exposed in the TraceProcessing library? So far I did not find it anywhere.

Update

I checked in WPA and the C-State is there. It looks like it is the Windows C-State where 0 is C0,C1/C1E and all deeper idle states are 1 according to the data. I am sure that the CPU was in C6 state because the weighted average ready time is 80us which is in line with my expectation that the CPU wakeup was very slow due to low power Idle states.

enter image description here

0

There are 0 answers