1#include "Instrumentation.h"
3#include "Services/Variables.h"
5#include "Rendering/IGraphicsDevice.h"
6#include "Rendering/CommandGroupAnnotation.h"
8#include "Renderer/IRenderer.h"
10#include "Foundation/HashFunctions.h"
11#include "Foundation/StringView.h"
12#include "Foundation/Reflection/TypeDatabase.h"
17#include <unordered_map>
19#ifdef COGS_USE_NVTOOLSEXT
20#define WIN32_LEAN_AND_MEAN
22#include <nvToolsExt.h>
25#ifdef COGS_USE_INTEL_ITT
27__itt_domain* itt_cogs_core_domain =
nullptr;
30void Cogs::Core::Instrumentation::initialize(Context * )
35#ifdef COGS_USE_MICROPROFILE
37 MicroProfileSetEnableAllGroups(
true);
38 MicroProfileSetForceMetaCounters(
true);
42void Cogs::Core::Instrumentation::initializeGpu(Context * context)
45#ifdef COGS_USE_MICROPROFILE
46 auto device = context->device;
47 if (context->variables->get(
"profiling.gpu",
false) && device->getType() == GraphicsDeviceType::Direct3D11) {
48 MicroProfileGpuInitD3D11((ID3D11Device *)device->getNativeDevice());
53void Cogs::Core::Instrumentation::beginGpuThread(IContext * )
57void Cogs::Core::Instrumentation::initializeThread(
const char* name)
61#ifdef COGS_USE_SUPERLUMINAL
62 PerformanceAPI_SetCurrentThreadName(name);
65#ifdef COGS_USE_MICROPROFILE
66 MicroProfileOnThreadCreate(name);
70void Cogs::Core::Instrumentation::destroyThread()
72#ifdef COGS_USE_MICROPROFILE
73 MicroProfileOnThreadExit();
77void Cogs::Core::Instrumentation::beginGpuScope(IContext* iContext,
const char* name)
79 iContext->pushCommandGroupAnnotation(name);
82void Cogs::Core::Instrumentation::endGpuScope(IContext* iContext)
84 iContext->popCommandGroupAnnotation();