{{{C++ // Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreTypes.h" #include "Trace/Trace.h" #include "Trace/Detail/Channel.h" #include "Trace/Detail/Channel.inl"

#if !defined(CPUPROFILERTRACE_ENABLED) #if UE_TRACE_ENABLED && !UE_BUILD_SHIPPING #define CPUPROFILERTRACE_ENABLED 1 #else #define CPUPROFILERTRACE_ENABLED 0 #endif #endif

#if CPUPROFILERTRACE_ENABLED

UE_TRACE_CHANNEL_EXTERN(CpuChannel, CORE_API);

struct FCpuProfilerTrace {

};

#define TRACE_CPUPROFILER_SHUTDOWN() \

// Trace a scoped cpu timing event providing a static string (const ANSICHAR* or const TCHAR*) // as the scope name and a trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL_STR("My Scoped Timer A", CpuChannel) // Note: The event will be emitted only if both the given channel and CpuChannel is enabled. #define TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL_STR(NameStr, Channel) \

// Trace a scoped cpu timing event providing a scope name (plain text) and a trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL(MyScopedTimer::A, CpuChannel) // Note: Do not use this macro with a static string because, in that case, additional quotes will // be added around the event scope name. // Note: The event will be emitted only if both the given channel and CpuChannel is enabled. #define TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL(Name, Channel) \

// Trace a scoped cpu timing event providing a static string (const ANSICHAR* or const TCHAR*) // as the scope name. It will use the Cpu trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE_STR("My Scoped Timer A") #define TRACE_CPUPROFILER_EVENT_SCOPE_STR(NameStr) \

// Trace a scoped cpu timing event providing a scope name (plain text) and a trace channel. // It will use the Cpu trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE(MyScopedTimer::A) // Note: Do not use this macro with a static string because, in that case, additional quotes will // be added around the event scope name. #define TRACE_CPUPROFILER_EVENT_SCOPE(Name) \

// Trace a scoped cpu timing event providing a dynamic string (const ANSICHAR* or const TCHAR*) // as the scope name and a trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE_TEXT_ON_CHANNEL(*MyScopedTimerNameString, CpuChannel) // Note: This macro has a larger overhead compared to macro that accepts a plain text name // or a static string. Use it only if scope name really needs to be a dynamic string. #define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT_ON_CHANNEL(Name, Channel) \

// Trace a scoped cpu timing event providing a dynamic string (const ANSICHAR* or const TCHAR*) // as the scope name. It will use the Cpu trace channel. // Example: TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*MyScopedTimerNameString) // Note: This macro has a larger overhead compared to macro that accepts a plain text name // or a static string. Use it only if scope name really needs to be a dynamic string. #define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(Name) \

#else

#define TRACE_CPUPROFILER_SHUTDOWN() #define TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL_STR(NameStr, Channel) #define TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL(Name, Channel) #define TRACE_CPUPROFILER_EVENT_SCOPE_STR(NameStr) #define TRACE_CPUPROFILER_EVENT_SCOPE(Name) #define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT_ON_CHANNEL(Name, Channel) #define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(Name)

#endif

}}}