#include "TracyView.hpp" namespace tracy { const char* View::DecodeContextSwitchReasonCode( uint8_t reason ) { switch( reason ) { case 0: return "Executive"; case 1: return "FreePage"; case 2: return "PageIn"; case 3: return "PoolAllocation"; case 4: return "DelayExecution"; case 5: return "Suspended"; case 6: return "UserRequest"; case 7: return "WrExecutive"; case 8: return "WrFreePage"; case 9: return "WrPageIn"; case 10: return "WrPoolAllocation"; case 11: return "WrDelayExecution"; case 12: return "WrSuspended"; case 13: return "WrUserRequest"; case 14: return "WrEventPair"; case 15: return "WrQueue"; case 16: return "WrLpcReceive"; case 17: return "WrLpcReply"; case 18: return "WrVirtualMemory"; case 19: return "WrPageOut"; case 20: return "WrRendezvous"; case 21: return "WrKeyedEvent"; case 22: return "WrTerminated"; case 23: return "WrProcessInSwap"; case 24: return "WrCpuRateControl"; case 25: return "WrCalloutStack"; case 26: return "WrKernel"; case 27: return "WrResource"; case 28: return "WrPushLock"; case 29: return "WrMutex"; case 30: return "WrQuantumEnd"; case 31: return "WrDispatchInt"; case 32: return "WrPreempted"; case 33: return "WrYieldExecution"; case 34: return "WrFastMutex"; case 35: return "WrGuardedMutex"; case 36: return "WrRundown"; case 37: return "WrAlertByThreadId"; case 38: return "WrDeferredPreempt"; case 39: return "WrPhysicalFault"; case 40: return "MaximumWaitReason"; default: return "unknown"; } } const char* View::DecodeContextSwitchReason( uint8_t reason ) { switch( reason ) { case 0: return "(Thread is waiting for the scheduler)"; case 1: return "(Thread is waiting for a free virtual memory page)"; case 2: return "(Thread is waiting for a virtual memory page to arrive in memory)"; case 4: return "(Thread execution is delayed)"; case 5: return "(Thread execution is suspended)"; case 6: return "(Thread is waiting on object - WaitForSingleObject, etc.)"; case 7: return "(Thread is waiting for the scheduler)"; case 8: return "(Thread is waiting for a free virtual memory page)"; case 9: return "(Thread is waiting for a virtual memory page to arrive in memory)"; case 11: return "(Thread execution is delayed)"; case 12: return "(Thread execution is suspended)"; case 13: return "(Thread is waiting for window messages)"; case 15: return "(Thread is waiting on KQUEUE)"; case 24: return "(CPU rate limiting)"; case 34: return "(Waiting for a Fast Mutex)"; default: return ""; } } const char* View::DecodeContextSwitchStateCode( uint8_t state ) { switch( state ) { case 0: return "Initialized"; case 1: return "Ready"; case 2: return "Running"; case 3: return "Standby"; case 4: return "Terminated"; case 5: return "Waiting"; case 6: return "Transition"; case 7: return "DeferredReady"; case 101: return "D (disk sleep)"; case 102: return "I (idle)"; case 103: return "R (running)"; case 104: return "S (sleeping)"; case 105: return "T (stopped)"; case 106: return "t (tracing stop)"; case 107: return "W"; case 108: return "X (dead)"; case 109: return "Z (zombie)"; case 110: return "P (parked)"; default: return "unknown"; } } const char* View::DecodeContextSwitchState( uint8_t state ) { switch( state ) { case 0: return "(Thread has been initialized, but has not yet started)"; case 1: return "(Thread is waiting to use a processor because no processor is free. The thread is prepared to run on the next available processor)"; case 2: return "(Thread is currently using a processor)"; case 3: return "(Thread is about to use a processor)"; case 4: return "(Thread has finished executing and has exited)"; case 5: return "(Thread is not ready to use the processor because it is waiting for a peripheral operation to complete or a resource to become free)"; case 6: return "(Thread is waiting for a resource, other than the processor, before it can execute)"; case 7: return "(Thread has been selected to run on a specific processor but have not yet beed scheduled)"; case 101: return "(Uninterruptible sleep, usually IO)"; case 102: return "(Idle kernel thread)"; case 103: return "(Running or on run queue)"; case 104: return "(Interruptible sleep, waiting for an event to complete)"; case 105: return "(Stopped by job control signal)"; case 106: return "(Stopped by debugger during the tracing)"; case 107: return "(Paging)"; case 108: return "(Dead task is scheduling one last time)"; case 109: return "(Zombie process)"; case 110: return "(Parked)"; default: return ""; } } }