From f1e74f6855e36807b62ee85be5db61316d87be23 Mon Sep 17 00:00:00 2001 From: crueter Date: Wed, 6 Aug 2025 07:48:11 +0200 Subject: [PATCH] [meta] remove MicroProfile (#185) Signed-off-by: crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/185 Reviewed-by: Lizzie --- .ci/license-header.sh | 2 + externals/CMakeLists.txt | 19 +- externals/microprofile/README.md | 7 - externals/microprofile/microprofile.h | 3606 --------------- externals/microprofile/microprofile_html.h | 3868 ----------------- externals/microprofile/microprofileui.h | 3349 -------------- src/android/app/src/main/jni/native.cpp | 6 - .../apps/audio_renderer/audio_renderer.cpp | 8 +- .../adsp/apps/opus/opus_decoder.cpp | 6 +- src/audio_core/renderer/system_manager.cpp | 10 +- src/common/CMakeLists.txt | 5 +- src/common/microprofile.cpp | 6 - src/common/microprofile.h | 24 - src/common/microprofileui.h | 18 - src/core/core.cpp | 28 - src/core/core.h | 8 - src/core/core_timing.cpp | 5 - src/core/cpu_manager.cpp | 8 +- src/core/hle/kernel/kernel.cpp | 16 +- src/core/hle/kernel/kernel.h | 9 +- src/core/hle/kernel/physical_core.cpp | 11 +- src/core/hle/kernel/svc.cpp | 9 +- .../service/nvnflinger/hardware_composer.cpp | 7 +- src/core/hle/service/sockets/bsd.cpp | 1 - src/core/memory/cheat_engine.cpp | 8 +- .../.cmake/api/v1/query/cache-v2 | 0 .../.cmake/api/v1/query/cmakeFiles-v1 | 0 .../.cmake/api/v1/query/codemodel-v2 | 0 .../.qtc/package-manager/LICENSE.conan | 21 + .../.qtc/package-manager/auto-setup.cmake | 405 ++ .../.qtc/package-manager/conan.cmake | 1026 +++++ .../.qtc/package-manager/conan_provider.cmake | 655 +++ .../maintenance_tool_provider.cmake | 329 ++ .../maintenance_tool_provider.qs | 60 + .../tests/build/Desktop-Debug/CMakeCache.txt | 409 ++ .../CMakeFiles/4.0.3/CMakeCCompiler.cmake | 84 + .../CMakeFiles/4.0.3/CMakeCXXCompiler.cmake | 108 + .../4.0.3/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 15424 bytes .../4.0.3/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 15448 bytes .../CMakeFiles/4.0.3/CMakeSystem.cmake | 15 + .../4.0.3/CompilerIdC/CMakeCCompilerId.c | 905 ++++ .../CMakeFiles/4.0.3/CompilerIdC/a.out | Bin 0 -> 15544 bytes .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 923 ++++ .../CMakeFiles/4.0.3/CompilerIdCXX/a.out | Bin 0 -> 15552 bytes .../CMakeFiles/CMakeConfigureLog.yaml | 510 +++ .../CMakeFiles/cmake.check_cache | 1 + .../build/Desktop-Debug/qtcsettings.cmake | 12 + src/video_core/buffer_cache/buffer_cache.cpp | 8 +- src/video_core/buffer_cache/buffer_cache.h | 8 - .../buffer_cache/buffer_cache_base.h | 5 - src/video_core/dma_pusher.cpp | 8 +- src/video_core/engines/fermi_2d.cpp | 8 +- src/video_core/engines/maxwell_dma.cpp | 17 +- src/video_core/gpu.cpp | 4 +- src/video_core/gpu_thread.cpp | 10 +- src/video_core/host1x/syncpoint_manager.cpp | 7 +- src/video_core/macro/macro.cpp | 8 +- src/video_core/macro/macro_interpreter.cpp | 7 +- src/video_core/macro/macro_jit_x64.cpp | 9 +- .../renderer_opengl/gl_rasterizer.cpp | 19 - .../renderer_opengl/gl_resource_manager.cpp | 28 +- .../gl_staging_buffer_pool.cpp | 6 +- .../renderer_opengl/renderer_opengl.cpp | 4 +- .../renderer_vulkan/vk_pipeline_cache.cpp | 4 - .../renderer_vulkan/vk_present_manager.cpp | 8 +- .../renderer_vulkan/vk_rasterizer.cpp | 9 - .../renderer_vulkan/vk_scheduler.cpp | 3 - src/yuzu/CMakeLists.txt | 2 - src/yuzu/bootmanager.cpp | 6 - src/yuzu/debugger/profiler.cpp | 227 - src/yuzu/debugger/profiler.h | 33 - src/yuzu/main.cpp | 29 - src/yuzu/main.h | 8 - src/yuzu/uisettings.cpp | 8 +- src/yuzu/uisettings.h | 7 +- src/yuzu_cmd/yuzu.cpp | 8 - 76 files changed, 5547 insertions(+), 11468 deletions(-) delete mode 100644 externals/microprofile/README.md delete mode 100644 externals/microprofile/microprofile.h delete mode 100644 externals/microprofile/microprofile_html.h delete mode 100644 externals/microprofile/microprofileui.h delete mode 100644 src/common/microprofile.cpp delete mode 100644 src/common/microprofile.h delete mode 100644 src/common/microprofileui.h create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cache-v2 create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cmakeFiles-v1 create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/codemodel-v2 create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/LICENSE.conan create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan_provider.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/maintenance_tool_provider.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/maintenance_tool_provider.qs create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeCache.txt create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCCompiler.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCXXCompiler.cmake create mode 100755 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeDetermineCompilerABI_C.bin create mode 100755 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeDetermineCompilerABI_CXX.bin create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeSystem.cmake create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdC/CMakeCCompilerId.c create mode 100755 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdC/a.out create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100755 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/a.out create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeConfigureLog.yaml create mode 100644 src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/cmake.check_cache create mode 100644 src/dynarmic/tests/build/Desktop-Debug/qtcsettings.cmake delete mode 100644 src/yuzu/debugger/profiler.cpp delete mode 100644 src/yuzu/debugger/profiler.h diff --git a/.ci/license-header.sh b/.ci/license-header.sh index b65ef6303f..d14d5adf42 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -14,6 +14,8 @@ FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r` echo "Done" for file in $FILES; do + [ -f "$file" ] || continue + EXTENSION="${file##*.}" case "$EXTENSION" in kts|kt|cpp|h) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 99fd28dd37..8c15d546f7 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2016 Citra Emulator Project @@ -90,20 +90,6 @@ if (mbedtls_ADDED) endif() endif() -# MicroProfile -add_library(microprofile INTERFACE) -target_include_directories(microprofile INTERFACE ./microprofile) -if (ENABLE_MICROPROFILE) - target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=1) -else() - target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=0) -endif() - -# GCC bugs -if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND MINGW) - target_compile_options(microprofile INTERFACE "-Wno-array-bounds") -endif() - # libusb if (ENABLE_LIBUSB AND NOT TARGET libusb::usb) add_subdirectory(libusb) @@ -130,6 +116,7 @@ if (YUZU_USE_EXTERNAL_SDL2) set(SDL_FILE ON) endif() + include(CPM) set(CPM_USE_LOCAL_PACKAGES OFF) if ("${YUZU_SYSTEM_PROFILE}" STREQUAL "steamdeck") @@ -415,7 +402,7 @@ if (ANDROID) endif() endif() -if ((CMAKE_SYSTEM_NAME STREQUAL "Linux" OR ANDROID) AND NOT TARGET gamemode::headers) +if (UNIX AND NOT APPLE AND NOT TARGET gamemode::headers) add_library(gamemode INTERFACE) target_include_directories(gamemode INTERFACE gamemode) add_library(gamemode::headers ALIAS gamemode) diff --git a/externals/microprofile/README.md b/externals/microprofile/README.md deleted file mode 100644 index 0a58d1c5ac..0000000000 --- a/externals/microprofile/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# microprofile - -MicroProfile is a embeddable profiler in a single file, written in C++ - -It can display profile information in the application, or by generating captures via a minimal built in webserver. - -For more information see the project webpage at https://bitbucket.org/jonasmeyer/microprofile diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h deleted file mode 100644 index 15a1ddc980..0000000000 --- a/externals/microprofile/microprofile.h +++ /dev/null @@ -1,3606 +0,0 @@ -#pragma once -// This is free and unencumbered software released into the public domain. -// Anyone is free to copy, modify, publish, use, compile, sell, or -// distribute this software, either in source code form or as a compiled -// binary, for any purpose, commercial or non-commercial, and by any -// means. -// In jurisdictions that recognize copyright laws, the author or authors -// of this software dedicate any and all copyright interest in the -// software to the public domain. We make this dedication for the benefit -// of the public at large and to the detriment of our heirs and -// successors. We intend this dedication to be an overt act of -// relinquishment in perpetuity of all present and future rights to this -// software under copyright law. -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// For more information, please refer to -// -// *********************************************************************** -// -// -// -// -// Howto: -// Call these functions from your code: -// MicroProfileOnThreadCreate -// MicroProfileMouseButton -// MicroProfileMousePosition -// MicroProfileModKey -// MicroProfileFlip <-- Call this once per frame -// MicroProfileDraw <-- Call this once per frame -// MicroProfileToggleDisplayMode <-- Bind to a key to toggle profiling -// MicroProfileTogglePause <-- Bind to a key to toggle pause -// -// Use these macros in your code in blocks you want to time: -// -// MICROPROFILE_DECLARE -// MICROPROFILE_DEFINE -// MICROPROFILE_DECLARE_GPU -// MICROPROFILE_DEFINE_GPU -// MICROPROFILE_SCOPE -// MICROPROFILE_SCOPEI -// MICROPROFILE_SCOPEGPU -// MICROPROFILE_SCOPEGPUI -// MICROPROFILE_META -// -// -// Usage: -// -// { -// MICROPROFILE_SCOPEI("GroupName", "TimerName", nColorRgb): -// ..Code to be timed.. -// } -// -// MICROPROFILE_DECLARE / MICROPROFILE_DEFINE allows defining groups in a shared place, to ensure sorting of the timers -// -// (in global scope) -// MICROPROFILE_DEFINE(g_ProfileFisk, "Fisk", "Skalle", nSomeColorRgb); -// -// (in some other file) -// MICROPROFILE_DECLARE(g_ProfileFisk); -// -// void foo(){ -// MICROPROFILE_SCOPE(g_ProfileFisk); -// } -// -// Once code is instrumented the gui is activeted by calling MicroProfileToggleDisplayMode or by clicking in the upper left corner of -// the screen -// -// The following functions must be implemented before the profiler is usable -// debug render: -// void MicroProfileDrawText(int nX, int nY, uint32_t nColor, const char* pText, uint32_t nNumCharacters); -// void MicroProfileDrawBox(int nX, int nY, int nX1, int nY1, uint32_t nColor, MicroProfileBoxType = MicroProfileBoxTypeFlat); -// void MicroProfileDrawLine2D(uint32_t nVertices, float* pVertices, uint32_t nColor); -// Gpu time stamps: (See below for d3d/opengl helper) -// uint32_t MicroProfileGpuInsertTimeStamp(); -// uint64_t MicroProfileGpuGetTimeStamp(uint32_t nKey); -// uint64_t MicroProfileTicksPerSecondGpu(); -// threading: -// const char* MicroProfileGetThreadName(); Threadnames in detailed view -// -// Default implementations of Gpu timestamp functions: -// Opengl: -// in .c file where MICROPROFILE_IMPL is defined: -// #define MICROPROFILE_GPU_TIMERS_GL -// call MicroProfileGpuInitGL() on startup -// D3D11: -// in .c file where MICROPROFILE_IMPL is defined: -// #define MICROPROFILE_GPU_TIMERS_D3D11 -// call MICROPROFILE_GPU_TIMERS_D3D11(). Pass Device & ImmediateContext -// -// Limitations: -// GPU timestamps can only be inserted from one thread. - - - -#ifndef MICROPROFILE_ENABLED -#define MICROPROFILE_ENABLED 1 -#endif - -#include -typedef uint64_t MicroProfileToken; -typedef uint16_t MicroProfileGroupId; - -#if 0 == MICROPROFILE_ENABLED - -#define MICROPROFILE_DECLARE(var) -#define MICROPROFILE_DEFINE(var, group, name, color) -#define MICROPROFILE_REGISTER_GROUP(group, color, category) -#define MICROPROFILE_DECLARE_GPU(var) -#define MICROPROFILE_DEFINE_GPU(var, name, color) -#define MICROPROFILE_SCOPE(var) do{}while(0) -#define MICROPROFILE_SCOPEI(group, name, color) do{}while(0) -#define MICROPROFILE_SCOPEGPU(var) do{}while(0) -#define MICROPROFILE_SCOPEGPUI( name, color) do{}while(0) -#define MICROPROFILE_META_CPU(name, count) -#define MICROPROFILE_META_GPU(name, count) -#define MICROPROFILE_FORCEENABLECPUGROUP(s) do{} while(0) -#define MICROPROFILE_FORCEDISABLECPUGROUP(s) do{} while(0) -#define MICROPROFILE_FORCEENABLEGPUGROUP(s) do{} while(0) -#define MICROPROFILE_FORCEDISABLEGPUGROUP(s) do{} while(0) -#define MICROPROFILE_SCOPE_TOKEN(token) - -#define MicroProfileGetTime(group, name) 0.f -#define MicroProfileOnThreadCreate(foo) do{}while(0) -#define MicroProfileFlip() do{}while(0) -#define MicroProfileSetAggregateFrames(a) do{}while(0) -#define MicroProfileGetAggregateFrames() 0 -#define MicroProfileGetCurrentAggregateFrames() 0 -#define MicroProfileTogglePause() do{}while(0) -#define MicroProfileToggleAllGroups() do{} while(0) -#define MicroProfileDumpTimers() do{}while(0) -#define MicroProfileShutdown() do{}while(0) -#define MicroProfileSetForceEnable(a) do{} while(0) -#define MicroProfileGetForceEnable() false -#define MicroProfileSetEnableAllGroups(a) do{} while(0) -#define MicroProfileEnableCategory(a) do{} while(0) -#define MicroProfileDisableCategory(a) do{} while(0) -#define MicroProfileGetEnableAllGroups() false -#define MicroProfileSetForceMetaCounters(a) -#define MicroProfileGetForceMetaCounters() 0 -#define MicroProfileEnableMetaCounter(c) do{}while(0) -#define MicroProfileDisableMetaCounter(c) do{}while(0) -#define MicroProfileDumpFile(html,csv) do{} while(0) -#define MicroProfileWebServerPort() ((uint32_t)-1) - -#else - -#include -#include -#include -#include -#include -#include -#include - -#ifndef MICROPROFILE_API -#define MICROPROFILE_API -#endif - -MICROPROFILE_API int64_t MicroProfileTicksPerSecondCpu(); - - -#if defined(__APPLE__) -#include -#include -#include -#include -#include -#if TARGET_OS_IPHONE -#define MICROPROFILE_IOS -#endif - -#define MP_TICK() mach_absolute_time() -inline int64_t MicroProfileTicksPerSecondCpu() -{ - static int64_t nTicksPerSecond = 0; - if(nTicksPerSecond == 0) - { - mach_timebase_info_data_t sTimebaseInfo; - mach_timebase_info(&sTimebaseInfo); - nTicksPerSecond = 1000000000ll * sTimebaseInfo.denom / sTimebaseInfo.numer; - } - return nTicksPerSecond; -} -inline uint64_t MicroProfileGetCurrentThreadId() -{ - uint64_t tid; - pthread_threadid_np(pthread_self(), &tid); - return tid; -} - -#define MP_BREAK() __builtin_trap() -#define MP_THREAD_LOCAL __thread -#define MP_STRCASECMP strcasecmp -#define MP_GETCURRENTTHREADID() MicroProfileGetCurrentThreadId() -typedef uint64_t ThreadIdType; -#elif defined(_WIN32) -int64_t MicroProfileGetTick(); -#define MP_TICK() MicroProfileGetTick() -#define MP_BREAK() __debugbreak() -#define MP_THREAD_LOCAL thread_local -#define MP_STRCASECMP _stricmp -#define MP_GETCURRENTTHREADID() GetCurrentThreadId() -typedef uint32_t ThreadIdType; - -#elif !defined(_WIN32) -#include -#include -inline int64_t MicroProfileTicksPerSecondCpu() -{ - return 1000000000ll; -} - -inline int64_t MicroProfileGetTick() -{ - timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - return 1000000000ll * ts.tv_sec + ts.tv_nsec; -} -#define MP_TICK() MicroProfileGetTick() -#define MP_BREAK() __builtin_trap() -#define MP_THREAD_LOCAL __thread -#define MP_STRCASECMP strcasecmp -#define MP_GETCURRENTTHREADID() (uint64_t)pthread_self() -typedef uint64_t ThreadIdType; -#endif - - -#ifndef MP_GETCURRENTTHREADID -#define MP_GETCURRENTTHREADID() 0 -typedef uint32_t ThreadIdType; -#endif - - -#define MP_ASSERT(a) do{if(!(a)){MP_BREAK();} }while(0) -#define MICROPROFILE_DECLARE(var) extern MicroProfileToken g_mp_##var -#define MICROPROFILE_DEFINE(var, group, name, color) MicroProfileToken g_mp_##var = MicroProfileGetToken(group, name, color, MicroProfileTokenTypeCpu) -#define MICROPROFILE_REGISTER_GROUP(group, category, color) MicroProfileRegisterGroup(group, category, color) -#define MICROPROFILE_DECLARE_GPU(var) extern MicroProfileToken g_mp_##var -#define MICROPROFILE_DEFINE_GPU(var, name, color) MicroProfileToken g_mp_##var = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu) -#define MICROPROFILE_TOKEN_PASTE0(a, b) a ## b -#define MICROPROFILE_TOKEN_PASTE(a, b) MICROPROFILE_TOKEN_PASTE0(a,b) -#define MICROPROFILE_TOKEN(var) g_mp_##var -#define MICROPROFILE_SCOPE(var) MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(g_mp_##var) -#define MICROPROFILE_SCOPE_TOKEN(token) MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(token) -#define MICROPROFILE_SCOPEI(group, name, color) static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp,__LINE__) = MicroProfileGetToken(group, name, color, MicroProfileTokenTypeCpu); MicroProfileScopeHandler MICROPROFILE_TOKEN_PASTE(foo,__LINE__)( MICROPROFILE_TOKEN_PASTE(g_mp,__LINE__)) -#define MICROPROFILE_SCOPEGPU(var) MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(foo, __LINE__)(g_mp_##var) -#define MICROPROFILE_SCOPEGPUI(name, color) static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp,__LINE__) = MicroProfileGetToken("GPU", name, color, MicroProfileTokenTypeGpu); MicroProfileScopeGpuHandler MICROPROFILE_TOKEN_PASTE(foo,__LINE__)( MICROPROFILE_TOKEN_PASTE(g_mp,__LINE__)) -#define MICROPROFILE_META_CPU(name, count) static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__) = MicroProfileGetMetaToken(name); MicroProfileMetaUpdate(MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__), count, MicroProfileTokenTypeCpu) -#define MICROPROFILE_META_GPU(name, count) static MicroProfileToken MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__) = MicroProfileGetMetaToken(name); MicroProfileMetaUpdate(MICROPROFILE_TOKEN_PASTE(g_mp_meta,__LINE__), count, MicroProfileTokenTypeGpu) - - -#ifndef MICROPROFILE_USE_THREAD_NAME_CALLBACK -#define MICROPROFILE_USE_THREAD_NAME_CALLBACK 0 -#endif - -#ifndef MICROPROFILE_PER_THREAD_BUFFER_SIZE -#define MICROPROFILE_PER_THREAD_BUFFER_SIZE (2048<<10) -#endif - -#ifndef MICROPROFILE_MAX_FRAME_HISTORY -#define MICROPROFILE_MAX_FRAME_HISTORY 512 -#endif - -#ifndef MICROPROFILE_PRINTF -#define MICROPROFILE_PRINTF printf -#endif - -#ifndef MICROPROFILE_META_MAX -#define MICROPROFILE_META_MAX 8 -#endif - -#ifndef MICROPROFILE_WEBSERVER_PORT -#define MICROPROFILE_WEBSERVER_PORT 1338 -#endif - -#ifndef MICROPROFILE_WEBSERVER -#define MICROPROFILE_WEBSERVER 1 -#endif - -#ifndef MICROPROFILE_WEBSERVER_MAXFRAMES -#define MICROPROFILE_WEBSERVER_MAXFRAMES 30 -#endif - -#ifndef MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE -#define MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE (16<<10) -#endif - -#ifndef MICROPROFILE_GPU_TIMERS -#define MICROPROFILE_GPU_TIMERS 1 -#endif - -#ifndef MICROPROFILE_GPU_FRAME_DELAY -#define MICROPROFILE_GPU_FRAME_DELAY 3 //must be > 0 -#endif - - -#ifndef MICROPROFILE_NAME_MAX_LEN -#define MICROPROFILE_NAME_MAX_LEN 64 -#endif - -#define MICROPROFILE_FORCEENABLECPUGROUP(s) MicroProfileForceEnableGroup(s, MicroProfileTokenTypeCpu) -#define MICROPROFILE_FORCEDISABLECPUGROUP(s) MicroProfileForceDisableGroup(s, MicroProfileTokenTypeCpu) -#define MICROPROFILE_FORCEENABLEGPUGROUP(s) MicroProfileForceEnableGroup(s, MicroProfileTokenTypeGpu) -#define MICROPROFILE_FORCEDISABLEGPUGROUP(s) MicroProfileForceDisableGroup(s, MicroProfileTokenTypeGpu) - -#define MICROPROFILE_INVALID_TICK ((uint64_t)-1) -#define MICROPROFILE_GROUP_MASK_ALL 0xffffffffffff - - -#define MICROPROFILE_INVALID_TOKEN (uint64_t)-1 - -enum MicroProfileTokenType -{ - MicroProfileTokenTypeCpu, - MicroProfileTokenTypeGpu, -}; - -enum MicroProfileBoxType -{ - MicroProfileBoxTypeBar, - MicroProfileBoxTypeFlat, -}; - - - -struct MicroProfile; - -MICROPROFILE_API void MicroProfileInit(); -MICROPROFILE_API void MicroProfileShutdown(); -MICROPROFILE_API MicroProfileToken MicroProfileFindToken(const char* sGroup, const char* sName); -MICROPROFILE_API MicroProfileToken MicroProfileGetToken(const char* sGroup, const char* sName, uint32_t nColor, MicroProfileTokenType Token = MicroProfileTokenTypeCpu); -MICROPROFILE_API MicroProfileToken MicroProfileGetMetaToken(const char* pName); -MICROPROFILE_API void MicroProfileMetaUpdate(MicroProfileToken, int nCount, MicroProfileTokenType eTokenType); -MICROPROFILE_API uint64_t MicroProfileEnter(MicroProfileToken nToken); -MICROPROFILE_API void MicroProfileLeave(MicroProfileToken nToken, uint64_t nTick); -MICROPROFILE_API uint64_t MicroProfileGpuEnter(MicroProfileToken nToken); -MICROPROFILE_API void MicroProfileGpuLeave(MicroProfileToken nToken, uint64_t nTick); -inline uint16_t MicroProfileGetTimerIndex(MicroProfileToken t){ return (t&0xffff); } -inline uint64_t MicroProfileGetGroupMask(MicroProfileToken t){ return ((t>>16)&MICROPROFILE_GROUP_MASK_ALL);} -inline MicroProfileToken MicroProfileMakeToken(uint64_t nGroupMask, uint16_t nTimer){ return (nGroupMask<<16) | nTimer;} - -MICROPROFILE_API void MicroProfileFlip(); //! call once per frame. -MICROPROFILE_API void MicroProfileTogglePause(); -MICROPROFILE_API void MicroProfileForceEnableGroup(const char* pGroup, MicroProfileTokenType Type); -MICROPROFILE_API void MicroProfileForceDisableGroup(const char* pGroup, MicroProfileTokenType Type); -MICROPROFILE_API float MicroProfileGetTime(const char* pGroup, const char* pName); -MICROPROFILE_API void MicroProfileContextSwitchSearch(uint32_t* pContextSwitchStart, uint32_t* pContextSwitchEnd, uint64_t nBaseTicksCpu, uint64_t nBaseTicksEndCpu); -MICROPROFILE_API void MicroProfileOnThreadCreate(const char* pThreadName); //should be called from newly created threads -MICROPROFILE_API void MicroProfileOnThreadExit(); //call on exit to reuse log -MICROPROFILE_API void MicroProfileInitThreadLog(); -MICROPROFILE_API void MicroProfileSetForceEnable(bool bForceEnable); -MICROPROFILE_API bool MicroProfileGetForceEnable(); -MICROPROFILE_API void MicroProfileSetEnableAllGroups(bool bEnable); -MICROPROFILE_API void MicroProfileEnableCategory(const char* pCategory); -MICROPROFILE_API void MicroProfileDisableCategory(const char* pCategory); -MICROPROFILE_API bool MicroProfileGetEnableAllGroups(); -MICROPROFILE_API void MicroProfileSetForceMetaCounters(bool bEnable); -MICROPROFILE_API bool MicroProfileGetForceMetaCounters(); -MICROPROFILE_API void MicroProfileEnableMetaCounter(const char* pMet); -MICROPROFILE_API void MicroProfileDisableMetaCounter(const char* pMet); -MICROPROFILE_API void MicroProfileSetAggregateFrames(int frames); -MICROPROFILE_API int MicroProfileGetAggregateFrames(); -MICROPROFILE_API int MicroProfileGetCurrentAggregateFrames(); -MICROPROFILE_API MicroProfile* MicroProfileGet(); -MICROPROFILE_API void MicroProfileGetRange(uint32_t nPut, uint32_t nGet, uint32_t nRange[2][2]); -MICROPROFILE_API std::recursive_mutex& MicroProfileGetMutex(); -MICROPROFILE_API void MicroProfileStartContextSwitchTrace(); -MICROPROFILE_API void MicroProfileStopContextSwitchTrace(); -MICROPROFILE_API bool MicroProfileIsLocalThread(uint32_t nThreadId); - - -#if MICROPROFILE_WEBSERVER -MICROPROFILE_API void MicroProfileDumpFile(const char* pHtml, const char* pCsv); -MICROPROFILE_API uint32_t MicroProfileWebServerPort(); -#else -#define MicroProfileDumpFile(c) do{} while(0) -#define MicroProfileWebServerPort() ((uint32_t)-1) -#endif - - - - -#if MICROPROFILE_GPU_TIMERS -MICROPROFILE_API uint32_t MicroProfileGpuInsertTimeStamp(); -MICROPROFILE_API uint64_t MicroProfileGpuGetTimeStamp(uint32_t nKey); -MICROPROFILE_API uint64_t MicroProfileTicksPerSecondGpu(); -MICROPROFILE_API int MicroProfileGetGpuTickReference(int64_t* pOutCPU, int64_t* pOutGpu); -#else -#define MicroProfileGpuInsertTimeStamp() 1 -#define MicroProfileGpuGetTimeStamp(a) 0 -#define MicroProfileTicksPerSecondGpu() 1 -#define MicroProfileGetGpuTickReference(a,b) 0 -#endif - -#if MICROPROFILE_GPU_TIMERS_D3D11 -#define MICROPROFILE_D3D_MAX_QUERIES (8<<10) -MICROPROFILE_API void MicroProfileGpuInitD3D11(void* pDevice, void* pDeviceContext); -#endif - -#if MICROPROFILE_GPU_TIMERS_GL -#define MICROPROFILE_GL_MAX_QUERIES (8<<10) -MICROPROFILE_API void MicroProfileGpuInitGL(); -#endif - - - -#if MICROPROFILE_USE_THREAD_NAME_CALLBACK -MICROPROFILE_API const char* MicroProfileGetThreadName(); -#else -#define MicroProfileGetThreadName() "" -#endif - -#if !defined(MICROPROFILE_THREAD_NAME_FROM_ID) -#define MICROPROFILE_THREAD_NAME_FROM_ID(a) "" -#endif - - -struct MicroProfileScopeHandler -{ - MicroProfileToken nToken; - uint64_t nTick; - MicroProfileScopeHandler(MicroProfileToken Token):nToken(Token) - { - nTick = MicroProfileEnter(nToken); - } - ~MicroProfileScopeHandler() - { - MicroProfileLeave(nToken, nTick); - } -}; - -struct MicroProfileScopeGpuHandler -{ - MicroProfileToken nToken; - uint64_t nTick; - MicroProfileScopeGpuHandler(MicroProfileToken Token):nToken(Token) - { - nTick = MicroProfileGpuEnter(nToken); - } - ~MicroProfileScopeGpuHandler() - { - MicroProfileGpuLeave(nToken, nTick); - } -}; - - - -#define MICROPROFILE_MAX_TIMERS 1024 -#define MICROPROFILE_MAX_GROUPS 48 //dont bump! no. of bits used it bitmask -#define MICROPROFILE_MAX_CATEGORIES 16 -#define MICROPROFILE_MAX_GRAPHS 5 -#define MICROPROFILE_GRAPH_HISTORY 128 -#define MICROPROFILE_BUFFER_SIZE ((MICROPROFILE_PER_THREAD_BUFFER_SIZE)/sizeof(MicroProfileLogEntry)) -#define MICROPROFILE_MAX_CONTEXT_SWITCH_THREADS 256 -#define MICROPROFILE_STACK_MAX 32 -//#define MICROPROFILE_MAX_PRESETS 5 -#define MICROPROFILE_ANIM_DELAY_PRC 0.5f -#define MICROPROFILE_GAP_TIME 50 //extra ms to fetch to close timers from earlier frames - - -#ifndef MICROPROFILE_MAX_THREADS -#define MICROPROFILE_MAX_THREADS 32 -#endif - -#ifndef MICROPROFILE_UNPACK_RED -#define MICROPROFILE_UNPACK_RED(c) ((c)>>16) -#endif - -#ifndef MICROPROFILE_UNPACK_GREEN -#define MICROPROFILE_UNPACK_GREEN(c) ((c)>>8) -#endif - -#ifndef MICROPROFILE_UNPACK_BLUE -#define MICROPROFILE_UNPACK_BLUE(c) ((c)) -#endif - -#ifndef MICROPROFILE_DEFAULT_PRESET -#define MICROPROFILE_DEFAULT_PRESET "Default" -#endif - - -#ifndef MICROPROFILE_CONTEXT_SWITCH_TRACE -#if defined(_WIN32) -#define MICROPROFILE_CONTEXT_SWITCH_TRACE 1 -#elif defined(__APPLE__) -#define MICROPROFILE_CONTEXT_SWITCH_TRACE 0 //disabled until dtrace script is working. -#else -#define MICROPROFILE_CONTEXT_SWITCH_TRACE 0 -#endif -#endif - -#if MICROPROFILE_CONTEXT_SWITCH_TRACE -#define MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE (128*1024) //2mb with 16 byte entry size -#else -#define MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE (1) -#endif - -#ifndef MICROPROFILE_MINIZ -#define MICROPROFILE_MINIZ 0 -#endif - -#ifdef _WIN32 -#include -typedef UINT_PTR MpSocket; -#else -typedef int MpSocket; -#endif - - -#ifndef _WIN32 -typedef pthread_t MicroProfileThread; -#elif defined(_MSC_VER) -typedef HANDLE MicroProfileThread; -#else -typedef std::thread* MicroProfileThread; -#endif - - - -enum MicroProfileDrawMask -{ - MP_DRAW_OFF = 0x0, - MP_DRAW_BARS = 0x1, - MP_DRAW_DETAILED = 0x2, - MP_DRAW_HIDDEN = 0x3, -}; - -enum MicroProfileDrawBarsMask -{ - MP_DRAW_TIMERS = 0x1, - MP_DRAW_AVERAGE = 0x2, - MP_DRAW_MAX = 0x4, - MP_DRAW_CALL_COUNT = 0x8, - MP_DRAW_TIMERS_EXCLUSIVE = 0x10, - MP_DRAW_AVERAGE_EXCLUSIVE = 0x20, - MP_DRAW_MAX_EXCLUSIVE = 0x40, - MP_DRAW_META_FIRST = 0x80, - MP_DRAW_ALL = 0xffffffff, - -}; - -typedef uint64_t MicroProfileLogEntry; - -struct MicroProfileTimer -{ - uint64_t nTicks; - uint32_t nCount; -}; - -struct MicroProfileCategory -{ - char pName[MICROPROFILE_NAME_MAX_LEN]; - uint64_t nGroupMask; -}; - -struct MicroProfileGroupInfo -{ - char pName[MICROPROFILE_NAME_MAX_LEN]; - uint32_t nNameLen; - uint32_t nGroupIndex; - uint32_t nNumTimers; - uint32_t nMaxTimerNameLen; - uint32_t nColor; - uint32_t nCategory; - MicroProfileTokenType Type; -}; - -struct MicroProfileTimerInfo -{ - MicroProfileToken nToken; - uint32_t nTimerIndex; - uint32_t nGroupIndex; - char pName[MICROPROFILE_NAME_MAX_LEN]; - uint32_t nNameLen; - uint32_t nColor; - bool bGraph; -}; - -struct MicroProfileGraphState -{ - int64_t nHistory[MICROPROFILE_GRAPH_HISTORY]; - MicroProfileToken nToken; - int32_t nKey; -}; - -struct MicroProfileContextSwitch -{ - ThreadIdType nThreadOut; - ThreadIdType nThreadIn; - int64_t nCpu : 8; - int64_t nTicks : 56; -}; - - -struct MicroProfileFrameState -{ - int64_t nFrameStartCpu; - int64_t nFrameStartGpu; - uint32_t nLogStart[MICROPROFILE_MAX_THREADS]; -}; - -struct MicroProfileThreadLog -{ - std::array Log{}; - - std::atomic nPut{0}; - std::atomic nGet{0}; - uint32_t nActive = 0; - uint32_t nGpu = 0; - ThreadIdType nThreadId{}; - - std::array nStack{}; - std::array nChildTickStack{}; - uint32_t nStackPos = 0; - - - std::array nGroupStackPos{}; - std::array nGroupTicks{}; - std::array nAggregateGroupTicks{}; - enum - { - THREAD_MAX_LEN = 64, - }; - char ThreadName[64]{}; - int nFreeListNext = 0; - - void Reset() { - Log.fill({}); - nPut = 0; - nGet = 0; - nActive = 0; - nGpu = 0; - nThreadId = {}; - nStack.fill(0); - nChildTickStack.fill(0); - nStackPos = 0; - nGroupStackPos.fill(0); - nGroupTicks.fill(0); - nAggregateGroupTicks.fill(0); - std::fill(std::begin(ThreadName), std::end(ThreadName), '\0'); - nFreeListNext = 0; - } -}; - -#if MICROPROFILE_GPU_TIMERS_D3D11 -struct MicroProfileD3D11Frame -{ - uint32_t m_nQueryStart; - uint32_t m_nQueryCount; - uint32_t m_nRateQueryStarted; - void* m_pRateQuery; -}; - -struct MicroProfileGpuTimerState -{ - uint32_t bInitialized; - void* m_pDevice; - void* m_pDeviceContext; - void* m_pQueries[MICROPROFILE_D3D_MAX_QUERIES]; - int64_t m_nQueryResults[MICROPROFILE_D3D_MAX_QUERIES]; - uint32_t m_nQueryPut; - uint32_t m_nQueryGet; - uint32_t m_nQueryFrame; - int64_t m_nQueryFrequency; - MicroProfileD3D11Frame m_QueryFrames[MICROPROFILE_GPU_FRAME_DELAY]; -}; -#elif MICROPROFILE_GPU_TIMERS_GL -struct MicroProfileGpuTimerState -{ - uint32_t GLTimers[MICROPROFILE_GL_MAX_QUERIES]; - uint32_t GLTimerPos; -}; -#else -struct MicroProfileGpuTimerState{}; -#endif - -struct MicroProfile -{ - uint32_t nTotalTimers; - uint32_t nGroupCount; - uint32_t nCategoryCount; - uint32_t nAggregateClear; - uint32_t nAggregateFlip; - uint32_t nAggregateFlipCount; - uint32_t nAggregateFrames; - - uint64_t nAggregateFlipTick; - - uint32_t nDisplay; - uint32_t nBars; - uint64_t nActiveGroup; - uint32_t nActiveBars; - - uint64_t nForceGroup; - uint32_t nForceEnable; - uint32_t nForceMetaCounters; - - uint64_t nForceGroupUI; - uint64_t nActiveGroupWanted; - uint32_t nAllGroupsWanted; - uint32_t nAllThreadsWanted; - - uint32_t nOverflow; - - uint64_t nGroupMask; - uint32_t nRunning; - uint32_t nToggleRunning; - uint32_t nMaxGroupSize; - uint32_t nDumpFileNextFrame; - uint32_t nAutoClearFrames; - char HtmlDumpPath[512]; - char CsvDumpPath[512]; - - int64_t nPauseTicks; - - float fReferenceTime; - float fRcpReferenceTime; - - MicroProfileCategory CategoryInfo[MICROPROFILE_MAX_CATEGORIES]; - MicroProfileGroupInfo GroupInfo[MICROPROFILE_MAX_GROUPS]; - MicroProfileTimerInfo TimerInfo[MICROPROFILE_MAX_TIMERS]; - uint8_t TimerToGroup[MICROPROFILE_MAX_TIMERS]; - - MicroProfileTimer AccumTimers[MICROPROFILE_MAX_TIMERS]; - uint64_t AccumMaxTimers[MICROPROFILE_MAX_TIMERS]; - uint64_t AccumTimersExclusive[MICROPROFILE_MAX_TIMERS]; - uint64_t AccumMaxTimersExclusive[MICROPROFILE_MAX_TIMERS]; - - MicroProfileTimer Frame[MICROPROFILE_MAX_TIMERS]; - uint64_t FrameExclusive[MICROPROFILE_MAX_TIMERS]; - - MicroProfileTimer Aggregate[MICROPROFILE_MAX_TIMERS]; - uint64_t AggregateMax[MICROPROFILE_MAX_TIMERS]; - uint64_t AggregateExclusive[MICROPROFILE_MAX_TIMERS]; - uint64_t AggregateMaxExclusive[MICROPROFILE_MAX_TIMERS]; - - - uint64_t FrameGroup[MICROPROFILE_MAX_GROUPS]; - uint64_t AccumGroup[MICROPROFILE_MAX_GROUPS]; - uint64_t AccumGroupMax[MICROPROFILE_MAX_GROUPS]; - - uint64_t AggregateGroup[MICROPROFILE_MAX_GROUPS]; - uint64_t AggregateGroupMax[MICROPROFILE_MAX_GROUPS]; - - - struct - { - uint64_t nCounters[MICROPROFILE_MAX_TIMERS]; - - uint64_t nAccum[MICROPROFILE_MAX_TIMERS]; - uint64_t nAccumMax[MICROPROFILE_MAX_TIMERS]; - - uint64_t nAggregate[MICROPROFILE_MAX_TIMERS]; - uint64_t nAggregateMax[MICROPROFILE_MAX_TIMERS]; - - uint64_t nSum; - uint64_t nSumAccum; - uint64_t nSumAccumMax; - uint64_t nSumAggregate; - uint64_t nSumAggregateMax; - - const char* pName; - } MetaCounters[MICROPROFILE_META_MAX]; - - MicroProfileGraphState Graph[MICROPROFILE_MAX_GRAPHS]; - uint32_t nGraphPut; - - uint32_t nThreadActive[MICROPROFILE_MAX_THREADS]; - MicroProfileThreadLog* Pool[MICROPROFILE_MAX_THREADS]; - uint32_t nNumLogs; - uint32_t nMemUsage; - int nFreeListHead; - - uint32_t nFrameCurrent; - uint32_t nFrameCurrentIndex; - uint32_t nFramePut; - uint64_t nFramePutIndex; - - MicroProfileFrameState Frames[MICROPROFILE_MAX_FRAME_HISTORY]; - - uint64_t nFlipTicks; - uint64_t nFlipAggregate; - uint64_t nFlipMax; - uint64_t nFlipAggregateDisplay; - uint64_t nFlipMaxDisplay; - - MicroProfileThread ContextSwitchThread; - bool bContextSwitchRunning; - bool bContextSwitchStop; - bool bContextSwitchAllThreads; - bool bContextSwitchNoBars; - uint32_t nContextSwitchUsage; - uint32_t nContextSwitchLastPut; - - int64_t nContextSwitchHoverTickIn; - int64_t nContextSwitchHoverTickOut; - uint32_t nContextSwitchHoverThread; - uint32_t nContextSwitchHoverThreadBefore; - uint32_t nContextSwitchHoverThreadAfter; - uint8_t nContextSwitchHoverCpu; - uint8_t nContextSwitchHoverCpuNext; - - uint32_t nContextSwitchPut; - MicroProfileContextSwitch ContextSwitch[MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE]; - - - MpSocket ListenerSocket; - uint32_t nWebServerPort; - - char WebServerBuffer[MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE]; - uint32_t WebServerPut; - - uint64_t nWebServerDataSent; - - MicroProfileGpuTimerState GPU; - - -}; - -#define MP_LOG_TICK_MASK 0x0000ffffffffffff -#define MP_LOG_INDEX_MASK 0x3fff000000000000 -#define MP_LOG_BEGIN_MASK 0xc000000000000000 -#define MP_LOG_GPU_EXTRA 0x3 -#define MP_LOG_META 0x2 -#define MP_LOG_ENTER 0x1 -#define MP_LOG_LEAVE 0x0 - - -inline int MicroProfileLogType(MicroProfileLogEntry Index) -{ - return (int)(((MP_LOG_BEGIN_MASK & Index)>>62) & 0x3ULL); -} - -inline uint64_t MicroProfileLogTimerIndex(MicroProfileLogEntry Index) -{ - return (0x3fff&(Index>>48)); -} - -inline MicroProfileLogEntry MicroProfileMakeLogIndex(uint64_t nBegin, MicroProfileToken nToken, int64_t nTick) -{ - MicroProfileLogEntry Entry = (nBegin<<62) | ((0x3fff&nToken)<<48) | (MP_LOG_TICK_MASK&nTick); - int t = MicroProfileLogType(Entry); - uint64_t nTimerIndex = MicroProfileLogTimerIndex(Entry); - MP_ASSERT((uint64_t)t == nBegin); - MP_ASSERT(nTimerIndex == (nToken&0x3fff)); - return Entry; - -} - -inline int64_t MicroProfileLogTickDifference(MicroProfileLogEntry Start, MicroProfileLogEntry End) -{ - uint64_t nStart = Start; - uint64_t nEnd = End; - int64_t nDifference = ((nEnd<<16) - (nStart<<16)); - return nDifference >> 16; -} - -inline int64_t MicroProfileLogGetTick(MicroProfileLogEntry e) -{ - return MP_LOG_TICK_MASK & e; -} - -inline int64_t MicroProfileLogSetTick(MicroProfileLogEntry e, int64_t nTick) -{ - return (MP_LOG_TICK_MASK & nTick) | (e & ~MP_LOG_TICK_MASK); -} - -template -T MicroProfileMin(T a, T b) -{ return a < b ? a : b; } - -template -T MicroProfileMax(T a, T b) -{ return a > b ? a : b; } - -inline int64_t MicroProfileMsToTick(float fMs, int64_t nTicksPerSecond) -{ - return (int64_t)(fMs*0.001f*(float)nTicksPerSecond); -} - -inline float MicroProfileTickToMsMultiplier(int64_t nTicksPerSecond) -{ - return 1000.f / (float)nTicksPerSecond; -} - -inline uint16_t MicroProfileGetGroupIndex(MicroProfileToken t) -{ - return (uint16_t)MicroProfileGet()->TimerToGroup[MicroProfileGetTimerIndex(t)]; -} - - - -#ifdef MICROPROFILE_IMPL - -#ifdef _WIN32 -#include -#define snprintf _snprintf - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4244) -#endif -int64_t MicroProfileTicksPerSecondCpu() -{ - static int64_t nTicksPerSecond = 0; - if(nTicksPerSecond == 0) - { - QueryPerformanceFrequency((LARGE_INTEGER*)&nTicksPerSecond); - } - return nTicksPerSecond; -} -int64_t MicroProfileGetTick() -{ - int64_t ticks; - QueryPerformanceCounter((LARGE_INTEGER*)&ticks); - return ticks; -} - -#endif - -#if defined(MICROPROFILE_WEBSERVER) || defined(MICROPROFILE_CONTEXT_SWITCH_TRACE) - - -typedef void* (*MicroProfileThreadFunc)(void*); - -#ifndef _WIN32 -typedef pthread_t MicroProfileThread; -inline void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) -{ - pthread_attr_t Attr; - int r = pthread_attr_init(&Attr); - MP_ASSERT(r == 0); - pthread_create(pThread, &Attr, Func, 0); -} -inline void MicroProfileThreadJoin(MicroProfileThread* pThread) -{ - int r = pthread_join(*pThread, 0); - MP_ASSERT(r == 0); -} -#elif defined(_MSC_VER) -typedef HANDLE MicroProfileThread; -DWORD _stdcall ThreadTrampoline(void* pFunc) -{ - MicroProfileThreadFunc F = (MicroProfileThreadFunc)pFunc; - - // The return value of F will always return a void*, however, this is for - // compatibility with pthreads. The underlying "address" of the pointer - // is always a 32-bit value, so this cast is safe to perform. - return static_cast(reinterpret_cast(F(0))); -} - -inline void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) -{ - *pThread = CreateThread(0, 0, ThreadTrampoline, Func, 0, 0); -} -inline void MicroProfileThreadJoin(MicroProfileThread* pThread) -{ - WaitForSingleObject(*pThread, INFINITE); - CloseHandle(*pThread); -} -#else -#include -typedef std::thread* MicroProfileThread; -inline void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) -{ - *pThread = new std::thread(Func, nullptr); -} -inline void MicroProfileThreadJoin(MicroProfileThread* pThread) -{ - (*pThread)->join(); - delete *pThread; -} -#endif -#endif - -#if MICROPROFILE_WEBSERVER - -#ifdef _WIN32 -#define MP_INVALID_SOCKET(f) (f == INVALID_SOCKET) -#endif - -#ifndef _WIN32 -#include -#include -#include -#define MP_INVALID_SOCKET(f) (f < 0) -#endif - - -void MicroProfileWebServerStart(); -void MicroProfileWebServerStop(); -bool MicroProfileWebServerUpdate(); -void MicroProfileDumpToFile(); - -#else - -#define MicroProfileWebServerStart() do{}while(0) -#define MicroProfileWebServerStop() do{}while(0) -#define MicroProfileWebServerUpdate() false -#define MicroProfileDumpToFile() do{} while(0) -#endif - - -#if MICROPROFILE_GPU_TIMERS_D3D11 -void MicroProfileGpuFlip(); -void MicroProfileGpuShutdown(); -#else -#define MicroProfileGpuFlip() do{}while(0) -#define MicroProfileGpuShutdown() do{}while(0) -#endif - - - -#include -#include -#include -#include - - -#ifndef MICROPROFILE_DEBUG -#define MICROPROFILE_DEBUG 0 -#endif - - -#define S g_MicroProfile - -MicroProfile g_MicroProfile; -MicroProfileThreadLog* g_MicroProfileGpuLog = 0; -#ifdef MICROPROFILE_IOS -// iOS doesn't support __thread -static pthread_key_t g_MicroProfileThreadLogKey; -static pthread_once_t g_MicroProfileThreadLogKeyOnce = PTHREAD_ONCE_INIT; -static void MicroProfileCreateThreadLogKey() -{ - pthread_key_create(&g_MicroProfileThreadLogKey, NULL); -} -#else -MP_THREAD_LOCAL MicroProfileThreadLog* g_MicroProfileThreadLog = 0; -#endif -static std::atomic g_bUseLock{false}; /// This is used because windows does not support using mutexes under dll init(which is where global initialization is handled) - - -MICROPROFILE_DEFINE(g_MicroProfileFlip, "MicroProfile", "MicroProfileFlip", 0x3355ee); -MICROPROFILE_DEFINE(g_MicroProfileThreadLoop, "MicroProfile", "ThreadLoop", 0x3355ee); -MICROPROFILE_DEFINE(g_MicroProfileClear, "MicroProfile", "Clear", 0x3355ee); -MICROPROFILE_DEFINE(g_MicroProfileAccumulate, "MicroProfile", "Accumulate", 0x3355ee); -MICROPROFILE_DEFINE(g_MicroProfileContextSwitchSearch,"MicroProfile", "ContextSwitchSearch", 0xDD7300); - -inline std::recursive_mutex& MicroProfileMutex() -{ - static std::recursive_mutex Mutex; - return Mutex; -} -std::recursive_mutex& MicroProfileGetMutex() -{ - return MicroProfileMutex(); -} - -MICROPROFILE_API MicroProfile* MicroProfileGet() -{ - return &g_MicroProfile; -} - - -MicroProfileThreadLog* MicroProfileCreateThreadLog(const char* pName); - - -void MicroProfileInit() -{ - std::recursive_mutex& mutex = MicroProfileMutex(); - bool bUseLock = g_bUseLock; - if(bUseLock) - mutex.lock(); - static bool bOnce = true; - if(bOnce) - { - S.nMemUsage += sizeof(S); - bOnce = false; - memset(&S, 0, sizeof(S)); - for(int i = 0; i < MICROPROFILE_MAX_GROUPS; ++i) - { - S.GroupInfo[i].pName[0] = '\0'; - } - for(int i = 0; i < MICROPROFILE_MAX_CATEGORIES; ++i) - { - S.CategoryInfo[i].pName[0] = '\0'; - S.CategoryInfo[i].nGroupMask = 0; - } - strcpy(&S.CategoryInfo[0].pName[0], "default"); - S.nCategoryCount = 1; - for(int i = 0; i < MICROPROFILE_MAX_TIMERS; ++i) - { - S.TimerInfo[i].pName[0] = '\0'; - } - S.nGroupCount = 0; - S.nAggregateFlipTick = MP_TICK(); - S.nActiveGroup = 0; - S.nActiveBars = 0; - S.nForceGroup = 0; - S.nAllGroupsWanted = 0; - S.nActiveGroupWanted = 0; - S.nAllThreadsWanted = 1; - S.nAggregateFlip = 0; - S.nTotalTimers = 0; - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - } - S.nRunning = 1; - S.fReferenceTime = 33.33f; - S.fRcpReferenceTime = 1.f / S.fReferenceTime; - S.nFreeListHead = -1; - int64_t nTick = MP_TICK(); - for(int i = 0; i < MICROPROFILE_MAX_FRAME_HISTORY; ++i) - { - S.Frames[i].nFrameStartCpu = nTick; - S.Frames[i].nFrameStartGpu = -1; - } - - MicroProfileThreadLog* pGpu = MicroProfileCreateThreadLog("GPU"); - g_MicroProfileGpuLog = pGpu; - MP_ASSERT(S.Pool[0] == pGpu); - pGpu->nGpu = 1; - pGpu->nThreadId = 0; - - S.nWebServerDataSent = (uint64_t)-1; - } - if(bUseLock) - mutex.unlock(); -} - -void MicroProfileShutdown() -{ - std::lock_guard Lock(MicroProfileMutex()); - MicroProfileWebServerStop(); - MicroProfileStopContextSwitchTrace(); - MicroProfileGpuShutdown(); - for (uint32_t i = 0; i < S.nNumLogs; ++i) { - delete S.Pool[i]; - } -} - -#ifdef MICROPROFILE_IOS -inline MicroProfileThreadLog* MicroProfileGetThreadLog() -{ - pthread_once(&g_MicroProfileThreadLogKeyOnce, MicroProfileCreateThreadLogKey); - return (MicroProfileThreadLog*)pthread_getspecific(g_MicroProfileThreadLogKey); -} - -inline void MicroProfileSetThreadLog(MicroProfileThreadLog* pLog) -{ - pthread_once(&g_MicroProfileThreadLogKeyOnce, MicroProfileCreateThreadLogKey); - pthread_setspecific(g_MicroProfileThreadLogKey, pLog); -} -#else -inline MicroProfileThreadLog* MicroProfileGetThreadLog() -{ - return g_MicroProfileThreadLog; -} -inline void MicroProfileSetThreadLog(MicroProfileThreadLog* pLog) -{ - g_MicroProfileThreadLog = pLog; -} -#endif - - -MicroProfileThreadLog* MicroProfileCreateThreadLog(const char* pName) -{ - MicroProfileThreadLog* pLog = 0; - if(S.nFreeListHead != -1) - { - pLog = S.Pool[S.nFreeListHead]; - MP_ASSERT(pLog->nPut.load() == 0); - MP_ASSERT(pLog->nGet.load() == 0); - S.nFreeListHead = S.Pool[S.nFreeListHead]->nFreeListNext; - pLog->Reset(); - } - else - { - pLog = new MicroProfileThreadLog; - S.nMemUsage += sizeof(MicroProfileThreadLog); - S.Pool[S.nNumLogs++] = pLog; - } - int len = (int)strlen(pName); - int maxlen = sizeof(pLog->ThreadName)-1; - len = len < maxlen ? len : maxlen; - memcpy(&pLog->ThreadName[0], pName, len); - pLog->ThreadName[len] = '\0'; - pLog->nThreadId = MP_GETCURRENTTHREADID(); - pLog->nFreeListNext = -1; - pLog->nActive = 1; - return pLog; -} - -void MicroProfileOnThreadCreate(const char* pThreadName) -{ - g_bUseLock = true; - MicroProfileInit(); - std::lock_guard Lock(MicroProfileMutex()); - MP_ASSERT(MicroProfileGetThreadLog() == 0); - MicroProfileThreadLog* pLog = MicroProfileCreateThreadLog(pThreadName ? pThreadName : MicroProfileGetThreadName()); - MP_ASSERT(pLog); - MicroProfileSetThreadLog(pLog); -} - -void MicroProfileOnThreadExit() -{ - std::lock_guard Lock(MicroProfileMutex()); - MicroProfileThreadLog* pLog = MicroProfileGetThreadLog(); - if(pLog) - { - int32_t nLogIndex = -1; - for(int i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - if(pLog == S.Pool[i]) - { - nLogIndex = i; - break; - } - } - MP_ASSERT(nLogIndex < MICROPROFILE_MAX_THREADS && nLogIndex > 0); - pLog->nFreeListNext = S.nFreeListHead; - pLog->nActive = 0; - pLog->nPut.store(0); - pLog->nGet.store(0); - S.nFreeListHead = nLogIndex; - for(int i = 0; i < MICROPROFILE_MAX_FRAME_HISTORY; ++i) - { - S.Frames[i].nLogStart[nLogIndex] = 0; - } - pLog->nGroupStackPos.fill(0); - pLog->nGroupTicks.fill(0); - } -} - -void MicroProfileInitThreadLog() -{ - MicroProfileOnThreadCreate(nullptr); -} - - -struct MicroProfileScopeLock -{ - bool bUseLock; - std::recursive_mutex& m; - MicroProfileScopeLock(std::recursive_mutex& m_) : bUseLock(g_bUseLock), m(m_) - { - if(bUseLock) - m.lock(); - } - ~MicroProfileScopeLock() - { - if(bUseLock) - m.unlock(); - } -}; - -MicroProfileToken MicroProfileFindToken(const char* pGroup, const char* pName) -{ - MicroProfileInit(); - MicroProfileScopeLock L(MicroProfileMutex()); - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - if(!MP_STRCASECMP(pName, S.TimerInfo[i].pName) && !MP_STRCASECMP(pGroup, S.GroupInfo[S.TimerToGroup[i]].pName)) - { - return S.TimerInfo[i].nToken; - } - } - return MICROPROFILE_INVALID_TOKEN; -} - -inline uint16_t MicroProfileGetGroup(const char* pGroup, MicroProfileTokenType Type) -{ - for(uint32_t i = 0; i < S.nGroupCount; ++i) - { - if(!MP_STRCASECMP(pGroup, S.GroupInfo[i].pName)) - { - return i; - } - } - uint16_t nGroupIndex = 0xffff; - uint32_t nLen = (uint32_t)strlen(pGroup); - if(nLen > MICROPROFILE_NAME_MAX_LEN-1) - nLen = MICROPROFILE_NAME_MAX_LEN-1; - memcpy(&S.GroupInfo[S.nGroupCount].pName[0], pGroup, nLen); - S.GroupInfo[S.nGroupCount].pName[nLen] = '\0'; - S.GroupInfo[S.nGroupCount].nNameLen = nLen; - S.GroupInfo[S.nGroupCount].nNumTimers = 0; - S.GroupInfo[S.nGroupCount].nGroupIndex = S.nGroupCount; - S.GroupInfo[S.nGroupCount].Type = Type; - S.GroupInfo[S.nGroupCount].nMaxTimerNameLen = 0; - S.GroupInfo[S.nGroupCount].nColor = 0x88888888; - S.GroupInfo[S.nGroupCount].nCategory = 0; - S.CategoryInfo[0].nGroupMask |= (1ll << (uint64_t)S.nGroupCount); - nGroupIndex = S.nGroupCount++; - S.nGroupMask = (S.nGroupMask<<1)|1; - MP_ASSERT(nGroupIndex < MICROPROFILE_MAX_GROUPS); - return nGroupIndex; -} - -inline void MicroProfileRegisterGroup(const char* pGroup, const char* pCategory, uint32_t nColor) -{ - int nCategoryIndex = -1; - for(uint32_t i = 0; i < S.nCategoryCount; ++i) - { - if(!MP_STRCASECMP(pCategory, S.CategoryInfo[i].pName)) - { - nCategoryIndex = (int)i; - break; - } - } - if(-1 == nCategoryIndex && S.nCategoryCount < MICROPROFILE_MAX_CATEGORIES) - { - MP_ASSERT(S.CategoryInfo[S.nCategoryCount].pName[0] == '\0'); - nCategoryIndex = (int)S.nCategoryCount++; - uint32_t nLen = (uint32_t)strlen(pCategory); - if(nLen > MICROPROFILE_NAME_MAX_LEN-1) - nLen = MICROPROFILE_NAME_MAX_LEN-1; - memcpy(&S.CategoryInfo[nCategoryIndex].pName[0], pCategory, nLen); - S.CategoryInfo[nCategoryIndex].pName[nLen] = '\0'; - } - uint16_t nGroup = MicroProfileGetGroup(pGroup, 0 != MP_STRCASECMP(pGroup, "gpu")?MicroProfileTokenTypeCpu : MicroProfileTokenTypeGpu); - S.GroupInfo[nGroup].nColor = nColor; - if(nCategoryIndex >= 0) - { - uint64_t nBit = 1ll << nGroup; - uint32_t nOldCategory = S.GroupInfo[nGroup].nCategory; - S.CategoryInfo[nOldCategory].nGroupMask &= ~nBit; - S.CategoryInfo[nCategoryIndex].nGroupMask |= nBit; - S.GroupInfo[nGroup].nCategory = nCategoryIndex; - } -} - -MicroProfileToken MicroProfileGetToken(const char* pGroup, const char* pName, uint32_t nColor, MicroProfileTokenType Type) -{ - MicroProfileInit(); - MicroProfileScopeLock L(MicroProfileMutex()); - MicroProfileToken ret = MicroProfileFindToken(pGroup, pName); - if(ret != MICROPROFILE_INVALID_TOKEN) - return ret; - uint16_t nGroupIndex = MicroProfileGetGroup(pGroup, Type); - uint16_t nTimerIndex = (uint16_t)(S.nTotalTimers++); - uint64_t nGroupMask = 1ll << nGroupIndex; - MicroProfileToken nToken = MicroProfileMakeToken(nGroupMask, nTimerIndex); - S.GroupInfo[nGroupIndex].nNumTimers++; - S.GroupInfo[nGroupIndex].nMaxTimerNameLen = MicroProfileMax(S.GroupInfo[nGroupIndex].nMaxTimerNameLen, (uint32_t)strlen(pName)); - MP_ASSERT(S.GroupInfo[nGroupIndex].Type == Type); //dont mix cpu & gpu timers in the same group - S.nMaxGroupSize = MicroProfileMax(S.nMaxGroupSize, S.GroupInfo[nGroupIndex].nNumTimers); - S.TimerInfo[nTimerIndex].nToken = nToken; - uint32_t nLen = (uint32_t)strlen(pName); - if(nLen > MICROPROFILE_NAME_MAX_LEN-1) - nLen = MICROPROFILE_NAME_MAX_LEN-1; - memcpy(&S.TimerInfo[nTimerIndex].pName, pName, nLen); - S.TimerInfo[nTimerIndex].pName[nLen] = '\0'; - S.TimerInfo[nTimerIndex].nNameLen = nLen; - S.TimerInfo[nTimerIndex].nColor = nColor&0xffffff; - S.TimerInfo[nTimerIndex].nGroupIndex = nGroupIndex; - S.TimerInfo[nTimerIndex].nTimerIndex = nTimerIndex; - S.TimerToGroup[nTimerIndex] = nGroupIndex; - return nToken; -} - -MicroProfileToken MicroProfileGetMetaToken(const char* pName) -{ - MicroProfileInit(); - MicroProfileScopeLock L(MicroProfileMutex()); - for(uint32_t i = 0; i < MICROPROFILE_META_MAX; ++i) - { - if(!S.MetaCounters[i].pName) - { - S.MetaCounters[i].pName = pName; - return i; - } - else if(!MP_STRCASECMP(pName, S.MetaCounters[i].pName)) - { - return i; - } - } - MP_ASSERT(0);//out of slots, increase MICROPROFILE_META_MAX - return (MicroProfileToken)-1; -} - - -inline void MicroProfileLogPut(MicroProfileToken nToken_, uint64_t nTick, uint64_t nBegin, MicroProfileThreadLog* pLog) -{ - MP_ASSERT(pLog != 0); //this assert is hit if MicroProfileOnCreateThread is not called - MP_ASSERT(pLog->nActive); - uint32_t nPos = pLog->nPut.load(std::memory_order_relaxed); - uint32_t nNextPos = (nPos+1) % MICROPROFILE_BUFFER_SIZE; - if(nNextPos == pLog->nGet.load(std::memory_order_relaxed)) - { - S.nOverflow = 100; - } - else - { - pLog->Log[nPos] = MicroProfileMakeLogIndex(nBegin, nToken_, nTick); - pLog->nPut.store(nNextPos, std::memory_order_release); - } -} - -uint64_t MicroProfileEnter(MicroProfileToken nToken_) -{ - if(MicroProfileGetGroupMask(nToken_) & S.nActiveGroup) - { - if(!MicroProfileGetThreadLog()) - { - MicroProfileInitThreadLog(); - } - uint64_t nTick = MP_TICK(); - MicroProfileLogPut(nToken_, nTick, MP_LOG_ENTER, MicroProfileGetThreadLog()); - return nTick; - } - return MICROPROFILE_INVALID_TICK; -} - -void MicroProfileMetaUpdate(MicroProfileToken nToken, int nCount, MicroProfileTokenType eTokenType) -{ - if((MP_DRAW_META_FIRST<nTicks <= S.nPauseTicks) - { - uint32_t nPut = S.nContextSwitchPut; - S.ContextSwitch[nPut] = *pContextSwitch; - S.nContextSwitchPut = (S.nContextSwitchPut+1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE; - } -} - - -void MicroProfileGetRange(uint32_t nPut, uint32_t nGet, uint32_t nRange[2][2]) -{ - if(nPut > nGet) - { - nRange[0][0] = nGet; - nRange[0][1] = nPut; - nRange[1][0] = nRange[1][1] = 0; - } - else if(nPut != nGet) - { - MP_ASSERT(nGet != MICROPROFILE_BUFFER_SIZE); - uint32_t nCountEnd = MICROPROFILE_BUFFER_SIZE - nGet; - nRange[0][0] = nGet; - nRange[0][1] = nGet + nCountEnd; - nRange[1][0] = 0; - nRange[1][1] = nPut; - } -} - -void MicroProfileFlip() -{ - #if 0 - //verify LogEntry wraps correctly - MicroProfileLogEntry c = MP_LOG_TICK_MASK-5000; - for(int i = 0; i < 10000; ++i, c += 1) - { - MicroProfileLogEntry l2 = (c+2500) & MP_LOG_TICK_MASK; - MP_ASSERT(2500 == MicroProfileLogTickDifference(c, l2)); - } - #endif - MICROPROFILE_SCOPE(g_MicroProfileFlip); - std::lock_guard Lock(MicroProfileMutex()); - - - MicroProfileGpuFlip(); - - if(S.nToggleRunning) - { - S.nRunning = !S.nRunning; - if(!S.nRunning) - S.nPauseTicks = MP_TICK(); - S.nToggleRunning = 0; - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - MicroProfileThreadLog* pLog = S.Pool[i]; - if(pLog) - { - pLog->nStackPos = 0; - } - } - } - uint32_t nAggregateClear = S.nAggregateClear || S.nAutoClearFrames, nAggregateFlip = 0; - if(S.nDumpFileNextFrame) - { - MicroProfileDumpToFile(); - S.nDumpFileNextFrame = 0; - S.nAutoClearFrames = MICROPROFILE_GPU_FRAME_DELAY + 3; //hide spike from dumping webpage - } - if(S.nWebServerDataSent == (uint64_t)-1) - { - MicroProfileWebServerStart(); - S.nWebServerDataSent = 0; - } - - if(MicroProfileWebServerUpdate()) - { - S.nAutoClearFrames = MICROPROFILE_GPU_FRAME_DELAY + 3; //hide spike from dumping webpage - } - - if(S.nAutoClearFrames) - { - nAggregateClear = 1; - nAggregateFlip = 1; - S.nAutoClearFrames -= 1; - } - - - if(S.nRunning || S.nForceEnable) - { - S.nFramePutIndex++; - S.nFramePut = (S.nFramePut+1) % MICROPROFILE_MAX_FRAME_HISTORY; - MP_ASSERT((S.nFramePutIndex % MICROPROFILE_MAX_FRAME_HISTORY) == S.nFramePut); - S.nFrameCurrent = (S.nFramePut + MICROPROFILE_MAX_FRAME_HISTORY - MICROPROFILE_GPU_FRAME_DELAY - 1) % MICROPROFILE_MAX_FRAME_HISTORY; - S.nFrameCurrentIndex++; - uint32_t nFrameNext = (S.nFrameCurrent+1) % MICROPROFILE_MAX_FRAME_HISTORY; - - uint32_t nContextSwitchPut = S.nContextSwitchPut; - if(S.nContextSwitchLastPut < nContextSwitchPut) - { - S.nContextSwitchUsage = (nContextSwitchPut - S.nContextSwitchLastPut); - } - else - { - S.nContextSwitchUsage = MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE - S.nContextSwitchLastPut + nContextSwitchPut; - } - S.nContextSwitchLastPut = nContextSwitchPut; - - MicroProfileFrameState* pFramePut = &S.Frames[S.nFramePut]; - MicroProfileFrameState* pFrameCurrent = &S.Frames[S.nFrameCurrent]; - MicroProfileFrameState* pFrameNext = &S.Frames[nFrameNext]; - - pFramePut->nFrameStartCpu = MP_TICK(); - pFramePut->nFrameStartGpu = (uint32_t)MicroProfileGpuInsertTimeStamp(); - if(pFrameNext->nFrameStartGpu != -1) - pFrameNext->nFrameStartGpu = MicroProfileGpuGetTimeStamp((uint32_t)pFrameNext->nFrameStartGpu); - - if(pFrameCurrent->nFrameStartGpu == -1) - pFrameCurrent->nFrameStartGpu = pFrameNext->nFrameStartGpu + 1; - - uint64_t nFrameStartCpu = pFrameCurrent->nFrameStartCpu; - uint64_t nFrameEndCpu = pFrameNext->nFrameStartCpu; - - { - uint64_t nTick = nFrameEndCpu - nFrameStartCpu; - S.nFlipTicks = nTick; - S.nFlipAggregate += nTick; - S.nFlipMax = MicroProfileMax(S.nFlipMax, nTick); - } - - uint8_t* pTimerToGroup = &S.TimerToGroup[0]; - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - MicroProfileThreadLog* pLog = S.Pool[i]; - if(!pLog) - { - pFramePut->nLogStart[i] = 0; - } - else - { - uint32_t nPut = pLog->nPut.load(std::memory_order_acquire); - pFramePut->nLogStart[i] = nPut; - MP_ASSERT(nPut< MICROPROFILE_BUFFER_SIZE); - //need to keep last frame around to close timers. timers more than 1 frame old is ditched. - pLog->nGet.store(nPut, std::memory_order_relaxed); - } - } - - if(S.nRunning) - { - uint64_t* pFrameGroup = &S.FrameGroup[0]; - { - MICROPROFILE_SCOPE(g_MicroProfileClear); - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - S.Frame[i].nTicks = 0; - S.Frame[i].nCount = 0; - S.FrameExclusive[i] = 0; - } - for(uint32_t i = 0; i < MICROPROFILE_MAX_GROUPS; ++i) - { - pFrameGroup[i] = 0; - } - for(uint32_t j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName && 0 != (S.nActiveBars & (MP_DRAW_META_FIRST<nGroupStackPos[0]; - int64_t nGroupTicks[MICROPROFILE_MAX_GROUPS] = {0}; - - - uint32_t nPut = pFrameNext->nLogStart[i]; - uint32_t nGet = pFrameCurrent->nLogStart[i]; - uint32_t nRange[2][2] = { {0, 0}, {0, 0}, }; - MicroProfileGetRange(nPut, nGet, nRange); - - - //fetch gpu results. - if(pLog->nGpu) - { - for(uint32_t j = 0; j < 2; ++j) - { - uint32_t nStart = nRange[j][0]; - uint32_t nEnd = nRange[j][1]; - for(uint32_t k = nStart; k < nEnd; ++k) - { - MicroProfileLogEntry L = pLog->Log[k]; - if(MicroProfileLogType(L) < MP_LOG_META) - { - pLog->Log[k] = MicroProfileLogSetTick(L, MicroProfileGpuGetTimeStamp((uint32_t)MicroProfileLogGetTick(L))); - } - } - } - } - - - uint32_t* pStack = &pLog->nStack[0]; - int64_t* pChildTickStack = &pLog->nChildTickStack[0]; - uint32_t nStackPos = pLog->nStackPos; - - for(uint32_t j = 0; j < 2; ++j) - { - uint32_t nStart = nRange[j][0]; - uint32_t nEnd = nRange[j][1]; - for(uint32_t k = nStart; k < nEnd; ++k) - { - MicroProfileLogEntry LE = pLog->Log[k]; - int nType = MicroProfileLogType(LE); - - if(MP_LOG_ENTER == nType) - { - int nTimer = MicroProfileLogTimerIndex(LE); - uint8_t nGroup = pTimerToGroup[nTimer]; - - // To avoid crashing due to OOB memory accesses/asserts - // simply skip this iteration - // MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); - if (nStackPos >= MICROPROFILE_STACK_MAX) { - break; - } - MP_ASSERT(nGroup < MICROPROFILE_MAX_GROUPS); - pGroupStackPos[nGroup]++; - pStack[nStackPos++] = k; - pChildTickStack[nStackPos] = 0; - - } - else if(MP_LOG_META == nType) - { - if(nStackPos) - { - int64_t nMetaIndex = MicroProfileLogTimerIndex(LE); - int64_t nMetaCount = MicroProfileLogGetTick(LE); - MP_ASSERT(nMetaIndex < MICROPROFILE_META_MAX); - int64_t nCounter = MicroProfileLogTimerIndex(pLog->Log[pStack[nStackPos-1]]); - S.MetaCounters[nMetaIndex].nCounters[nCounter] += nMetaCount; - } - } - else if(MP_LOG_LEAVE == nType) - { - int nTimer = MicroProfileLogTimerIndex(LE); - uint8_t nGroup = pTimerToGroup[nTimer]; - MP_ASSERT(nGroup < MICROPROFILE_MAX_GROUPS); - if(nStackPos) - { - int64_t nTickStart = pLog->Log[pStack[nStackPos-1]]; - int64_t nTicks = MicroProfileLogTickDifference(nTickStart, LE); - int64_t nChildTicks = pChildTickStack[nStackPos]; - nStackPos--; - pChildTickStack[nStackPos] += nTicks; - - uint32_t nTimerIndex = MicroProfileLogTimerIndex(LE); - S.Frame[nTimerIndex].nTicks += nTicks; - S.FrameExclusive[nTimerIndex] += (nTicks-nChildTicks); - S.Frame[nTimerIndex].nCount += 1; - - MP_ASSERT(nGroup < MICROPROFILE_MAX_GROUPS); - uint8_t nGroupStackPos = pGroupStackPos[nGroup]; - if(nGroupStackPos) - { - nGroupStackPos--; - if(0 == nGroupStackPos) - { - nGroupTicks[nGroup] += nTicks; - } - pGroupStackPos[nGroup] = nGroupStackPos; - } - } - } - } - } - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - pLog->nGroupTicks[j] += nGroupTicks[j]; - pFrameGroup[j] += nGroupTicks[j]; - } - pLog->nStackPos = nStackPos; - } - } - { - MICROPROFILE_SCOPE(g_MicroProfileAccumulate); - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - S.AccumTimers[i].nTicks += S.Frame[i].nTicks; - S.AccumTimers[i].nCount += S.Frame[i].nCount; - S.AccumMaxTimers[i] = MicroProfileMax(S.AccumMaxTimers[i], S.Frame[i].nTicks); - S.AccumTimersExclusive[i] += S.FrameExclusive[i]; - S.AccumMaxTimersExclusive[i] = MicroProfileMax(S.AccumMaxTimersExclusive[i], S.FrameExclusive[i]); - } - - for(uint32_t i = 0; i < MICROPROFILE_MAX_GROUPS; ++i) - { - S.AccumGroup[i] += pFrameGroup[i]; - S.AccumGroupMax[i] = MicroProfileMax(S.AccumGroupMax[i], pFrameGroup[i]); - } - - for(uint32_t j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName && 0 != (S.nActiveBars & (MP_DRAW_META_FIRST<nAggregateGroupTicks[0], &pLog->nGroupTicks[0], sizeof(pLog->nAggregateGroupTicks)); - - if(nAggregateClear) - { - memset(&pLog->nGroupTicks[0], 0, sizeof(pLog->nGroupTicks)); - } - } - - for(uint32_t j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName && 0 != (S.nActiveBars & (MP_DRAW_META_FIRST<= 0) - { - if(bEnabled) - { - S.nActiveGroupWanted |= S.CategoryInfo[nCategoryIndex].nGroupMask; - } - else - { - S.nActiveGroupWanted &= ~S.CategoryInfo[nCategoryIndex].nGroupMask; - } - } -} - - -void MicroProfileEnableCategory(const char* pCategory) -{ - MicroProfileEnableCategory(pCategory, true); -} -void MicroProfileDisableCategory(const char* pCategory) -{ - MicroProfileEnableCategory(pCategory, false); -} - -bool MicroProfileGetEnableAllGroups() -{ - return 0 != S.nAllGroupsWanted; -} - -void MicroProfileSetForceMetaCounters(bool bForce) -{ - S.nForceMetaCounters = bForce ? 1 : 0; -} - -bool MicroProfileGetForceMetaCounters() -{ - return 0 != S.nForceMetaCounters; -} - -void MicroProfileEnableMetaCounter(const char* pMeta) -{ - for(uint32_t i = 0; i < MICROPROFILE_META_MAX; ++i) - { - if(S.MetaCounters[i].pName && 0 == MP_STRCASECMP(S.MetaCounters[i].pName, pMeta)) - { - S.nBars |= (MP_DRAW_META_FIRST< Lock(MicroProfileMutex()); - uint16_t nGroup = MicroProfileGetGroup(pGroup, Type); - S.nForceGroup |= (1ll << nGroup); -} - -void MicroProfileForceDisableGroup(const char* pGroup, MicroProfileTokenType Type) -{ - MicroProfileInit(); - std::lock_guard Lock(MicroProfileMutex()); - uint16_t nGroup = MicroProfileGetGroup(pGroup, Type); - S.nForceGroup &= ~(1ll << nGroup); -} - - -inline void MicroProfileCalcAllTimers(float* pTimers, float* pAverage, float* pMax, float* pCallAverage, float* pExclusive, float* pAverageExclusive, float* pMaxExclusive, float* pTotal, uint32_t nSize) -{ - for(uint32_t i = 0; i < S.nTotalTimers && i < nSize; ++i) - { - const uint32_t nGroupId = S.TimerInfo[i].nGroupIndex; - const float fToMs = MicroProfileTickToMsMultiplier(S.GroupInfo[nGroupId].Type == MicroProfileTokenTypeGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - uint32_t nTimer = i; - uint32_t nIdx = i * 2; - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - uint32_t nAggregateCount = S.Aggregate[nTimer].nCount ? S.Aggregate[nTimer].nCount : 1; - float fToPrc = S.fRcpReferenceTime; - float fMs = fToMs * (S.Frame[nTimer].nTicks); - float fPrc = MicroProfileMin(fMs * fToPrc, 1.f); - float fAverageMs = fToMs * (S.Aggregate[nTimer].nTicks / nAggregateFrames); - float fAveragePrc = MicroProfileMin(fAverageMs * fToPrc, 1.f); - float fMaxMs = fToMs * (S.AggregateMax[nTimer]); - float fMaxPrc = MicroProfileMin(fMaxMs * fToPrc, 1.f); - float fCallAverageMs = fToMs * (S.Aggregate[nTimer].nTicks / nAggregateCount); - float fCallAveragePrc = MicroProfileMin(fCallAverageMs * fToPrc, 1.f); - float fMsExclusive = fToMs * (S.FrameExclusive[nTimer]); - float fPrcExclusive = MicroProfileMin(fMsExclusive * fToPrc, 1.f); - float fAverageMsExclusive = fToMs * (S.AggregateExclusive[nTimer] / nAggregateFrames); - float fAveragePrcExclusive = MicroProfileMin(fAverageMsExclusive * fToPrc, 1.f); - float fMaxMsExclusive = fToMs * (S.AggregateMaxExclusive[nTimer]); - float fMaxPrcExclusive = MicroProfileMin(fMaxMsExclusive * fToPrc, 1.f); - float fTotalMs = fToMs * S.Aggregate[nTimer].nTicks; - pTimers[nIdx] = fMs; - pTimers[nIdx+1] = fPrc; - pAverage[nIdx] = fAverageMs; - pAverage[nIdx+1] = fAveragePrc; - pMax[nIdx] = fMaxMs; - pMax[nIdx+1] = fMaxPrc; - pCallAverage[nIdx] = fCallAverageMs; - pCallAverage[nIdx+1] = fCallAveragePrc; - pExclusive[nIdx] = fMsExclusive; - pExclusive[nIdx+1] = fPrcExclusive; - pAverageExclusive[nIdx] = fAverageMsExclusive; - pAverageExclusive[nIdx+1] = fAveragePrcExclusive; - pMaxExclusive[nIdx] = fMaxMsExclusive; - pMaxExclusive[nIdx+1] = fMaxPrcExclusive; - pTotal[nIdx] = fTotalMs; - pTotal[nIdx+1] = 0.f; - } -} - -void MicroProfileTogglePause() -{ - S.nToggleRunning = 1; -} - -float MicroProfileGetTime(const char* pGroup, const char* pName) -{ - MicroProfileToken nToken = MicroProfileFindToken(pGroup, pName); - if(nToken == MICROPROFILE_INVALID_TOKEN) - { - return 0.f; - } - uint32_t nTimerIndex = MicroProfileGetTimerIndex(nToken); - uint32_t nGroupIndex = MicroProfileGetGroupIndex(nToken); - float fToMs = MicroProfileTickToMsMultiplier(S.GroupInfo[nGroupIndex].Type == MicroProfileTokenTypeGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - return S.Frame[nTimerIndex].nTicks * fToMs; -} - - -void MicroProfileContextSwitchSearch(uint32_t* pContextSwitchStart, uint32_t* pContextSwitchEnd, uint64_t nBaseTicksCpu, uint64_t nBaseTicksEndCpu) -{ - MICROPROFILE_SCOPE(g_MicroProfileContextSwitchSearch); - uint32_t nContextSwitchPut = S.nContextSwitchPut; - uint64_t nContextSwitchStart, nContextSwitchEnd; - nContextSwitchStart = nContextSwitchEnd = (nContextSwitchPut + MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE - 1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE; - int64_t nSearchEnd = nBaseTicksEndCpu + MicroProfileMsToTick(30.f, MicroProfileTicksPerSecondCpu()); - int64_t nSearchBegin = nBaseTicksCpu - MicroProfileMsToTick(30.f, MicroProfileTicksPerSecondCpu()); - for(uint32_t i = 0; i < MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE; ++i) - { - uint32_t nIndex = (nContextSwitchPut + MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE - (i+1)) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE; - MicroProfileContextSwitch& CS = S.ContextSwitch[nIndex]; - if(CS.nTicks > nSearchEnd) - { - nContextSwitchEnd = nIndex; - } - if(CS.nTicks > nSearchBegin) - { - nContextSwitchStart = nIndex; - } - } - *pContextSwitchStart = nContextSwitchStart; - *pContextSwitchEnd = nContextSwitchEnd; -} - - - -#if MICROPROFILE_WEBSERVER - -#define MICROPROFILE_EMBED_HTML - -extern const char* g_MicroProfileHtml_begin[]; -extern size_t g_MicroProfileHtml_begin_sizes[]; -extern size_t g_MicroProfileHtml_begin_count; -extern const char* g_MicroProfileHtml_end[]; -extern size_t g_MicroProfileHtml_end_sizes[]; -extern size_t g_MicroProfileHtml_end_count; - -typedef void MicroProfileWriteCallback(void* Handle, size_t size, const char* pData); - -uint32_t MicroProfileWebServerPort() -{ - return S.nWebServerPort; -} - -void MicroProfileDumpFile(const char* pHtml, const char* pCsv) -{ - S.nDumpFileNextFrame = 0; - if(pHtml) - { - uint32_t nLen = strlen(pHtml); - if(nLen > sizeof(S.HtmlDumpPath)-1) - { - return; - } - memcpy(S.HtmlDumpPath, pHtml, nLen+1); - S.nDumpFileNextFrame |= 1; - } - if(pCsv) - { - uint32_t nLen = strlen(pCsv); - if(nLen > sizeof(S.CsvDumpPath)-1) - { - return; - } - memcpy(S.CsvDumpPath, pCsv, nLen+1); - S.nDumpFileNextFrame |= 2; - } -} - -void MicroProfilePrintf(MicroProfileWriteCallback CB, void* Handle, const char* pFmt, ...) -{ - char buffer[32*1024]; - va_list args; - va_start (args, pFmt); -#ifdef _WIN32 - size_t size = vsprintf_s(buffer, pFmt, args); -#else - size_t size = vsnprintf(buffer, sizeof(buffer)-1, pFmt, args); -#endif - CB(Handle, size, &buffer[0]); - va_end (args); -} - -#define printf(...) MicroProfilePrintf(CB, Handle, __VA_ARGS__) -void MicroProfileDumpCsv(MicroProfileWriteCallback CB, void* Handle, int nMaxFrames) -{ - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - float fToMsCPU = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - float fToMsGPU = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondGpu()); - - printf("frames,%d\n", nAggregateFrames); - printf("group,name,average,max,callaverage\n"); - - uint32_t nNumTimers = S.nTotalTimers; - uint32_t nBlockSize = 2 * nNumTimers; - float* pTimers = (float*)alloca(nBlockSize * 8 * sizeof(float)); - float* pAverage = pTimers + nBlockSize; - float* pMax = pTimers + 2 * nBlockSize; - float* pCallAverage = pTimers + 3 * nBlockSize; - float* pTimersExclusive = pTimers + 4 * nBlockSize; - float* pAverageExclusive = pTimers + 5 * nBlockSize; - float* pMaxExclusive = pTimers + 6 * nBlockSize; - float* pTotal = pTimers + 7 * nBlockSize; - - MicroProfileCalcAllTimers(pTimers, pAverage, pMax, pCallAverage, pTimersExclusive, pAverageExclusive, pMaxExclusive, pTotal, nNumTimers); - - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - uint32_t nIdx = i * 2; - printf("\"%s\",\"%s\",%f,%f,%f\n", S.TimerInfo[i].pName, S.GroupInfo[S.TimerInfo[i].nGroupIndex].pName, pAverage[nIdx], pMax[nIdx], pCallAverage[nIdx]); - } - - printf("\n\n"); - - printf("group,average,max,total\n"); - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - const char* pGroupName = S.GroupInfo[j].pName; - float fToMs = S.GroupInfo[j].Type == MicroProfileTokenTypeGpu ? fToMsGPU : fToMsCPU; - if(pGroupName[0] != '\0') - { - printf("\"%s\",%.3f,%.3f,%.3f\n", pGroupName, fToMs * S.AggregateGroup[j] / nAggregateFrames, fToMs * S.AggregateGroup[j] / nAggregateFrames, fToMs * S.AggregateGroup[j]); - } - } - - printf("\n\n"); - printf("group,thread,average,total\n"); - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - const char* pThreadName = &S.Pool[i]->ThreadName[0]; - // MicroProfilePrintf(CB, Handle, "var ThreadGroupTime%d = [", i); - float fToMs = S.Pool[i]->nGpu ? fToMsGPU : fToMsCPU; - { - uint64_t nTicks = S.Pool[i]->nAggregateGroupTicks[j]; - float fTime = nTicks / nAggregateFrames * fToMs; - float fTimeTotal = nTicks * fToMs; - if(fTimeTotal > 0.01f) - { - const char* pGroupName = S.GroupInfo[j].pName; - printf("\"%s\",\"%s\",%.3f,%.3f\n", pGroupName, pThreadName, fTime, fTimeTotal); - } - } - } - } - } - - printf("\n\n"); - printf("frametimecpu\n"); - - const uint32_t nCount = MICROPROFILE_MAX_FRAME_HISTORY - MICROPROFILE_GPU_FRAME_DELAY - 3; - const uint32_t nStart = S.nFrameCurrent; - for(uint32_t i = nCount; i > 0; i--) - { - uint32_t nFrame = (nStart + MICROPROFILE_MAX_FRAME_HISTORY - i) % MICROPROFILE_MAX_FRAME_HISTORY; - uint32_t nFrameNext = (nStart + MICROPROFILE_MAX_FRAME_HISTORY - i + 1) % MICROPROFILE_MAX_FRAME_HISTORY; - uint64_t nTicks = S.Frames[nFrameNext].nFrameStartCpu - S.Frames[nFrame].nFrameStartCpu; - printf("%f,", nTicks * fToMsCPU); - } - printf("\n"); - - printf("\n\n"); - printf("frametimegpu\n"); - - for(uint32_t i = nCount; i > 0; i--) - { - uint32_t nFrame = (nStart + MICROPROFILE_MAX_FRAME_HISTORY - i) % MICROPROFILE_MAX_FRAME_HISTORY; - uint32_t nFrameNext = (nStart + MICROPROFILE_MAX_FRAME_HISTORY - i + 1) % MICROPROFILE_MAX_FRAME_HISTORY; - uint64_t nTicks = S.Frames[nFrameNext].nFrameStartGpu - S.Frames[nFrame].nFrameStartGpu; - printf("%f,", nTicks * fToMsGPU); - } - printf("\n\n"); - printf("Meta\n");//only single frame snapshot - printf("name,average,max,total\n"); - for(int j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName) - { - printf("\"%s\",%f,%lld,%lld\n",S.MetaCounters[j].pName, S.MetaCounters[j].nSumAggregate / (float)nAggregateFrames, S.MetaCounters[j].nSumAggregateMax,S.MetaCounters[j].nSumAggregate); - } - } -} -#undef printf - -void MicroProfileDumpHtml(MicroProfileWriteCallback CB, void* Handle, int nMaxFrames, const char* pHost) -{ - uint32_t nRunning = S.nRunning; - S.nRunning = 0; - //stall pushing of timers - uint64_t nActiveGroup = S.nActiveGroup; - S.nActiveGroup = 0; - S.nPauseTicks = MP_TICK(); - - - for(size_t i = 0; i < g_MicroProfileHtml_begin_count; ++i) - { - CB(Handle, g_MicroProfileHtml_begin_sizes[i]-1, g_MicroProfileHtml_begin[i]); - } - //dump info - uint64_t nTicks = MP_TICK(); - - float fToMsCPU = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - float fToMsGPU = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondGpu()); - float fAggregateMs = fToMsCPU * (nTicks - S.nAggregateFlipTick); - MicroProfilePrintf(CB, Handle, "var DumpHost = '%s';\n", pHost ? pHost : ""); - time_t CaptureTime; - time(&CaptureTime); - MicroProfilePrintf(CB, Handle, "var DumpUtcCaptureTime = %ld;\n", CaptureTime); - MicroProfilePrintf(CB, Handle, "var AggregateInfo = {'Frames':%d, 'Time':%f};\n", S.nAggregateFrames, fAggregateMs); - - //categories - MicroProfilePrintf(CB, Handle, "var CategoryInfo = Array(%d);\n",S.nCategoryCount); - for(uint32_t i = 0; i < S.nCategoryCount; ++i) - { - MicroProfilePrintf(CB, Handle, "CategoryInfo[%d] = \"%s\";\n", i, S.CategoryInfo[i].pName); - } - - //groups - MicroProfilePrintf(CB, Handle, "var GroupInfo = Array(%d);\n\n",S.nGroupCount); - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - float fRcpAggregateFrames = 1.f / nAggregateFrames; - for(uint32_t i = 0; i < S.nGroupCount; ++i) - { - MP_ASSERT(i == S.GroupInfo[i].nGroupIndex); - float fToMs = S.GroupInfo[i].Type == MicroProfileTokenTypeCpu ? fToMsCPU : fToMsGPU; - MicroProfilePrintf(CB, Handle, "GroupInfo[%d] = MakeGroup(%d, \"%s\", %d, %d, %d, %f, %f, %f, '#%02x%02x%02x');\n", - S.GroupInfo[i].nGroupIndex, - S.GroupInfo[i].nGroupIndex, - S.GroupInfo[i].pName, - S.GroupInfo[i].nCategory, - S.GroupInfo[i].nNumTimers, - S.GroupInfo[i].Type == MicroProfileTokenTypeGpu?1:0, - fToMs * S.AggregateGroup[i], - fToMs * S.AggregateGroup[i] / nAggregateFrames, - fToMs * S.AggregateGroupMax[i], - MICROPROFILE_UNPACK_RED(S.GroupInfo[i].nColor) & 0xff, - MICROPROFILE_UNPACK_GREEN(S.GroupInfo[i].nColor) & 0xff, - MICROPROFILE_UNPACK_BLUE(S.GroupInfo[i].nColor) & 0xff); - } - //timers - - uint32_t nNumTimers = S.nTotalTimers; - uint32_t nBlockSize = 2 * nNumTimers; - float* pTimers = (float*)alloca(nBlockSize * 8 * sizeof(float)); - float* pAverage = pTimers + nBlockSize; - float* pMax = pTimers + 2 * nBlockSize; - float* pCallAverage = pTimers + 3 * nBlockSize; - float* pTimersExclusive = pTimers + 4 * nBlockSize; - float* pAverageExclusive = pTimers + 5 * nBlockSize; - float* pMaxExclusive = pTimers + 6 * nBlockSize; - float* pTotal = pTimers + 7 * nBlockSize; - - MicroProfileCalcAllTimers(pTimers, pAverage, pMax, pCallAverage, pTimersExclusive, pAverageExclusive, pMaxExclusive, pTotal, nNumTimers); - - MicroProfilePrintf(CB, Handle, "\nvar TimerInfo = Array(%d);\n\n", S.nTotalTimers); - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - uint32_t nIdx = i * 2; - MP_ASSERT(i == S.TimerInfo[i].nTimerIndex); - MicroProfilePrintf(CB, Handle, "var Meta%d = [", i); - bool bOnce = true; - for(int j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName) - { - uint32_t lala = S.MetaCounters[j].nCounters[i]; - MicroProfilePrintf(CB, Handle, bOnce ? "%d" : ",%d", lala); - bOnce = false; - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - MicroProfilePrintf(CB, Handle, "var MetaAvg%d = [", i); - bOnce = true; - for(int j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName) - { - MicroProfilePrintf(CB, Handle, bOnce ? "%f" : ",%f", fRcpAggregateFrames * S.MetaCounters[j].nAggregate[i]); - bOnce = false; - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - MicroProfilePrintf(CB, Handle, "var MetaMax%d = [", i); - bOnce = true; - for(int j = 0; j < MICROPROFILE_META_MAX; ++j) - { - if(S.MetaCounters[j].pName) - { - MicroProfilePrintf(CB, Handle, bOnce ? "%d" : ",%d", S.MetaCounters[j].nAggregateMax[i]); - bOnce = false; - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - - - uint32_t nColor = S.TimerInfo[i].nColor; - uint32_t nColorDark = (nColor >> 1) & ~0x80808080; - MicroProfilePrintf(CB, Handle, "TimerInfo[%d] = MakeTimer(%d, \"%s\", %d, '#%02x%02x%02x','#%02x%02x%02x', %f, %f, %f, %f, %f, %d, %f, Meta%d, MetaAvg%d, MetaMax%d);\n", S.TimerInfo[i].nTimerIndex, S.TimerInfo[i].nTimerIndex, S.TimerInfo[i].pName, S.TimerInfo[i].nGroupIndex, - MICROPROFILE_UNPACK_RED(nColor) & 0xff, - MICROPROFILE_UNPACK_GREEN(nColor) & 0xff, - MICROPROFILE_UNPACK_BLUE(nColor) & 0xff, - MICROPROFILE_UNPACK_RED(nColorDark) & 0xff, - MICROPROFILE_UNPACK_GREEN(nColorDark) & 0xff, - MICROPROFILE_UNPACK_BLUE(nColorDark) & 0xff, - pAverage[nIdx], - pMax[nIdx], - pAverageExclusive[nIdx], - pMaxExclusive[nIdx], - pCallAverage[nIdx], - S.Aggregate[i].nCount, - pTotal[nIdx], - i,i,i); - - } - - MicroProfilePrintf(CB, Handle, "\nvar ThreadNames = ["); - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - MicroProfilePrintf(CB, Handle, "'%s',", S.Pool[i]->ThreadName); - } - else - { - MicroProfilePrintf(CB, Handle, "'Thread %d',", i); - } - } - MicroProfilePrintf(CB, Handle, "];\n\n"); - - - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - MicroProfilePrintf(CB, Handle, "var ThreadGroupTime%d = [", i); - float fToMs = S.Pool[i]->nGpu ? fToMsGPU : fToMsCPU; - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - MicroProfilePrintf(CB, Handle, "%f,", S.Pool[i]->nAggregateGroupTicks[j]/nAggregateFrames * fToMs); - } - MicroProfilePrintf(CB, Handle, "];\n"); - } - } - MicroProfilePrintf(CB, Handle, "\nvar ThreadGroupTimeArray = ["); - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - MicroProfilePrintf(CB, Handle, "ThreadGroupTime%d,", i); - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - - - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - MicroProfilePrintf(CB, Handle, "var ThreadGroupTimeTotal%d = [", i); - float fToMs = S.Pool[i]->nGpu ? fToMsGPU : fToMsCPU; - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - MicroProfilePrintf(CB, Handle, "%f,", S.Pool[i]->nAggregateGroupTicks[j] * fToMs); - } - MicroProfilePrintf(CB, Handle, "];\n"); - } - } - MicroProfilePrintf(CB, Handle, "\nvar ThreadGroupTimeTotalArray = ["); - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - MicroProfilePrintf(CB, Handle, "ThreadGroupTimeTotal%d,", i); - } - } - MicroProfilePrintf(CB, Handle, "];"); - - - - - MicroProfilePrintf(CB, Handle, "\nvar ThreadIds = ["); - for(uint32_t i = 0; i < S.nNumLogs; ++i) - { - if(S.Pool[i]) - { - ThreadIdType ThreadId = S.Pool[i]->nThreadId; - if(!ThreadId) - { - ThreadId = (ThreadIdType)-1; - } - MicroProfilePrintf(CB, Handle, "%d,", ThreadId); - } - else - { - MicroProfilePrintf(CB, Handle, "-1,", i); - } - } - MicroProfilePrintf(CB, Handle, "];\n\n"); - - MicroProfilePrintf(CB, Handle, "\nvar MetaNames = ["); - for(int i = 0; i < MICROPROFILE_META_MAX; ++i) - { - if(S.MetaCounters[i].pName) - { - MicroProfilePrintf(CB, Handle, "'%s',", S.MetaCounters[i].pName); - } - } - - - MicroProfilePrintf(CB, Handle, "];\n\n"); - - - - uint32_t nNumFrames = (MICROPROFILE_MAX_FRAME_HISTORY - MICROPROFILE_GPU_FRAME_DELAY - 3); //leave a few to not overwrite - nNumFrames = MicroProfileMin(nNumFrames, (uint32_t)nMaxFrames); - - - uint32_t nFirstFrame = (S.nFrameCurrent + MICROPROFILE_MAX_FRAME_HISTORY - nNumFrames) % MICROPROFILE_MAX_FRAME_HISTORY; - uint32_t nLastFrame = (nFirstFrame + nNumFrames) % MICROPROFILE_MAX_FRAME_HISTORY; - MP_ASSERT(nLastFrame == (S.nFrameCurrent % MICROPROFILE_MAX_FRAME_HISTORY)); - MP_ASSERT(nFirstFrame < MICROPROFILE_MAX_FRAME_HISTORY); - MP_ASSERT(nLastFrame < MICROPROFILE_MAX_FRAME_HISTORY); - const int64_t nTickStart = S.Frames[nFirstFrame].nFrameStartCpu; - const int64_t nTickEnd = S.Frames[nLastFrame].nFrameStartCpu; - int64_t nTickStartGpu = S.Frames[nFirstFrame].nFrameStartGpu; - - int64_t nTickReferenceCpu, nTickReferenceGpu; - int64_t nTicksPerSecondCpu = MicroProfileTicksPerSecondCpu(); - int64_t nTicksPerSecondGpu = MicroProfileTicksPerSecondGpu(); - int nTickReference = 0; - if(MicroProfileGetGpuTickReference(&nTickReferenceCpu, &nTickReferenceGpu)) - { - nTickStartGpu = (nTickStart - nTickReferenceCpu) * nTicksPerSecondGpu / nTicksPerSecondCpu + nTickReferenceGpu; - nTickReference = 1; - } - - -#if MICROPROFILE_DEBUG - printf("dumping %d frames\n", nNumFrames); - printf("dumping frame %d to %d\n", nFirstFrame, nLastFrame); -#endif - - - uint32_t* nTimerCounter = (uint32_t*)alloca(sizeof(uint32_t)* S.nTotalTimers); - memset(nTimerCounter, 0, sizeof(uint32_t) * S.nTotalTimers); - - MicroProfilePrintf(CB, Handle, "var Frames = Array(%d);\n", nNumFrames); - for(uint32_t i = 0; i < nNumFrames; ++i) - { - uint32_t nFrameIndex = (nFirstFrame + i) % MICROPROFILE_MAX_FRAME_HISTORY; - uint32_t nFrameIndexNext = (nFrameIndex + 1) % MICROPROFILE_MAX_FRAME_HISTORY; - - for(uint32_t j = 0; j < S.nNumLogs; ++j) - { - MicroProfileThreadLog* pLog = S.Pool[j]; - int64_t nStartTickBase = pLog->nGpu ? nTickStartGpu : nTickStart; - uint32_t nLogStart = S.Frames[nFrameIndex].nLogStart[j]; - uint32_t nLogEnd = S.Frames[nFrameIndexNext].nLogStart[j]; - - float fToMsCpu = MicroProfileTickToMsMultiplier(nTicksPerSecondCpu); - float fToMsBase = MicroProfileTickToMsMultiplier(pLog->nGpu ? nTicksPerSecondGpu : nTicksPerSecondCpu); - MicroProfilePrintf(CB, Handle, "var ts_%d_%d = [", i, j); - if(nLogStart != nLogEnd) - { - uint32_t k = nLogStart; - uint32_t nLogType = MicroProfileLogType(pLog->Log[k]); - float fToMs = nLogType == MP_LOG_GPU_EXTRA ? fToMsCpu : fToMsBase; - int64_t nStartTick = nLogType == MP_LOG_GPU_EXTRA ? nTickStart : nStartTickBase; - float fTime = nLogType == MP_LOG_META ? 0.f : MicroProfileLogTickDifference(nStartTick, pLog->Log[k]) * fToMs; - MicroProfilePrintf(CB, Handle, "%f", fTime); - for(k = (k+1) % MICROPROFILE_BUFFER_SIZE; k != nLogEnd; k = (k+1) % MICROPROFILE_BUFFER_SIZE) - { - uint32_t nLogType = MicroProfileLogType(pLog->Log[k]); - float fToMs = nLogType == MP_LOG_GPU_EXTRA ? fToMsCpu : fToMsBase; - nStartTick = nLogType == MP_LOG_GPU_EXTRA ? nTickStart : nStartTickBase; - float fTime = nLogType == MP_LOG_META ? 0.f : MicroProfileLogTickDifference(nStartTick, pLog->Log[k]) * fToMs; - MicroProfilePrintf(CB, Handle, ",%f", fTime); - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - MicroProfilePrintf(CB, Handle, "var tt_%d_%d = [", i, j); - if(nLogStart != nLogEnd) - { - uint32_t k = nLogStart; - MicroProfilePrintf(CB, Handle, "%d", MicroProfileLogType(pLog->Log[k])); - for(k = (k+1) % MICROPROFILE_BUFFER_SIZE; k != nLogEnd; k = (k+1) % MICROPROFILE_BUFFER_SIZE) - { - uint32_t nLogType = MicroProfileLogType(pLog->Log[k]); - if(nLogType == MP_LOG_META) - { - //for meta, store the count + 3, which is the tick part - nLogType = 3 + MicroProfileLogGetTick(pLog->Log[k]); - } - MicroProfilePrintf(CB, Handle, ",%d", nLogType); - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - - MicroProfilePrintf(CB, Handle, "var ti_%d_%d = [", i, j); - if(nLogStart != nLogEnd) - { - uint32_t k = nLogStart; - MicroProfilePrintf(CB, Handle, "%d", (uint32_t)MicroProfileLogTimerIndex(pLog->Log[k])); - for(k = (k+1) % MICROPROFILE_BUFFER_SIZE; k != nLogEnd; k = (k+1) % MICROPROFILE_BUFFER_SIZE) - { - uint32_t nTimerIndex = (uint32_t)MicroProfileLogTimerIndex(pLog->Log[k]); - MicroProfilePrintf(CB, Handle, ",%d", nTimerIndex); - nTimerCounter[nTimerIndex]++; - } - } - MicroProfilePrintf(CB, Handle, "];\n"); - - } - - MicroProfilePrintf(CB, Handle, "var ts%d = [", i); - for(uint32_t j = 0; j < S.nNumLogs; ++j) - { - MicroProfilePrintf(CB, Handle, "ts_%d_%d,", i, j); - } - MicroProfilePrintf(CB, Handle, "];\n"); - MicroProfilePrintf(CB, Handle, "var tt%d = [", i); - for(uint32_t j = 0; j < S.nNumLogs; ++j) - { - MicroProfilePrintf(CB, Handle, "tt_%d_%d,", i, j); - } - MicroProfilePrintf(CB, Handle, "];\n"); - - MicroProfilePrintf(CB, Handle, "var ti%d = [", i); - for(uint32_t j = 0; j < S.nNumLogs; ++j) - { - MicroProfilePrintf(CB, Handle, "ti_%d_%d,", i, j); - } - MicroProfilePrintf(CB, Handle, "];\n"); - - - int64_t nFrameStart = S.Frames[nFrameIndex].nFrameStartCpu; - int64_t nFrameEnd = S.Frames[nFrameIndexNext].nFrameStartCpu; - - float fToMs = MicroProfileTickToMsMultiplier(nTicksPerSecondCpu); - float fFrameMs = MicroProfileLogTickDifference(nTickStart, nFrameStart) * fToMs; - float fFrameEndMs = MicroProfileLogTickDifference(nTickStart, nFrameEnd) * fToMs; - float fFrameGpuMs = 0; - float fFrameGpuEndMs = 0; - if(nTickReference) - { - fFrameGpuMs = MicroProfileLogTickDifference(nTickStartGpu, S.Frames[nFrameIndex].nFrameStartGpu) * fToMsGPU; - fFrameGpuEndMs = MicroProfileLogTickDifference(nTickStartGpu, S.Frames[nFrameIndexNext].nFrameStartGpu) * fToMsGPU; - } - MicroProfilePrintf(CB, Handle, "Frames[%d] = MakeFrame(%d, %f, %f, %f, %f, ts%d, tt%d, ti%d);\n", i, 0, fFrameMs, fFrameEndMs, fFrameGpuMs, fFrameGpuEndMs, i, i, i); - } - - uint32_t nContextSwitchStart = 0; - uint32_t nContextSwitchEnd = 0; - MicroProfileContextSwitchSearch(&nContextSwitchStart, &nContextSwitchEnd, nTickStart, nTickEnd); - - uint32_t nWrittenBefore = S.nWebServerDataSent; - MicroProfilePrintf(CB, Handle, "var CSwitchThreadInOutCpu = ["); - for(uint32_t j = nContextSwitchStart; j != nContextSwitchEnd; j = (j+1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE) - { - MicroProfileContextSwitch CS = S.ContextSwitch[j]; - int nCpu = CS.nCpu; - MicroProfilePrintf(CB, Handle, "%d,%d,%d,", CS.nThreadIn, CS.nThreadOut, nCpu); - } - MicroProfilePrintf(CB, Handle, "];\n"); - MicroProfilePrintf(CB, Handle, "var CSwitchTime = ["); - float fToMsCpu = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - for(uint32_t j = nContextSwitchStart; j != nContextSwitchEnd; j = (j+1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE) - { - MicroProfileContextSwitch CS = S.ContextSwitch[j]; - float fTime = MicroProfileLogTickDifference(nTickStart, CS.nTicks) * fToMsCpu; - MicroProfilePrintf(CB, Handle, "%f,", fTime); - } - MicroProfilePrintf(CB, Handle, "];\n"); - uint32_t nWrittenAfter = S.nWebServerDataSent; - MicroProfilePrintf(CB, Handle, "//CSwitch Size %d\n", nWrittenAfter - nWrittenBefore); - - - for(size_t i = 0; i < g_MicroProfileHtml_end_count; ++i) - { - CB(Handle, g_MicroProfileHtml_end_sizes[i]-1, g_MicroProfileHtml_end[i]); - } - - uint32_t* nGroupCounter = (uint32_t*)alloca(sizeof(uint32_t)* S.nGroupCount); - - memset(nGroupCounter, 0, sizeof(uint32_t) * S.nGroupCount); - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - uint32_t nGroupIndex = S.TimerInfo[i].nGroupIndex; - nGroupCounter[nGroupIndex] += nTimerCounter[i]; - } - - uint32_t* nGroupCounterSort = (uint32_t*)alloca(sizeof(uint32_t)* S.nGroupCount); - uint32_t* nTimerCounterSort = (uint32_t*)alloca(sizeof(uint32_t)* S.nTotalTimers); - for(uint32_t i = 0; i < S.nGroupCount; ++i) - { - nGroupCounterSort[i] = i; - } - for(uint32_t i = 0; i < S.nTotalTimers; ++i) - { - nTimerCounterSort[i] = i; - } - std::sort(nGroupCounterSort, nGroupCounterSort + S.nGroupCount, - [nGroupCounter](const uint32_t l, const uint32_t r) - { - return nGroupCounter[l] > nGroupCounter[r]; - } - ); - - std::sort(nTimerCounterSort, nTimerCounterSort + S.nTotalTimers, - [nTimerCounter](const uint32_t l, const uint32_t r) - { - return nTimerCounter[l] > nTimerCounter[r]; - } - ); - - MicroProfilePrintf(CB, Handle, "\n\n"); - - S.nActiveGroup = nActiveGroup; - S.nRunning = nRunning; - -#if MICROPROFILE_DEBUG - int64_t nTicksEnd = MP_TICK(); - float fMs = fToMsCpu * (nTicksEnd - S.nPauseTicks); - printf("html dump took %6.2fms\n", fMs); -#endif - - -} - -void MicroProfileWriteFile(void* Handle, size_t nSize, const char* pData) -{ - fwrite(pData, nSize, 1, (FILE*)Handle); -} - -void MicroProfileDumpToFile() -{ - std::lock_guard Lock(MicroProfileMutex()); - if(S.nDumpFileNextFrame&1) - { - FILE* F = fopen(S.HtmlDumpPath, "w"); - if(F) - { - MicroProfileDumpHtml(MicroProfileWriteFile, F, MICROPROFILE_WEBSERVER_MAXFRAMES, S.HtmlDumpPath); - fclose(F); - } - } - if(S.nDumpFileNextFrame&2) - { - FILE* F = fopen(S.CsvDumpPath, "w"); - if(F) - { - MicroProfileDumpCsv(MicroProfileWriteFile, F, MICROPROFILE_WEBSERVER_MAXFRAMES); - fclose(F); - } - } -} - -void MicroProfileFlushSocket(MpSocket Socket) -{ - send(Socket, &S.WebServerBuffer[0], S.WebServerPut, 0); - S.WebServerPut = 0; - -} - -void MicroProfileWriteSocket(void* Handle, size_t nSize, const char* pData) -{ - S.nWebServerDataSent += nSize; - MpSocket Socket = *(MpSocket*)Handle; - if(nSize > MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE / 2) - { - MicroProfileFlushSocket(Socket); - send(Socket, pData, nSize, 0); - - } - else - { - memcpy(&S.WebServerBuffer[S.WebServerPut], pData, nSize); - S.WebServerPut += nSize; - if(S.WebServerPut > MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE/2) - { - MicroProfileFlushSocket(Socket); - } - } -} - -#if MICROPROFILE_MINIZ -#ifndef MICROPROFILE_COMPRESS_BUFFER_SIZE -#define MICROPROFILE_COMPRESS_BUFFER_SIZE (256<<10) -#endif - -#define MICROPROFILE_COMPRESS_CHUNK (MICROPROFILE_COMPRESS_BUFFER_SIZE/2) -struct MicroProfileCompressedSocketState -{ - unsigned char DeflateOut[MICROPROFILE_COMPRESS_CHUNK]; - unsigned char DeflateIn[MICROPROFILE_COMPRESS_CHUNK]; - mz_stream Stream; - MpSocket Socket; - uint32_t nSize; - uint32_t nCompressedSize; - uint32_t nFlushes; - uint32_t nMemmoveBytes; -}; - -void MicroProfileCompressedSocketFlush(MicroProfileCompressedSocketState* pState) -{ - mz_stream& Stream = pState->Stream; - unsigned char* pSendStart = &pState->DeflateOut[0]; - unsigned char* pSendEnd = &pState->DeflateOut[MICROPROFILE_COMPRESS_CHUNK - Stream.avail_out]; - if(pSendStart != pSendEnd) - { - send(pState->Socket, (const char*)pSendStart, pSendEnd - pSendStart, 0); - pState->nCompressedSize += pSendEnd - pSendStart; - } - Stream.next_out = &pState->DeflateOut[0]; - Stream.avail_out = MICROPROFILE_COMPRESS_CHUNK; - -} -void MicroProfileCompressedSocketStart(MicroProfileCompressedSocketState* pState, MpSocket Socket) -{ - mz_stream& Stream = pState->Stream; - memset(&Stream, 0, sizeof(Stream)); - Stream.next_out = &pState->DeflateOut[0]; - Stream.avail_out = MICROPROFILE_COMPRESS_CHUNK; - Stream.next_in = &pState->DeflateIn[0]; - Stream.avail_in = 0; - mz_deflateInit(&Stream, Z_DEFAULT_COMPRESSION); - pState->Socket = Socket; - pState->nSize = 0; - pState->nCompressedSize = 0; - pState->nFlushes = 0; - pState->nMemmoveBytes = 0; - -} -void MicroProfileCompressedSocketFinish(MicroProfileCompressedSocketState* pState) -{ - mz_stream& Stream = pState->Stream; - MicroProfileCompressedSocketFlush(pState); - int r = mz_deflate(&Stream, MZ_FINISH); - MP_ASSERT(r == MZ_STREAM_END); - MicroProfileCompressedSocketFlush(pState); - r = mz_deflateEnd(&Stream); - MP_ASSERT(r == MZ_OK); -} - -void MicroProfileCompressedWriteSocket(void* Handle, size_t nSize, const char* pData) -{ - MicroProfileCompressedSocketState* pState = (MicroProfileCompressedSocketState*)Handle; - mz_stream& Stream = pState->Stream; - const unsigned char* pDeflateInEnd = Stream.next_in + Stream.avail_in; - const unsigned char* pDeflateInStart = &pState->DeflateIn[0]; - const unsigned char* pDeflateInRealEnd = &pState->DeflateIn[MICROPROFILE_COMPRESS_CHUNK]; - pState->nSize += nSize; - if(nSize <= pDeflateInRealEnd - pDeflateInEnd) - { - memcpy((void*)pDeflateInEnd, pData, nSize); - Stream.avail_in += nSize; - MP_ASSERT(Stream.next_in + Stream.avail_in <= pDeflateInRealEnd); - return; - } - int Flush = 0; - while(nSize) - { - pDeflateInEnd = Stream.next_in + Stream.avail_in; - if(Flush) - { - pState->nFlushes++; - MicroProfileCompressedSocketFlush(pState); - pDeflateInRealEnd = &pState->DeflateIn[MICROPROFILE_COMPRESS_CHUNK]; - if(pDeflateInEnd == pDeflateInRealEnd) - { - if(Stream.avail_in) - { - MP_ASSERT(pDeflateInStart != Stream.next_in); - memmove((void*)pDeflateInStart, Stream.next_in, Stream.avail_in); - pState->nMemmoveBytes += Stream.avail_in; - } - Stream.next_in = pDeflateInStart; - pDeflateInEnd = Stream.next_in + Stream.avail_in; - } - } - size_t nSpace = pDeflateInRealEnd - pDeflateInEnd; - size_t nBytes = MicroProfileMin(nSpace, nSize); - MP_ASSERT(nBytes + pDeflateInEnd <= pDeflateInRealEnd); - memcpy((void*)pDeflateInEnd, pData, nBytes); - Stream.avail_in += nBytes; - nSize -= nBytes; - pData += nBytes; - int r = mz_deflate(&Stream, MZ_NO_FLUSH); - Flush = r == MZ_BUF_ERROR || nBytes == 0 || Stream.avail_out == 0 ? 1 : 0; - MP_ASSERT(r == MZ_BUF_ERROR || r == MZ_OK); - if(r == MZ_BUF_ERROR) - { - r = mz_deflate(&Stream, MZ_SYNC_FLUSH); - } - } -} -#endif - - -#ifndef MicroProfileSetNonBlocking //fcntl doesnt work on a some unix like platforms.. -void MicroProfileSetNonBlocking(MpSocket Socket, int NonBlocking) -{ -#ifdef _WIN32 - u_long nonBlocking = NonBlocking ? 1 : 0; - ioctlsocket(Socket, FIONBIO, &nonBlocking); -#else - int Options = fcntl(Socket, F_GETFL); - if(NonBlocking) - { - fcntl(Socket, F_SETFL, Options|O_NONBLOCK); - } - else - { - fcntl(Socket, F_SETFL, Options&(~O_NONBLOCK)); - } -#endif -} -#endif - -void MicroProfileWebServerStart() -{ -#ifdef _WIN32 - WSADATA wsa; - if(WSAStartup(MAKEWORD(2, 2), &wsa)) - { - S.ListenerSocket = -1; - return; - } -#endif - - S.ListenerSocket = socket(PF_INET, SOCK_STREAM, 6); - MP_ASSERT(!MP_INVALID_SOCKET(S.ListenerSocket)); - MicroProfileSetNonBlocking(S.ListenerSocket, 1); - - S.nWebServerPort = (uint32_t)-1; - struct sockaddr_in Addr; - Addr.sin_family = AF_INET; - Addr.sin_addr.s_addr = INADDR_ANY; - for(int i = 0; i < 20; ++i) - { - Addr.sin_port = htons(MICROPROFILE_WEBSERVER_PORT+i); - if(0 == bind(S.ListenerSocket, (sockaddr*)&Addr, sizeof(Addr))) - { - S.nWebServerPort = MICROPROFILE_WEBSERVER_PORT+i; - break; - } - } - listen(S.ListenerSocket, 8); -} - -void MicroProfileWebServerStop() -{ -#ifdef _WIN32 - closesocket(S.ListenerSocket); - WSACleanup(); -#else - close(S.ListenerSocket); -#endif -} - -int MicroProfileParseGet(const char* pGet) -{ - const char* pStart = pGet; - while(*pGet != '\0') - { - if(*pGet < '0' || *pGet > '9') - return 0; - pGet++; - } - int nFrames = atoi(pStart); - if(nFrames) - { - return nFrames; - } - else - { - return MICROPROFILE_WEBSERVER_MAXFRAMES; - } -} -bool MicroProfileWebServerUpdate() -{ - MICROPROFILE_SCOPEI("MicroProfile", "Webserver-update", -1); - MpSocket Connection = accept(S.ListenerSocket, 0, 0); - bool bServed = false; - if(!MP_INVALID_SOCKET(Connection)) - { - std::lock_guard Lock(MicroProfileMutex()); - char Req[8192]; - MicroProfileSetNonBlocking(Connection, 0); - int nReceived = recv(Connection, Req, sizeof(Req)-1, 0); - if(nReceived > 0) - { - Req[nReceived] = '\0'; -#if MICROPROFILE_MINIZ -#define MICROPROFILE_HTML_HEADER "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Encoding: deflate\r\nExpires: Tue, 01 Jan 2199 16:00:00 GMT\r\n\r\n" -#else -#define MICROPROFILE_HTML_HEADER "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nExpires: Tue, 01 Jan 2199 16:00:00 GMT\r\n\r\n" -#endif - char* pHttp = strstr(Req, "HTTP/"); - char* pGet = strstr(Req, "GET /"); - char* pHost = strstr(Req, "Host: "); - auto Terminate = [](char* pString) - { - char* pEnd = pString; - while(*pEnd != '\0') - { - if(*pEnd == '\r' || *pEnd == '\n' || *pEnd == ' ') - { - *pEnd = '\0'; - return; - } - pEnd++; - } - }; - if(pHost) - { - pHost += sizeof("Host: ")-1; - Terminate(pHost); - } - - if(pHttp && pGet) - { - *pHttp = '\0'; - pGet += sizeof("GET /")-1; - Terminate(pGet); - int nFrames = MicroProfileParseGet(pGet); - if(nFrames) - { - uint64_t nTickStart = MP_TICK(); - send(Connection, MICROPROFILE_HTML_HEADER, sizeof(MICROPROFILE_HTML_HEADER)-1, 0); - uint64_t nDataStart = S.nWebServerDataSent; - S.WebServerPut = 0; - #if 0 == MICROPROFILE_MINIZ - MicroProfileDumpHtml(MicroProfileWriteSocket, &Connection, nFrames, pHost); - uint64_t nDataEnd = S.nWebServerDataSent; - uint64_t nTickEnd = MP_TICK(); - uint64_t nDiff = (nTickEnd - nTickStart); - float fMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()) * nDiff; - int nKb = ((nDataEnd-nDataStart)>>10) + 1; - int nCompressedKb = nKb; - MicroProfilePrintf(MicroProfileWriteSocket, &Connection, "\n\n\n",nKb, fMs); - MicroProfileFlushSocket(Connection); - #else - MicroProfileCompressedSocketState CompressState; - MicroProfileCompressedSocketStart(&CompressState, Connection); - MicroProfileDumpHtml(MicroProfileCompressedWriteSocket, &CompressState, nFrames, pHost); - S.nWebServerDataSent += CompressState.nSize; - uint64_t nDataEnd = S.nWebServerDataSent; - uint64_t nTickEnd = MP_TICK(); - uint64_t nDiff = (nTickEnd - nTickStart); - float fMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()) * nDiff; - int nKb = ((nDataEnd-nDataStart)>>10) + 1; - int nCompressedKb = ((CompressState.nCompressedSize)>>10) + 1; - MicroProfilePrintf(MicroProfileCompressedWriteSocket, &CompressState, "\n\n\n", nKb, nCompressedKb, fMs); - MicroProfileCompressedSocketFinish(&CompressState); - MicroProfileFlushSocket(Connection); - #endif - - #if MICROPROFILE_DEBUG - printf("\n\n\n", nKb, nCompressedKb, fMs); - #endif - } - } - } -#ifdef _WIN32 - closesocket(Connection); -#else - close(Connection); -#endif - } - return bServed; -} -#endif - - - - -#if MICROPROFILE_CONTEXT_SWITCH_TRACE -//functions that need to be implemented per platform. -void* MicroProfileTraceThread(void* unused); -bool MicroProfileIsLocalThread(uint32_t nThreadId); - - -void MicroProfileStartContextSwitchTrace() -{ - if(!S.bContextSwitchRunning) - { - S.bContextSwitchRunning = true; - S.bContextSwitchStop = false; - MicroProfileThreadStart(&S.ContextSwitchThread, MicroProfileTraceThread); - } -} - -void MicroProfileStopContextSwitchTrace() -{ - if(S.bContextSwitchRunning) - { - S.bContextSwitchStop = true; - MicroProfileThreadJoin(&S.ContextSwitchThread); - } -} - - -#ifdef _WIN32 -#define INITGUID -#include -#include -#include - - -static GUID g_MicroProfileThreadClassGuid = { 0x3d6fa8d1, 0xfe05, 0x11d0, 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c }; - -struct MicroProfileSCSwitch -{ - uint32_t NewThreadId; - uint32_t OldThreadId; - int8_t NewThreadPriority; - int8_t OldThreadPriority; - uint8_t PreviousCState; - int8_t SpareByte; - int8_t OldThreadWaitReason; - int8_t OldThreadWaitMode; - int8_t OldThreadState; - int8_t OldThreadWaitIdealProcessor; - uint32_t NewThreadWaitTime; - uint32_t Reserved; -}; - - -VOID WINAPI MicroProfileContextSwitchCallback(PEVENT_TRACE pEvent) -{ - if (pEvent->Header.Guid == g_MicroProfileThreadClassGuid) - { - if (pEvent->Header.Class.Type == 36) - { - MicroProfileSCSwitch* pCSwitch = (MicroProfileSCSwitch*) pEvent->MofData; - if ((pCSwitch->NewThreadId != 0) || (pCSwitch->OldThreadId != 0)) - { - MicroProfileContextSwitch Switch; - Switch.nThreadOut = pCSwitch->OldThreadId; - Switch.nThreadIn = pCSwitch->NewThreadId; - Switch.nCpu = pEvent->BufferContext.ProcessorNumber; - Switch.nTicks = pEvent->Header.TimeStamp.QuadPart; - MicroProfileContextSwitchPut(&Switch); - } - } - } -} - -ULONG WINAPI MicroProfileBufferCallback(PEVENT_TRACE_LOGFILE Buffer) -{ - return (S.bContextSwitchStop || !S.bContextSwitchRunning) ? FALSE : TRUE; -} - - -struct MicroProfileKernelTraceProperties : public EVENT_TRACE_PROPERTIES -{ - char dummy[sizeof(KERNEL_LOGGER_NAME)]; -}; - -void MicroProfileContextSwitchShutdownTrace() -{ - TRACEHANDLE SessionHandle = 0; - MicroProfileKernelTraceProperties sessionProperties; - - ZeroMemory(&sessionProperties, sizeof(sessionProperties)); - sessionProperties.Wnode.BufferSize = sizeof(sessionProperties); - sessionProperties.Wnode.Flags = WNODE_FLAG_TRACED_GUID; - sessionProperties.Wnode.ClientContext = 1; //QPC clock resolution - sessionProperties.Wnode.Guid = SystemTraceControlGuid; - sessionProperties.BufferSize = 1; - sessionProperties.NumberOfBuffers = 128; - sessionProperties.EnableFlags = EVENT_TRACE_FLAG_CSWITCH; - sessionProperties.LogFileMode = EVENT_TRACE_REAL_TIME_MODE; - sessionProperties.MaximumFileSize = 0; - sessionProperties.LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES); - sessionProperties.LogFileNameOffset = 0; - - EVENT_TRACE_LOGFILE log; - ZeroMemory(&log, sizeof(log)); - log.LoggerName = KERNEL_LOGGER_NAME; - log.ProcessTraceMode = 0; - TRACEHANDLE hLog = OpenTrace(&log); - if (hLog) - { - ControlTrace(SessionHandle, KERNEL_LOGGER_NAME, &sessionProperties, EVENT_TRACE_CONTROL_STOP); - } - CloseTrace(hLog); - - -} - -void* MicroProfileTraceThread(void* unused) -{ - - MicroProfileContextSwitchShutdownTrace(); - ULONG status = ERROR_SUCCESS; - TRACEHANDLE SessionHandle = 0; - MicroProfileKernelTraceProperties sessionProperties; - - ZeroMemory(&sessionProperties, sizeof(sessionProperties)); - sessionProperties.Wnode.BufferSize = sizeof(sessionProperties); - sessionProperties.Wnode.Flags = WNODE_FLAG_TRACED_GUID; - sessionProperties.Wnode.ClientContext = 1; //QPC clock resolution - sessionProperties.Wnode.Guid = SystemTraceControlGuid; - sessionProperties.BufferSize = 1; - sessionProperties.NumberOfBuffers = 128; - sessionProperties.EnableFlags = EVENT_TRACE_FLAG_CSWITCH|EVENT_TRACE_FLAG_PROCESS; - sessionProperties.LogFileMode = EVENT_TRACE_REAL_TIME_MODE; - sessionProperties.MaximumFileSize = 0; - sessionProperties.LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES); - sessionProperties.LogFileNameOffset = 0; - - - status = StartTrace((PTRACEHANDLE) &SessionHandle, KERNEL_LOGGER_NAME, &sessionProperties); - - if (ERROR_SUCCESS != status) - { - S.bContextSwitchRunning = false; - return 0; - } - - EVENT_TRACE_LOGFILE log; - ZeroMemory(&log, sizeof(log)); - - log.LoggerName = KERNEL_LOGGER_NAME; - log.ProcessTraceMode = PROCESS_TRACE_MODE_REAL_TIME | PROCESS_TRACE_MODE_RAW_TIMESTAMP; - log.EventCallback = MicroProfileContextSwitchCallback; - log.BufferCallback = MicroProfileBufferCallback; - - TRACEHANDLE hLog = OpenTrace(&log); - ProcessTrace(&hLog, 1, 0, 0); - CloseTrace(hLog); - MicroProfileContextSwitchShutdownTrace(); - - S.bContextSwitchRunning = false; - return 0; -} - -bool MicroProfileIsLocalThread(uint32_t nThreadId) -{ - HANDLE h = OpenThread(THREAD_QUERY_LIMITED_INFORMATION, FALSE, nThreadId); - if(h == NULL) - return false; - DWORD hProcess = GetProcessIdOfThread(h); - CloseHandle(h); - return GetCurrentProcessId() == hProcess; -} - -#elif defined(__APPLE__) -#include -void* MicroProfileTraceThread(void* unused) -{ - FILE* pFile = fopen("mypipe", "r"); - if(!pFile) - { - printf("CONTEXT SWITCH FAILED TO OPEN FILE: make sure to run dtrace script\n"); - S.bContextSwitchRunning = false; - return 0; - } - printf("STARTING TRACE THREAD\n"); - char* pLine = 0; - size_t cap = 0; - size_t len = 0; - struct timeval tv; - - gettimeofday(&tv, NULL); - - uint64_t nsSinceEpoch = ((uint64_t)(tv.tv_sec) * 1000000 + (uint64_t)(tv.tv_usec)) * 1000; - uint64_t nTickEpoch = MP_TICK(); - uint32_t nLastThread[MICROPROFILE_MAX_CONTEXT_SWITCH_THREADS] = {0}; - mach_timebase_info_data_t sTimebaseInfo; - mach_timebase_info(&sTimebaseInfo); - S.bContextSwitchRunning = true; - - uint64_t nProcessed = 0; - uint64_t nProcessedLast = 0; - while((len = getline(&pLine, &cap, pFile))>0 && !S.bContextSwitchStop) - { - nProcessed += len; - if(nProcessed - nProcessedLast > 10<<10) - { - nProcessedLast = nProcessed; - printf("processed %llukb %llukb\n", (nProcessed-nProcessedLast)>>10,nProcessed >>10); - } - - char* pX = strchr(pLine, 'X'); - if(pX) - { - int cpu = atoi(pX+1); - char* pX2 = strchr(pX + 1, 'X'); - char* pX3 = strchr(pX2 + 1, 'X'); - int thread = atoi(pX2+1); - char* lala; - int64_t timestamp = strtoll(pX3 + 1, &lala, 10); - MicroProfileContextSwitch Switch; - - //convert to ticks. - uint64_t nDeltaNsSinceEpoch = timestamp - nsSinceEpoch; - uint64_t nDeltaTickSinceEpoch = sTimebaseInfo.numer * nDeltaNsSinceEpoch / sTimebaseInfo.denom; - uint64_t nTicks = nDeltaTickSinceEpoch + nTickEpoch; - if(cpu < MICROPROFILE_MAX_CONTEXT_SWITCH_THREADS) - { - Switch.nThreadOut = nLastThread[cpu]; - Switch.nThreadIn = thread; - nLastThread[cpu] = thread; - Switch.nCpu = cpu; - Switch.nTicks = nTicks; - MicroProfileContextSwitchPut(&Switch); - } - } - } - printf("EXITING TRACE THREAD\n"); - S.bContextSwitchRunning = false; - return 0; -} - -bool MicroProfileIsLocalThread(uint32_t nThreadId) -{ - return false; -} - -#endif -#else - -bool MicroProfileIsLocalThread([[maybe_unused]] uint32_t nThreadId) { return false; } -void MicroProfileStopContextSwitchTrace(){} -void MicroProfileStartContextSwitchTrace(){} - -#endif - - - - -#if MICROPROFILE_GPU_TIMERS_D3D11 -uint32_t MicroProfileGpuInsertTimeStamp() -{ - MicroProfileD3D11Frame& Frame = S.GPU.m_QueryFrames[S.GPU.m_nQueryFrame]; - if(Frame.m_nRateQueryStarted) - { - uint32_t nCurrent = (Frame.m_nQueryStart + Frame.m_nQueryCount) % MICROPROFILE_D3D_MAX_QUERIES; - uint32_t nNext = (nCurrent + 1) % MICROPROFILE_D3D_MAX_QUERIES; - if(nNext != S.GPU.m_nQueryGet) - { - Frame.m_nQueryCount++; - ID3D11Query* pQuery = (ID3D11Query*)S.GPU.m_pQueries[nCurrent]; - ID3D11DeviceContext* pContext = (ID3D11DeviceContext*)S.GPU.m_pDeviceContext; - pContext->End(pQuery); - S.GPU.m_nQueryPut = nNext; - return nCurrent; - } - } - return (uint32_t)-1; -} - -uint64_t MicroProfileGpuGetTimeStamp(uint32_t nIndex) -{ - if(nIndex == (uint32_t)-1) - { - return (uint64_t)-1; - } - int64_t nResult = S.GPU.m_nQueryResults[nIndex]; - MP_ASSERT(nResult != -1); - return nResult; -} - -bool MicroProfileGpuGetData(void* pQuery, void* pData, uint32_t nDataSize) -{ - HRESULT hr; - do - { - hr = ((ID3D11DeviceContext*)S.GPU.m_pDeviceContext)->GetData((ID3D11Query*)pQuery, pData, nDataSize, 0); - }while(hr == S_FALSE); - switch(hr) - { - case DXGI_ERROR_DEVICE_REMOVED: - case DXGI_ERROR_INVALID_CALL: - case E_INVALIDARG: - MP_BREAK(); - return false; - - } - return true; -} - -uint64_t MicroProfileTicksPerSecondGpu() -{ - return S.GPU.m_nQueryFrequency; -} - -void MicroProfileGpuFlip() -{ - MicroProfileD3D11Frame& CurrentFrame = S.GPU.m_QueryFrames[S.GPU.m_nQueryFrame]; - ID3D11DeviceContext* pContext = (ID3D11DeviceContext*)S.GPU.m_pDeviceContext; - if(CurrentFrame.m_nRateQueryStarted) - { - pContext->End((ID3D11Query*)CurrentFrame.m_pRateQuery); - } - uint32_t nNextFrame = (S.GPU.m_nQueryFrame + 1) % MICROPROFILE_GPU_FRAME_DELAY; - MicroProfileD3D11Frame& OldFrame = S.GPU.m_QueryFrames[nNextFrame]; - if(OldFrame.m_nRateQueryStarted) - { - struct RateQueryResult - { - uint64_t nFrequency; - BOOL bDisjoint; - }; - RateQueryResult Result; - if(MicroProfileGpuGetData(OldFrame.m_pRateQuery, &Result, sizeof(Result))) - { - if(S.GPU.m_nQueryFrequency != (int64_t)Result.nFrequency) - { - if(S.GPU.m_nQueryFrequency) - { - OutputDebugString("Query freq changing"); - } - S.GPU.m_nQueryFrequency = Result.nFrequency; - } - uint32_t nStart = OldFrame.m_nQueryStart; - uint32_t nCount = OldFrame.m_nQueryCount; - for(uint32_t i = 0; i < nCount; ++i) - { - uint32_t nIndex = (i + nStart) % MICROPROFILE_D3D_MAX_QUERIES; - - - - if(!MicroProfileGpuGetData(S.GPU.m_pQueries[nIndex], &S.GPU.m_nQueryResults[nIndex], sizeof(uint64_t))) - { - S.GPU.m_nQueryResults[nIndex] = -1; - } - } - } - else - { - uint32_t nStart = OldFrame.m_nQueryStart; - uint32_t nCount = OldFrame.m_nQueryCount; - for(uint32_t i = 0; i < nCount; ++i) - { - uint32_t nIndex = (i + nStart) % MICROPROFILE_D3D_MAX_QUERIES; - S.GPU.m_nQueryResults[nIndex] = -1; - } - } - S.GPU.m_nQueryGet = (OldFrame.m_nQueryStart + OldFrame.m_nQueryCount) % MICROPROFILE_D3D_MAX_QUERIES; - } - - S.GPU.m_nQueryFrame = nNextFrame; - MicroProfileD3D11Frame& NextFrame = S.GPU.m_QueryFrames[nNextFrame]; - pContext->Begin((ID3D11Query*)NextFrame.m_pRateQuery); - NextFrame.m_nQueryStart = S.GPU.m_nQueryPut; - NextFrame.m_nQueryCount = 0; - - NextFrame.m_nRateQueryStarted = 1; -} - -void MicroProfileGpuInitD3D11(void* pDevice_, void* pDeviceContext_) -{ - ID3D11Device* pDevice = (ID3D11Device*)pDevice_; - ID3D11DeviceContext* pDeviceContext = (ID3D11DeviceContext*)pDeviceContext_; - S.GPU.m_pDeviceContext = pDeviceContext_; - - D3D11_QUERY_DESC Desc; - Desc.MiscFlags = 0; - Desc.Query = D3D11_QUERY_TIMESTAMP; - for(uint32_t i = 0; i < MICROPROFILE_D3D_MAX_QUERIES; ++i) - { - HRESULT hr = pDevice->CreateQuery(&Desc, (ID3D11Query**)&S.GPU.m_pQueries[i]); - MP_ASSERT(hr == S_OK); - S.GPU.m_nQueryResults[i] = -1; - } - S.GPU.m_nQueryPut = 0; - S.GPU.m_nQueryGet = 0; - S.GPU.m_nQueryFrame = 0; - S.GPU.m_nQueryFrequency = 0; - Desc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; - for(uint32_t i = 0; i < MICROPROFILE_GPU_FRAME_DELAY; ++i) - { - S.GPU.m_QueryFrames[i].m_nQueryStart = 0; - S.GPU.m_QueryFrames[i].m_nQueryCount = 0; - S.GPU.m_QueryFrames[i].m_nRateQueryStarted = 0; - HRESULT hr = pDevice->CreateQuery(&Desc, (ID3D11Query**)&S.GPU.m_QueryFrames[i].m_pRateQuery); - MP_ASSERT(hr == S_OK); - } -} - - -void MicroProfileGpuShutdown() -{ - for(uint32_t i = 0; i < MICROPROFILE_D3D_MAX_QUERIES; ++i) - { - ((ID3D11Query*)&S.GPU.m_pQueries[i])->Release(); - S.GPU.m_pQueries[i] = 0; - } - for(uint32_t i = 0; i < MICROPROFILE_GPU_FRAME_DELAY; ++i) - { - ((ID3D11Query*)S.GPU.m_QueryFrames[i].m_pRateQuery)->Release(); - S.GPU.m_QueryFrames[i].m_pRateQuery = 0; - } -} - -int MicroProfileGetGpuTickReference(int64_t* pOutCPU, int64_t* pOutGpu) -{ - return 0; -} - - -#elif MICROPROFILE_GPU_TIMERS_GL -void MicroProfileGpuInitGL() -{ - S.GPU.GLTimerPos = 0; - glGenQueries(MICROPROFILE_GL_MAX_QUERIES, &S.GPU.GLTimers[0]); -} - -uint32_t MicroProfileGpuInsertTimeStamp() -{ - uint32_t nIndex = (S.GPU.GLTimerPos+1)%MICROPROFILE_GL_MAX_QUERIES; - glQueryCounter(S.GPU.GLTimers[nIndex], GL_TIMESTAMP); - S.GPU.GLTimerPos = nIndex; - return nIndex; -} -uint64_t MicroProfileGpuGetTimeStamp(uint32_t nKey) -{ - uint64_t result; - glGetQueryObjectui64v(S.GPU.GLTimers[nKey], GL_QUERY_RESULT, &result); - return result; -} - -uint64_t MicroProfileTicksPerSecondGpu() -{ - return 1000000000ll; -} - -int MicroProfileGetGpuTickReference(int64_t* pOutCpu, int64_t* pOutGpu) -{ - int64_t nGpuTimeStamp; - glGetInteger64v(GL_TIMESTAMP, &nGpuTimeStamp); - if(nGpuTimeStamp) - { - *pOutCpu = MP_TICK(); - *pOutGpu = nGpuTimeStamp; - #if 0 //debug test if timestamp diverges - static int64_t nTicksPerSecondCpu = MicroProfileTicksPerSecondCpu(); - static int64_t nTicksPerSecondGpu = MicroProfileTicksPerSecondGpu(); - static int64_t nGpuStart = 0; - static int64_t nCpuStart = 0; - if(!nCpuStart) - { - nCpuStart = *pOutCpu; - nGpuStart = *pOutGpu; - } - static int nCountDown = 100; - if(0 == nCountDown--) - { - int64_t nCurCpu = *pOutCpu; - int64_t nCurGpu = *pOutGpu; - double fDistanceCpu = (nCurCpu - nCpuStart) / (double)nTicksPerSecondCpu; - double fDistanceGpu = (nCurGpu - nGpuStart) / (double)nTicksPerSecondGpu; - - char buf[254]; - snprintf(buf, sizeof(buf)-1,"Distance %f %f diff %f\n", fDistanceCpu, fDistanceGpu, fDistanceCpu-fDistanceGpu); - OutputDebugString(buf); - nCountDown = 100; - } - #endif - return 1; - } - return 0; -} - - -#endif - -#undef S - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - - - - -#endif -#endif -#ifdef MICROPROFILE_EMBED_HTML -#include "microprofile_html.h" -#endif diff --git a/externals/microprofile/microprofile_html.h b/externals/microprofile/microprofile_html.h deleted file mode 100644 index 01b624b60a..0000000000 --- a/externals/microprofile/microprofile_html.h +++ /dev/null @@ -1,3868 +0,0 @@ -///start file generated from microprofile.html -#ifdef MICROPROFILE_EMBED_HTML -const char g_MicroProfileHtml_begin_0[] = -"\n" -"\n" -"\n" -"MicroProfile Capture\n" -"\n" -"\n" -"\n" -"\n" -"
\n" -"\n" -"
\n" -"\n" -"\n" -" "; - -const size_t g_MicroProfileHtml_end_2_size = sizeof(g_MicroProfileHtml_end_2); -const char* g_MicroProfileHtml_end[] = { -&g_MicroProfileHtml_end_0[0], -&g_MicroProfileHtml_end_1[0], -&g_MicroProfileHtml_end_2[0], -}; -size_t g_MicroProfileHtml_end_sizes[] = { -sizeof(g_MicroProfileHtml_end_0), -sizeof(g_MicroProfileHtml_end_1), -sizeof(g_MicroProfileHtml_end_2), -}; -size_t g_MicroProfileHtml_end_count = 3; -#endif //MICROPROFILE_EMBED_HTML - -///end file generated from microprofile.html diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h deleted file mode 100644 index ca9fe70631..0000000000 --- a/externals/microprofile/microprofileui.h +++ /dev/null @@ -1,3349 +0,0 @@ -#pragma once -// This is free and unencumbered software released into the public domain. -// Anyone is free to copy, modify, publish, use, compile, sell, or -// distribute this software, either in source code form or as a compiled -// binary, for any purpose, commercial or non-commercial, and by any -// means. -// In jurisdictions that recognize copyright laws, the author or authors -// of this software dedicate any and all copyright interest in the -// software to the public domain. We make this dedication for the benefit -// of the public at large and to the detriment of our heirs and -// successors. We intend this dedication to be an overt act of -// relinquishment in perpetuity of all present and future rights to this -// software under copyright law. -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// For more information, please refer to -// -// *********************************************************************** -// -// -// - - -#ifndef MICROPROFILE_ENABLED -#error "microprofile.h must be included before including microprofileui.h" -#endif - -#ifndef MICROPROFILEUI_ENABLED -#define MICROPROFILEUI_ENABLED MICROPROFILE_ENABLED -#endif - -#ifndef MICROPROFILEUI_API -#define MICROPROFILEUI_API -#endif - - -#if 0 == MICROPROFILEUI_ENABLED -#define MicroProfileMouseButton(foo, bar) do{}while(0) -#define MicroProfileMousePosition(foo, bar, z) do{}while(0) -#define MicroProfileModKey(key) do{}while(0) -#define MicroProfileDraw(foo, bar) do{}while(0) -#define MicroProfileIsDrawing() 0 -#define MicroProfileToggleDisplayMode() do{}while(0) -#define MicroProfileSetDisplayMode(f) do{}while(0) -#else - -#ifndef MICROPROFILE_DRAWCURSOR -#define MICROPROFILE_DRAWCURSOR 0 -#endif - -#ifndef MICROPROFILE_DETAILED_BAR_NAMES -#define MICROPROFILE_DETAILED_BAR_NAMES 1 -#endif - -#ifndef MICROPROFILE_TEXT_WIDTH -#define MICROPROFILE_TEXT_WIDTH 5 -#endif - -#ifndef MICROPROFILE_TEXT_HEIGHT -#define MICROPROFILE_TEXT_HEIGHT 8 -#endif - -#ifndef MICROPROFILE_DETAILED_BAR_HEIGHT -#define MICROPROFILE_DETAILED_BAR_HEIGHT 12 -#endif - -#ifndef MICROPROFILE_DETAILED_CONTEXT_SWITCH_HEIGHT -#define MICROPROFILE_DETAILED_CONTEXT_SWITCH_HEIGHT 7 -#endif - -#ifndef MICROPROFILE_GRAPH_WIDTH -#define MICROPROFILE_GRAPH_WIDTH 256 -#endif - -#ifndef MICROPROFILE_GRAPH_HEIGHT -#define MICROPROFILE_GRAPH_HEIGHT 256 -#endif - -#ifndef MICROPROFILE_BORDER_SIZE -#define MICROPROFILE_BORDER_SIZE 1 -#endif - -#ifndef MICROPROFILE_HELP_LEFT -#define MICROPROFILE_HELP_LEFT "Left-Click" -#endif - -#ifndef MICROPROFILE_HELP_ALT -#define MICROPROFILE_HELP_ALT "Alt-Click" -#endif - -#ifndef MICROPROFILE_HELP_MOD -#define MICROPROFILE_HELP_MOD "Mod" -#endif - -#ifndef MICROPROFILE_BAR_WIDTH -#define MICROPROFILE_BAR_WIDTH 100 -#endif - -#ifndef MICROPROFILE_CUSTOM_MAX -#define MICROPROFILE_CUSTOM_MAX 8 -#endif - -#ifndef MICROPROFILE_CUSTOM_MAX_TIMERS -#define MICROPROFILE_CUSTOM_MAX_TIMERS 64 -#endif - -#ifndef MICROPROFILE_CUSTOM_PADDING -#define MICROPROFILE_CUSTOM_PADDING 12 -#endif - - -#define MICROPROFILE_FRAME_HISTORY_HEIGHT 50 -#define MICROPROFILE_FRAME_HISTORY_WIDTH 7 -#define MICROPROFILE_FRAME_HISTORY_COLOR_CPU 0xffff7f27 //255 127 39 -#define MICROPROFILE_FRAME_HISTORY_COLOR_GPU 0xff37a0ee //55 160 238 -#define MICROPROFILE_FRAME_HISTORY_COLOR_HIGHTLIGHT 0x7733bb44 -#define MICROPROFILE_FRAME_COLOR_HIGHTLIGHT 0x20009900 -#define MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU 0x20996600 -#define MICROPROFILE_NUM_FRAMES (MICROPROFILE_MAX_FRAME_HISTORY - (MICROPROFILE_GPU_FRAME_DELAY+1)) - -#define MICROPROFILE_TOOLTIP_MAX_STRINGS (32 + MICROPROFILE_MAX_GROUPS*2) -#define MICROPROFILE_TOOLTIP_STRING_BUFFER_SIZE (4*1024) -#define MICROPROFILE_TOOLTIP_MAX_LOCKED 3 - - -enum -{ - MICROPROFILE_CUSTOM_BARS = 0x1, - MICROPROFILE_CUSTOM_BAR_SOURCE_MAX = 0x2, - MICROPROFILE_CUSTOM_BAR_SOURCE_AVG = 0, - MICROPROFILE_CUSTOM_STACK = 0x4, - MICROPROFILE_CUSTOM_STACK_SOURCE_MAX = 0x8, - MICROPROFILE_CUSTOM_STACK_SOURCE_AVG = 0, -}; - - -MICROPROFILEUI_API void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight); //! call if drawing microprofilers -MICROPROFILEUI_API bool MicroProfileIsDrawing(); -MICROPROFILEUI_API void MicroProfileToggleGraph(MicroProfileToken nToken); -MICROPROFILEUI_API bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight); -MICROPROFILEUI_API void MicroProfileToggleDisplayMode(); //switch between off, bars, detailed -MICROPROFILEUI_API void MicroProfileSetDisplayMode(int); //switch between off, bars, detailed -MICROPROFILEUI_API void MicroProfileClearGraph(); -MICROPROFILEUI_API void MicroProfileMousePosition(uint32_t nX, uint32_t nY, int nWheelDelta); -MICROPROFILEUI_API void MicroProfileModKey(uint32_t nKeyState); -MICROPROFILEUI_API void MicroProfileMouseButton(uint32_t nLeft, uint32_t nRight); -MICROPROFILEUI_API void MicroProfileDrawLineVertical(int nX, int nTop, int nBottom, uint32_t nColor); -MICROPROFILEUI_API void MicroProfileDrawLineHorizontal(int nLeft, int nRight, int nY, uint32_t nColor); -MICROPROFILEUI_API void MicroProfileLoadPreset(const char* pSuffix); -MICROPROFILEUI_API void MicroProfileSavePreset(const char* pSuffix); - -MICROPROFILEUI_API void MicroProfileDrawText(int nX, int nY, uint32_t nColor, const char* pText, uint32_t nNumCharacters); -MICROPROFILEUI_API void MicroProfileDrawBox(int nX, int nY, int nX1, int nY1, uint32_t nColor, MicroProfileBoxType = MicroProfileBoxTypeFlat); -MICROPROFILEUI_API void MicroProfileDrawLine2D(uint32_t nVertices, float* pVertices, uint32_t nColor); -MICROPROFILEUI_API void MicroProfileDumpTimers(); - -MICROPROFILEUI_API void MicroProfileInitUI(); - -MICROPROFILEUI_API void MicroProfileCustomGroupToggle(const char* pCustomName); -MICROPROFILEUI_API void MicroProfileCustomGroupEnable(const char* pCustomName); -MICROPROFILEUI_API void MicroProfileCustomGroupEnable(uint32_t nIndex); -MICROPROFILEUI_API void MicroProfileCustomGroupDisable(); -MICROPROFILEUI_API void MicroProfileCustomGroup(const char* pCustomName, uint32_t nMaxTimers, uint32_t nAggregateFlip, float fReferenceTime, uint32_t nFlags); -MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer); - -#ifdef MICROPROFILEUI_IMPL -#include -#include -#include -#include -#include -#include -#include - -MICROPROFILE_DEFINE(g_MicroProfileDetailed, "MicroProfile", "Detailed View", 0x8888000); -MICROPROFILE_DEFINE(g_MicroProfileDrawGraph, "MicroProfile", "Draw Graph", 0xff44ee00); -MICROPROFILE_DEFINE(g_MicroProfileDrawBarView, "MicroProfile", "DrawBarView", 0x00dd77); -MICROPROFILE_DEFINE(g_MicroProfileDraw,"MicroProfile", "Draw", 0x737373); - - -struct MicroProfileStringArray -{ - const char* ppStrings[MICROPROFILE_TOOLTIP_MAX_STRINGS]; - char Buffer[MICROPROFILE_TOOLTIP_STRING_BUFFER_SIZE]; - char* pBufferPos; - uint32_t nNumStrings; -}; - -struct MicroProfileGroupMenuItem -{ - uint32_t nIsCategory; - uint32_t nCategoryIndex; - uint32_t nIndex; - const char* pName; -}; - -struct MicroProfileCustom -{ - char pName[MICROPROFILE_NAME_MAX_LEN]; - uint32_t nFlags; - uint32_t nAggregateFlip; - uint32_t nNumTimers; - uint32_t nMaxTimers; - uint64_t nGroupMask; - float fReference; - uint64_t* pTimers; -}; - -struct SOptionDesc -{ - SOptionDesc()=default; - SOptionDesc(uint8_t nSubType_, uint8_t nIndex_, const char* fmt, ...):nSubType(nSubType_), nIndex(nIndex_) - { - va_list args; - va_start (args, fmt); - vsprintf(Text, fmt, args); - va_end(args); - } - char Text[32]; - uint8_t nSubType; - uint8_t nIndex; - bool bSelected; -}; -static const std::array g_MicroProfileAggregatePresets{0, 10, 20, 30, 60, 120}; -static const std::array g_MicroProfileReferenceTimePresets{5.f, 10.f, 15.f,20.f, 33.33f, 66.66f, 100.f, 250.f, 500.f, 1000.f}; -static const std::array g_MicroProfileOpacityPresets{0x40, 0x80, 0xc0, 0xff}; -static const std::array g_MicroProfilePresetNames -{ - MICROPROFILE_DEFAULT_PRESET, - "Render", - "GPU", - "Lighting", - "AI", - "Visibility", - "Sound", -}; - -enum -{ - MICROPROFILE_NUM_REFERENCE_PRESETS = g_MicroProfileReferenceTimePresets.size(), - MICROPROFILE_NUM_OPACITY_PRESETS = g_MicroProfileOpacityPresets.size(), -#if MICROPROFILE_CONTEXT_SWITCH_TRACE - MICROPROFILE_OPTION_SIZE = MICROPROFILE_NUM_REFERENCE_PRESETS + MICROPROFILE_NUM_OPACITY_PRESETS * 2 + 2 + 7, -#else - MICROPROFILE_OPTION_SIZE = MICROPROFILE_NUM_REFERENCE_PRESETS + MICROPROFILE_NUM_OPACITY_PRESETS * 2 + 2 + 3, -#endif -}; - -struct MicroProfileUI -{ - //menu/mouse over stuff - uint64_t nHoverToken; - int64_t nHoverTime; - int nHoverFrame; -#if MICROPROFILE_DEBUG - uint64_t nHoverAddressEnter; - uint64_t nHoverAddressLeave; -#endif - - uint32_t nWidth; - uint32_t nHeight; - - - int nOffsetX; - int nOffsetY; - float fDetailedOffset; //display offset relative to start of latest displayable frame. - float fDetailedRange; //no. of ms to display - float fDetailedOffsetTarget; - float fDetailedRangeTarget; - uint32_t nOpacityBackground; - uint32_t nOpacityForeground; - bool bShowSpikes; - - - - uint32_t nMouseX; - uint32_t nMouseY; - uint32_t nMouseDownX; - uint32_t nMouseDownY; - int nMouseWheelDelta; - uint32_t nMouseDownLeft; - uint32_t nMouseDownRight; - uint32_t nMouseLeft; - uint32_t nMouseRight; - uint32_t nMouseLeftMod; - uint32_t nMouseRightMod; - uint32_t nModDown; - uint32_t nActiveMenu; - - MicroProfileLogEntry* pDisplayMouseOver; - - int64_t nRangeBegin; - int64_t nRangeEnd; - int64_t nRangeBeginGpu; - int64_t nRangeEndGpu; - uint32_t nRangeBeginIndex; - uint32_t nRangeEndIndex; - MicroProfileThreadLog* pRangeLog; - uint32_t nHoverColor; - uint32_t nHoverColorShared; - - MicroProfileStringArray LockedToolTips[MICROPROFILE_TOOLTIP_MAX_LOCKED]; - uint32_t nLockedToolTipColor[MICROPROFILE_TOOLTIP_MAX_LOCKED]; - int LockedToolTipFront; - - MicroProfileGroupMenuItem GroupMenu[MICROPROFILE_MAX_GROUPS + MICROPROFILE_MAX_CATEGORIES]; - uint32_t GroupMenuCount; - - - uint32_t nCustomActive; - uint32_t nCustomTimerCount; - uint32_t nCustomCount; - MicroProfileCustom Custom[MICROPROFILE_CUSTOM_MAX]; - uint64_t CustomTimer[MICROPROFILE_CUSTOM_MAX_TIMERS]; - - SOptionDesc Options[MICROPROFILE_OPTION_SIZE]; - - -}; - -MicroProfileUI g_MicroProfileUI; -#define UI g_MicroProfileUI -static const std::array g_nMicroProfileBackColors{ 0x474747, 0x313131 }; -#define MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS 16 -static const std::array g_nMicroProfileContextSwitchThreadColors //palette generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php -{ - 0x63607B, - 0x755E2B, - 0x326A55, - 0x523135, - 0x904F42, - 0x87536B, - 0x346875, - 0x5E6046, - 0x35404C, - 0x224038, - 0x413D1E, - 0x5E3A26, - 0x5D6161, - 0x4C6234, - 0x7D564F, - 0x5C4352, -}; - - -void MicroProfileInitUI() -{ - static bool bInitialized = false; - if(!bInitialized) - { - bInitialized = true; - memset(&g_MicroProfileUI, 0, sizeof(g_MicroProfileUI)); - UI.nActiveMenu = UINT32_MAX; - UI.fDetailedOffsetTarget = UI.fDetailedOffset = 0.f; - UI.fDetailedRangeTarget = UI.fDetailedRange = 50.f; - - UI.nOpacityBackground = 0xff<<24; - UI.nOpacityForeground = 0xff<<24; - - UI.bShowSpikes = false; - - UI.nWidth = 100; - UI.nHeight = 100; - - UI.nCustomActive = UINT32_MAX; - UI.nCustomTimerCount = 0; - UI.nCustomCount = 0; - - int nIndex = 0; - UI.Options[nIndex++] = SOptionDesc(0xff, 0, "%s", "Reference"); - for(int i = 0; i < MICROPROFILE_NUM_REFERENCE_PRESETS; ++i) - { - UI.Options[nIndex++] = SOptionDesc(0, i, " %6.2fms", g_MicroProfileReferenceTimePresets[i]); - } - UI.Options[nIndex++] = SOptionDesc(0xff, 0, "%s", "BG Opacity"); - for(int i = 0; i < MICROPROFILE_NUM_OPACITY_PRESETS; ++i) - { - UI.Options[nIndex++] = SOptionDesc(1, i, " %7d%%", (i+1)*25); - } - UI.Options[nIndex++] = SOptionDesc(0xff, 0, "%s", "FG Opacity"); - for(int i = 0; i < MICROPROFILE_NUM_OPACITY_PRESETS; ++i) - { - UI.Options[nIndex++] = SOptionDesc(2, i, " %7d%%", (i+1)*25); - } - UI.Options[nIndex++] = SOptionDesc(0xff, 0, "%s", "Spike Display"); - UI.Options[nIndex++] = SOptionDesc(3, 0, "%s", " Enable"); - -#if MICROPROFILE_CONTEXT_SWITCH_TRACE - UI.Options[nIndex++] = SOptionDesc(0xff, 0, "%s", "CSwitch Trace"); - UI.Options[nIndex++] = SOptionDesc(4, 0, "%s", " Enable"); - UI.Options[nIndex++] = SOptionDesc(4, 1, "%s", " All Threads"); - UI.Options[nIndex++] = SOptionDesc(4, 2, "%s", " No Bars"); -#endif - MP_ASSERT(nIndex == MICROPROFILE_OPTION_SIZE); - } -} - -void MicroProfileSetDisplayMode(int nValue) -{ - MicroProfile& S = *MicroProfileGet(); - nValue = nValue >= 0 && nValue < 4 ? nValue : S.nDisplay; - S.nDisplay = nValue; - UI.nOffsetY = 0; -} - -void MicroProfileToggleDisplayMode() -{ - MicroProfile& S = *MicroProfileGet(); - S.nDisplay = (S.nDisplay + 1) % 4; - UI.nOffsetY = 0; -} - - -inline void MicroProfileStringArrayClear(MicroProfileStringArray* pArray) -{ - pArray->nNumStrings = 0; - pArray->pBufferPos = &pArray->Buffer[0]; -} - -inline void MicroProfileStringArrayAddLiteral(MicroProfileStringArray* pArray, const char* pLiteral) -{ - MP_ASSERT(pArray->nNumStrings < MICROPROFILE_TOOLTIP_MAX_STRINGS); - pArray->ppStrings[pArray->nNumStrings++] = pLiteral; -} - -inline void MicroProfileStringArrayFormat(MicroProfileStringArray* pArray, const char* fmt, ...) -{ - MP_ASSERT(pArray->nNumStrings < MICROPROFILE_TOOLTIP_MAX_STRINGS); - pArray->ppStrings[pArray->nNumStrings++] = pArray->pBufferPos; - va_list args; - va_start (args, fmt); - pArray->pBufferPos += 1 + vsprintf(pArray->pBufferPos, fmt, args); - va_end(args); - MP_ASSERT(pArray->pBufferPos < pArray->Buffer + MICROPROFILE_TOOLTIP_STRING_BUFFER_SIZE); -} -inline void MicroProfileStringArrayCopy(MicroProfileStringArray* pDest, MicroProfileStringArray* pSrc) -{ - memcpy(&pDest->ppStrings[0], &pSrc->ppStrings[0], sizeof(pDest->ppStrings)); - memcpy(&pDest->Buffer[0], &pSrc->Buffer[0], sizeof(pDest->Buffer)); - for(uint32_t i = 0; i < MICROPROFILE_TOOLTIP_MAX_STRINGS; ++i) - { - if(i < pSrc->nNumStrings) - { - if(pSrc->ppStrings[i] >= &pSrc->Buffer[0] && pSrc->ppStrings[i] < &pSrc->Buffer[0] + MICROPROFILE_TOOLTIP_STRING_BUFFER_SIZE) - { - pDest->ppStrings[i] += &pDest->Buffer[0] - &pSrc->Buffer[0]; - } - } - } - pDest->nNumStrings = pSrc->nNumStrings; -} - -inline void MicroProfileFloatWindowSize(const char** ppStrings, uint32_t nNumStrings, uint32_t* pColors, uint32_t& nWidth, uint32_t& nHeight, uint32_t* pStringLengths = 0) -{ - uint32_t* nStringLengths = pStringLengths ? pStringLengths : (uint32_t*)alloca(nNumStrings * sizeof(uint32_t)); - uint32_t nTextCount = nNumStrings/2; - for(uint32_t i = 0; i < nTextCount; ++i) - { - uint32_t i0 = i * 2; - uint32_t s0, s1; - nStringLengths[i0] = s0 = (uint32_t)strlen(ppStrings[i0]); - nStringLengths[i0+1] = s1 = (uint32_t)strlen(ppStrings[i0+1]); - nWidth = MicroProfileMax(s0+s1, nWidth); - } - nWidth = (MICROPROFILE_TEXT_WIDTH+1) * (2+nWidth) + 2 * MICROPROFILE_BORDER_SIZE; - if(pColors) - nWidth += MICROPROFILE_TEXT_WIDTH + 1; - nHeight = (MICROPROFILE_TEXT_HEIGHT+1) * nTextCount + 2 * MICROPROFILE_BORDER_SIZE; -} - -inline void MicroProfileDrawFloatWindow(uint32_t nX, uint32_t nY, const char** ppStrings, uint32_t nNumStrings, uint32_t nColor, uint32_t* pColors = 0) -{ - uint32_t nWidth = 0, nHeight = 0; - uint32_t* nStringLengths = (uint32_t*)alloca(nNumStrings * sizeof(uint32_t)); - MicroProfileFloatWindowSize(ppStrings, nNumStrings, pColors, nWidth, nHeight, nStringLengths); - uint32_t nTextCount = nNumStrings/2; - if(nX + nWidth > UI.nWidth) - nX = UI.nWidth - nWidth; - if(nY + nHeight > UI.nHeight) - nY = UI.nHeight - nHeight; - MicroProfileDrawBox(nX-1, nY-1, nX + nWidth+1, nY + nHeight+1, 0xff000000|nColor); - MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000); - if(pColors) - { - nX += MICROPROFILE_TEXT_WIDTH+1; - nWidth -= MICROPROFILE_TEXT_WIDTH+1; - } - for(uint32_t i = 0; i < nTextCount; ++i) - { - int i0 = i * 2; - if(pColors) - { - MicroProfileDrawBox(nX-MICROPROFILE_TEXT_WIDTH, nY, nX, nY + MICROPROFILE_TEXT_WIDTH, pColors[i]|0xff000000); - } - MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i0], (uint32_t)strlen(ppStrings[i0])); - MicroProfileDrawText(nX + nWidth - nStringLengths[i0+1] * (MICROPROFILE_TEXT_WIDTH+1), nY + 1, UINT32_MAX, ppStrings[i0+1], (uint32_t)strlen(ppStrings[i0+1])); - nY += (MICROPROFILE_TEXT_HEIGHT+1); - } -} -inline void MicroProfileDrawTextBox(uint32_t nX, uint32_t nY, const char** ppStrings, uint32_t nNumStrings, uint32_t nColor, uint32_t* pColors = 0) -{ - uint32_t nWidth = 0, nHeight = 0; - uint32_t* nStringLengths = (uint32_t*)alloca(nNumStrings * sizeof(uint32_t)); - for(uint32_t i = 0; i < nNumStrings; ++i) - { - nStringLengths[i] = (uint32_t)strlen(ppStrings[i]); - nWidth = MicroProfileMax(nWidth, nStringLengths[i]); - nHeight++; - } - nWidth = (MICROPROFILE_TEXT_WIDTH+1) * (2+nWidth) + 2 * MICROPROFILE_BORDER_SIZE; - nHeight = (MICROPROFILE_TEXT_HEIGHT+1) * nHeight + 2 * MICROPROFILE_BORDER_SIZE; - if(nX + nWidth > UI.nWidth) - nX = UI.nWidth - nWidth; - if(nY + nHeight > UI.nHeight) - nY = UI.nHeight - nHeight; - MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000); - for(uint32_t i = 0; i < nNumStrings; ++i) - { - MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i], (uint32_t)strlen(ppStrings[i])); - nY += (MICROPROFILE_TEXT_HEIGHT+1); - } -} - - - -inline void MicroProfileToolTipMeta(MicroProfileStringArray* pToolTip) -{ - MicroProfile& S = *MicroProfileGet(); - if(UI.nRangeBeginIndex != UI.nRangeEndIndex && UI.pRangeLog) - { - uint64_t nMetaSum[MICROPROFILE_META_MAX] = {0}; - uint64_t nMetaSumInclusive[MICROPROFILE_META_MAX] = {0}; - int nStackDepth = 0; - uint32_t nRange[2][2]; - MicroProfileThreadLog* pLog = UI.pRangeLog; - - - MicroProfileGetRange(UI.nRangeEndIndex, UI.nRangeBeginIndex, nRange); - for(uint32_t i = 0; i < 2; ++i) - { - uint32_t nStart = nRange[i][0]; - uint32_t nEnd = nRange[i][1]; - for(uint32_t j = nStart; j < nEnd; ++j) - { - MicroProfileLogEntry LE = pLog->Log[j]; - int nType = MicroProfileLogType(LE); - switch(nType) - { - case MP_LOG_META: - { - int64_t nMetaIndex = MicroProfileLogTimerIndex(LE); - int64_t nMetaCount = MicroProfileLogGetTick(LE); - MP_ASSERT(nMetaIndex < MICROPROFILE_META_MAX); - if(nStackDepth>1) - { - nMetaSumInclusive[nMetaIndex] += nMetaCount; - } - else - { - nMetaSum[nMetaIndex] += nMetaCount; - } - } - break; - case MP_LOG_LEAVE: - if(nStackDepth) - { - nStackDepth--; - } - else - { - for(int k = 0; k < MICROPROFILE_META_MAX; ++k) - { - nMetaSumInclusive[k] += nMetaSum[k]; - nMetaSum[k] = 0; - } - } - break; - case MP_LOG_ENTER: - nStackDepth++; - break; - } - - } - } - bool bSpaced = false; - for(int i = 0; i < MICROPROFILE_META_MAX; ++i) - { - if(S.MetaCounters[i].pName && (nMetaSum[i]||nMetaSumInclusive[i])) - { - if(!bSpaced) - { - bSpaced = true; - MicroProfileStringArrayAddLiteral(pToolTip, ""); - MicroProfileStringArrayAddLiteral(pToolTip, ""); - } - MicroProfileStringArrayFormat(pToolTip, "%s excl", S.MetaCounters[i].pName); - MicroProfileStringArrayFormat(pToolTip, "%5d", nMetaSum[i]); - MicroProfileStringArrayFormat(pToolTip, "%s incl", S.MetaCounters[i].pName); - MicroProfileStringArrayFormat(pToolTip, "%5d", nMetaSum[i] + nMetaSumInclusive[i]); - } - } - } -} - -inline void MicroProfileDrawFloatTooltip(uint32_t nX, uint32_t nY, uint32_t nToken, uint64_t nTime) -{ - MicroProfile& S = *MicroProfileGet(); - - uint32_t nIndex = MicroProfileGetTimerIndex(nToken); - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - uint32_t nAggregateCount = S.Aggregate[nIndex].nCount ? S.Aggregate[nIndex].nCount : 1; - - uint32_t nGroupId = MicroProfileGetGroupIndex(nToken); - uint32_t nTimerId = MicroProfileGetTimerIndex(nToken); - bool bGpu = S.GroupInfo[nGroupId].Type == MicroProfileTokenTypeGpu; - - float fToMs = MicroProfileTickToMsMultiplier(bGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - - float fMs = fToMs * (nTime); - float fFrameMs = fToMs * (S.Frame[nIndex].nTicks); - float fAverage = fToMs * (S.Aggregate[nIndex].nTicks/nAggregateFrames); - float fCallAverage = fToMs * (S.Aggregate[nIndex].nTicks / nAggregateCount); - float fMax = fToMs * (S.AggregateMax[nIndex]); - - float fFrameMsExclusive = fToMs * (S.FrameExclusive[nIndex]); - float fAverageExclusive = fToMs * (S.AggregateExclusive[nIndex]/nAggregateFrames); - float fMaxExclusive = fToMs * (S.AggregateMaxExclusive[nIndex]); - - float fGroupAverage = fToMs * (S.AggregateGroup[nGroupId] / nAggregateFrames); - float fGroupMax = fToMs * (S.AggregateGroupMax[nGroupId]); - float fGroup = fToMs * (S.FrameGroup[nGroupId]); - - - MicroProfileStringArray ToolTip; - MicroProfileStringArrayClear(&ToolTip); - const char* pGroupName = S.GroupInfo[nGroupId].pName; - const char* pTimerName = S.TimerInfo[nTimerId].pName; - MicroProfileStringArrayAddLiteral(&ToolTip, "Timer:"); - MicroProfileStringArrayFormat(&ToolTip, "%s", pTimerName); - -#if MICROPROFILE_DEBUG - MicroProfileStringArrayFormat(&ToolTip,"0x%p", UI.nHoverAddressEnter); - MicroProfileStringArrayFormat(&ToolTip,"0x%p", UI.nHoverAddressLeave); -#endif - - if(nTime != (uint64_t)0) - { - MicroProfileStringArrayAddLiteral(&ToolTip, "Time:"); - MicroProfileStringArrayFormat(&ToolTip,"%6.3fms", fMs); - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - } - - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Time:"); - MicroProfileStringArrayFormat(&ToolTip,"%6.3fms", fFrameMs); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Average:"); - MicroProfileStringArrayFormat(&ToolTip,"%6.3fms", fAverage); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Max:"); - MicroProfileStringArrayFormat(&ToolTip,"%6.3fms", fMax); - - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Call Average:"); - MicroProfileStringArrayFormat(&ToolTip,"%6.3fms", fCallAverage); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Call Count:"); - MicroProfileStringArrayFormat(&ToolTip, "%6d", nAggregateCount / nAggregateFrames); - - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Exclusive Frame Time:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3fms", fFrameMsExclusive); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Exclusive Average:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3fms", fAverageExclusive); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Exclusive Max:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3fms", fMaxExclusive); - - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - - MicroProfileStringArrayAddLiteral(&ToolTip, "Group:"); - MicroProfileStringArrayFormat(&ToolTip, "%s", pGroupName); - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Time:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3f", fGroup); - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Average:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3f", fGroupAverage); - MicroProfileStringArrayAddLiteral(&ToolTip, "Frame Max:"); - MicroProfileStringArrayFormat(&ToolTip, "%6.3f", fGroupMax); - - - - - MicroProfileToolTipMeta(&ToolTip); - - - MicroProfileDrawFloatWindow(nX, nY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, S.TimerInfo[nTimerId].nColor); - - if(UI.nMouseLeftMod) - { - int nToolTipIndex = (g_MicroProfileUI.LockedToolTipFront + MICROPROFILE_TOOLTIP_MAX_LOCKED - 1) % MICROPROFILE_TOOLTIP_MAX_LOCKED; - g_MicroProfileUI.nLockedToolTipColor[nToolTipIndex] = S.TimerInfo[nTimerId].nColor; - MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nToolTipIndex], &ToolTip); - g_MicroProfileUI.LockedToolTipFront = nToolTipIndex; - - } -} - - -inline void MicroProfileZoomTo(int64_t nTickStart, int64_t nTickEnd) -{ - MicroProfile& S = *MicroProfileGet(); - - int64_t nStart = S.Frames[S.nFrameCurrent].nFrameStartCpu; - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - UI.fDetailedOffsetTarget = MicroProfileLogTickDifference(nStart, nTickStart) * fToMs; - UI.fDetailedRangeTarget = MicroProfileLogTickDifference(nTickStart, nTickEnd) * fToMs; -} - -inline void MicroProfileCenter(int64_t nTickCenter) -{ - MicroProfile& S = *MicroProfileGet(); - int64_t nStart = S.Frames[S.nFrameCurrent].nFrameStartCpu; - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - float fCenter = MicroProfileLogTickDifference(nStart, nTickCenter) * fToMs; - UI.fDetailedOffsetTarget = UI.fDetailedOffset = fCenter - 0.5f * UI.fDetailedRange; -} -#ifdef MICROPROFILE_DEBUG -uint64_t* g_pMicroProfileDumpStart = 0; -uint64_t* g_pMicroProfileDumpEnd = 0; -inline void MicroProfileDebugDumpRange() -{ - MicroProfile& S = *MicroProfileGet(); - if(g_pMicroProfileDumpStart != g_pMicroProfileDumpEnd) - { - uint64_t* pStart = g_pMicroProfileDumpStart; - uint64_t* pEnd = g_pMicroProfileDumpEnd; - while(pStart != pEnd) - { - uint64_t nTick = MicroProfileLogGetTick(*pStart); - uint64_t nToken = MicroProfileLogTimerIndex(*pStart); - uint32_t nTimerId = MicroProfileGetTimerIndex(nToken); - - const char* pTimerName = S.TimerInfo[nTimerId].pName; - char buffer[256]; - int type = MicroProfileLogType(*pStart); - - const char* pBegin = type == MP_LOG_LEAVE ? "END" : - (type == MP_LOG_ENTER ? "BEGIN" : "META"); - snprintf(buffer, 255, "DUMP 0x%p: %s :: %llx: %s\n", pStart, pBegin, nTick, pTimerName); -#ifdef _WIN32 - OutputDebugString(buffer); -#else - printf("%s", buffer); -#endif - pStart++; - } - - g_pMicroProfileDumpStart = g_pMicroProfileDumpEnd; - } -} -#define MP_DEBUG_DUMP_RANGE() MicroProfileDebugDumpRange(); -#else -#define MP_DEBUG_DUMP_RANGE() do{} while(0) -#endif - -#define MICROPROFILE_HOVER_DIST 0.5f - -inline void MicroProfileDrawDetailedContextSwitchBars(uint32_t nY, uint32_t nThreadId, uint32_t nContextSwitchStart, uint32_t nContextSwitchEnd, int64_t nBaseTicks, uint32_t nBaseY) -{ - MicroProfile& S = *MicroProfileGet(); - int64_t nTickIn = -1; - uint32_t nThreadBefore = UINT32_MAX; - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - float fMsToScreen = UI.nWidth / UI.fDetailedRange; - float fMouseX = (float)UI.nMouseX; - float fMouseY = (float)UI.nMouseY; - - - for(uint32_t j = nContextSwitchStart; j != nContextSwitchEnd; j = (j+1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE) - { - MP_ASSERT(j < MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE); - MicroProfileContextSwitch CS = S.ContextSwitch[j]; - - if(nTickIn == -1) - { - if(CS.nThreadIn == nThreadId) - { - nTickIn = CS.nTicks; - nThreadBefore = CS.nThreadOut; - } - } - else - { - if(CS.nThreadOut == nThreadId) - { - int64_t nTickOut = CS.nTicks; - float fMsStart = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickIn); - float fMsEnd = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickOut); - if(fMsStart <= fMsEnd) - { - float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd * fMsToScreen; - float fYStart = (float)nY; - float fYEnd = fYStart + (MICROPROFILE_DETAILED_CONTEXT_SWITCH_HEIGHT); - uint32_t nColor = g_nMicroProfileContextSwitchThreadColors[CS.nCpu%MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS]; - float fXDist = MicroProfileMax(fXStart - fMouseX, fMouseX - fXEnd); - bool bHover = fXDist < MICROPROFILE_HOVER_DIST && fYStart <= fMouseY && fMouseY <= fYEnd && nBaseY < fMouseY; - if(bHover) - { - UI.nRangeBegin = nTickIn; - UI.nRangeEnd = nTickOut; - S.nContextSwitchHoverTickIn = nTickIn; - S.nContextSwitchHoverTickOut = nTickOut; - S.nContextSwitchHoverThread = CS.nThreadOut; - S.nContextSwitchHoverThreadBefore = nThreadBefore; - S.nContextSwitchHoverThreadAfter = CS.nThreadIn; - S.nContextSwitchHoverCpuNext = CS.nCpu; - nColor = UI.nHoverColor; - } - if(CS.nCpu == S.nContextSwitchHoverCpu) - { - nColor = UI.nHoverColorShared; - } - MicroProfileDrawBox(fXStart, fYStart, fXEnd, fYEnd, nColor|UI.nOpacityForeground, MicroProfileBoxTypeFlat); - } - nTickIn = -1; - } - } - } -} - -inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nBaseY, int nSelectedFrame) -{ - MicroProfile& S = *MicroProfileGet(); - MP_DEBUG_DUMP_RANGE(); - int nY = nBaseY - UI.nOffsetY; - - uint32_t nFrameNext = (S.nFrameCurrent+1) % MICROPROFILE_MAX_FRAME_HISTORY; - MicroProfileFrameState* pFrameCurrent = &S.Frames[S.nFrameCurrent]; - MicroProfileFrameState* pFrameNext = &S.Frames[nFrameNext]; - - UI.nRangeBegin = 0; - UI.nRangeEnd = 0; - UI.nRangeBeginGpu = 0; - UI.nRangeEndGpu = 0; - UI.nRangeBeginIndex = UI.nRangeEndIndex = 0; - UI.pRangeLog = 0; - int64_t nFrameStartCpu = pFrameCurrent->nFrameStartCpu; - int64_t nFrameStartGpu = pFrameCurrent->nFrameStartGpu; - int64_t nTicksPerSecondCpu = MicroProfileTicksPerSecondCpu(); - int64_t nTicksPerSecondGpu = MicroProfileTicksPerSecondGpu(); - float fToMsCpu = MicroProfileTickToMsMultiplier(nTicksPerSecondCpu); - float fToMsGpu = MicroProfileTickToMsMultiplier(nTicksPerSecondGpu); - - float fDetailedOffset = UI.fDetailedOffset; - float fDetailedRange = UI.fDetailedRange; - - - int64_t nDetailedOffsetTicksCpu = MicroProfileMsToTick(fDetailedOffset, MicroProfileTicksPerSecondCpu()); - int64_t nDetailedOffsetTicksGpu = MicroProfileMsToTick(fDetailedOffset, MicroProfileTicksPerSecondGpu()); - int64_t nBaseTicksCpu = nDetailedOffsetTicksCpu + nFrameStartCpu; - int64_t nBaseTicksGpu = nDetailedOffsetTicksGpu + nFrameStartGpu; - int64_t nBaseTicksEndCpu = nBaseTicksCpu + MicroProfileMsToTick(fDetailedRange, MicroProfileTicksPerSecondCpu()); - - int64_t nTickReferenceCpu = 0, nTickReferenceGpu = 0; - static int64_t nRefCpu = 0, nRefGpu = 0; - if(MicroProfileGetGpuTickReference(&nTickReferenceCpu, &nTickReferenceGpu)) - { - if(0 == nRefCpu || std::abs(nRefCpu-nBaseTicksCpu) > std::abs(nTickReferenceCpu-nBaseTicksCpu)) - { - nRefCpu = nTickReferenceCpu; - nRefGpu = nTickReferenceGpu; - } - else - { - nTickReferenceCpu = nRefCpu; - nTickReferenceGpu = nRefGpu; - } - nBaseTicksGpu = (nBaseTicksCpu - nTickReferenceCpu) * nTicksPerSecondGpu / nTicksPerSecondCpu + nTickReferenceGpu; - } - int64_t nBaseTicksEndGpu = nBaseTicksCpu + MicroProfileMsToTick(fDetailedRange, MicroProfileTicksPerSecondCpu()); - - MicroProfileFrameState* pFrameFirst = pFrameCurrent; - int64_t nGapTime = MicroProfileTicksPerSecondCpu() * MICROPROFILE_GAP_TIME / 1000; - for(uint32_t i = 0; i < MICROPROFILE_MAX_FRAME_HISTORY - MICROPROFILE_GPU_FRAME_DELAY; ++i) - { - uint32_t nNextIndex = (S.nFrameCurrent + MICROPROFILE_MAX_FRAME_HISTORY - i) % MICROPROFILE_MAX_FRAME_HISTORY; - pFrameFirst = &S.Frames[nNextIndex]; - if(pFrameFirst->nFrameStartCpu <= nBaseTicksCpu-nGapTime) - break; - } - - float fMsBase = fToMsCpu * nDetailedOffsetTicksCpu; - float fMs = fDetailedRange; - float fMsEnd = fMs + fMsBase; - float fWidth = (float)nWidth; - float fMsToScreen = fWidth / fMs; - - { - float fRate = floor(2*(log10(fMs)-1))/2; - float fStep = powf(10.f, fRate); - float fRcpStep = 1.f / fStep; - int nColorIndex = (int)(floor(fMsBase*fRcpStep)); - float fStart = floor(fMsBase*fRcpStep) * fStep; - for(float f = fStart; f < fMsEnd; ) - { - float fNext = f + fStep; - MicroProfileDrawBox(((f-fMsBase) * fMsToScreen), nBaseY, (fNext-fMsBase) * fMsToScreen+1, nBaseY + nHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[nColorIndex++ & 1]); - f = fNext; - } - } - - nY += MICROPROFILE_TEXT_HEIGHT+1; - MicroProfileLogEntry* pMouseOver = UI.pDisplayMouseOver; - MicroProfileLogEntry* pMouseOverNext = 0; - uint64_t nMouseOverToken = pMouseOver ? MicroProfileLogTimerIndex(*pMouseOver) : MICROPROFILE_INVALID_TOKEN; - float fMouseX = (float)UI.nMouseX; - float fMouseY = (float)UI.nMouseY; - uint64_t nHoverToken = MICROPROFILE_INVALID_TOKEN; - int64_t nHoverTime = 0; - - static int nHoverCounter = 155; - static int nHoverCounterDelta = 10; - nHoverCounter += nHoverCounterDelta; - if(nHoverCounter >= 245) - nHoverCounterDelta = -10; - else if(nHoverCounter < 100) - nHoverCounterDelta = 10; - UI.nHoverColor = (nHoverCounter<<24)|(nHoverCounter<<16)|(nHoverCounter<<8)|nHoverCounter; - uint32_t nHoverCounterShared = nHoverCounter>>2; - UI.nHoverColorShared = (nHoverCounterShared<<24)|(nHoverCounterShared<<16)|(nHoverCounterShared<<8)|nHoverCounterShared; - - uint32_t nLinesDrawn[MICROPROFILE_STACK_MAX]={0}; - - uint32_t nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadAfter; - uint32_t nContextSwitchHoverThreadBefore = S.nContextSwitchHoverThreadBefore; - S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX; - - uint32_t nContextSwitchStart = UINT32_MAX; - uint32_t nContextSwitchEnd = UINT32_MAX; - S.nContextSwitchHoverCpuNext = 0xff; - S.nContextSwitchHoverTickIn = -1; - S.nContextSwitchHoverTickOut = -1; - if(S.bContextSwitchRunning) - { - MicroProfileContextSwitchSearch(&nContextSwitchStart, &nContextSwitchEnd, nBaseTicksCpu, nBaseTicksEndCpu); - } - - bool bSkipBarView = S.bContextSwitchRunning && S.bContextSwitchNoBars; - - if(!bSkipBarView) - { - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - MicroProfileThreadLog* pLog = S.Pool[i]; - if(!pLog) - continue; - - uint32_t nPut = pFrameNext->nLogStart[i]; - ///note: this may display new samples as old data, but this will only happen when - // unpaused, where the detailed view is hardly perceptible - uint32_t nFront = S.Pool[i]->nPut.load(std::memory_order_relaxed); - MicroProfileFrameState* pFrameLogFirst = pFrameCurrent; - MicroProfileFrameState* pFrameLogLast = pFrameNext; - uint32_t nGet = pFrameLogFirst->nLogStart[i]; - do - { - MP_ASSERT(pFrameLogFirst >= &S.Frames[0] && pFrameLogFirst < &S.Frames[MICROPROFILE_MAX_FRAME_HISTORY]); - uint32_t nNewGet = pFrameLogFirst->nLogStart[i]; - bool bIsValid = false; - if(nPut < nFront) - { - bIsValid = nNewGet <= nPut || nNewGet >= nFront; - } - else - { - bIsValid = nNewGet <= nPut && nNewGet >= nFront; - } - if(bIsValid) - { - nGet = nNewGet; - pFrameLogFirst--; - if(pFrameLogFirst < &S.Frames[0]) - pFrameLogFirst = &S.Frames[MICROPROFILE_MAX_FRAME_HISTORY-1]; - } - else - { - break; - } - }while(pFrameLogFirst != pFrameFirst); - - - if (nGet == UINT32_MAX) { - continue; - } - MP_ASSERT(nGet != UINT32_MAX); - - nPut = pFrameLogLast->nLogStart[i]; - - uint32_t nRange[2][2] = { {0, 0}, {0, 0}, }; - - MicroProfileGetRange(nPut, nGet, nRange); - if(nPut == nGet) - continue; - uint32_t nMaxStackDepth = 0; - - bool bGpu = pLog->nGpu != 0; - float fToMs = bGpu ? fToMsGpu : fToMsCpu; - int64_t nBaseTicks = bGpu ? nBaseTicksGpu : nBaseTicksCpu; - char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16]; - uint64_t nThreadId = pLog->nThreadId; - snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s", nThreadId, &pLog->ThreadName[0] ); - nY += 3; - uint32_t nThreadColor = UINT32_MAX; - if(pLog->nThreadId == nContextSwitchHoverThreadAfter || pLog->nThreadId == nContextSwitchHoverThreadBefore) - nThreadColor = UI.nHoverColorShared|0x906060; - MicroProfileDrawText(0, nY, nThreadColor, &ThreadName[0], (uint32_t)strlen(&ThreadName[0])); - nY += 3; - nY += MICROPROFILE_TEXT_HEIGHT + 1; - - if(S.bContextSwitchRunning) - { - MicroProfileDrawDetailedContextSwitchBars(nY, pLog->nThreadId, nContextSwitchStart, nContextSwitchEnd, nBaseTicks, nBaseY); - nY -= MICROPROFILE_DETAILED_BAR_HEIGHT; - nY += MICROPROFILE_DETAILED_CONTEXT_SWITCH_HEIGHT+1; - } - - uint32_t nYDelta = MICROPROFILE_DETAILED_BAR_HEIGHT; - uint32_t nStack[MICROPROFILE_STACK_MAX]; - uint32_t nStackPos = 0; - for(uint32_t j = 0; j < 2; ++j) - { - uint32_t nStart = nRange[j][0]; - uint32_t nEnd = nRange[j][1]; - for(uint32_t k = nStart; k < nEnd; ++k) - { - MicroProfileLogEntry* pEntry = &pLog->Log[k]; - int nType = MicroProfileLogType(*pEntry); - if(MP_LOG_ENTER == nType) - { - MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); - nStack[nStackPos++] = k; - } - else if(MP_LOG_META == nType) - { - - } - else if(MP_LOG_LEAVE == nType) - { - if(0 == nStackPos) - { - continue; - } - - MicroProfileLogEntry* pEntryEnter = &pLog->Log[nStack[nStackPos-1]]; - if(MicroProfileLogTimerIndex(*pEntryEnter) != MicroProfileLogTimerIndex(*pEntry)) - { - //uprintf("mismatch %llx %llx\n", pEntryEnter->nToken, pEntry->nToken); - continue; - } - int64_t nTickStart = MicroProfileLogGetTick(*pEntryEnter); - int64_t nTickEnd = MicroProfileLogGetTick(*pEntry); - uint64_t nTimerIndex = MicroProfileLogTimerIndex(*pEntry); - uint32_t nColor = S.TimerInfo[nTimerIndex].nColor; - if(nMouseOverToken == nTimerIndex) - { - if(pEntry == pMouseOver) - { - nColor = UI.nHoverColor; - if(bGpu) - { - UI.nRangeBeginGpu = *pEntryEnter; - UI.nRangeEndGpu = *pEntry; - uint32_t nCpuBegin = (nStack[nStackPos-1] + 1) % MICROPROFILE_BUFFER_SIZE; - uint32_t nCpuEnd = (k + 1) % MICROPROFILE_BUFFER_SIZE; - MicroProfileLogEntry LogCpuBegin = pLog->Log[nCpuBegin]; - MicroProfileLogEntry LogCpuEnd = pLog->Log[nCpuEnd]; - if(MicroProfileLogType(LogCpuBegin)==3 && MicroProfileLogType(LogCpuEnd) == 3) - { - UI.nRangeBegin = LogCpuBegin; - UI.nRangeEnd = LogCpuEnd; - } - UI.nRangeBeginIndex = nStack[nStackPos-1]; - UI.nRangeEndIndex = k; - UI.pRangeLog = pLog; - } - else - { - UI.nRangeBegin = *pEntryEnter; - UI.nRangeEnd = *pEntry; - UI.nRangeBeginIndex = nStack[nStackPos-1]; - UI.nRangeEndIndex = k; - UI.pRangeLog = pLog; - - } - } - else - { - nColor = UI.nHoverColorShared; - } - } - - nMaxStackDepth = MicroProfileMax(nMaxStackDepth, nStackPos); - float fMsStart = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickStart); - float fMsEnd2 = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickEnd); - float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd2 * fMsToScreen; - float fYStart = (float)(nY + nStackPos * nYDelta); - float fYEnd = fYStart + (MICROPROFILE_DETAILED_BAR_HEIGHT); - float fXDist = MicroProfileMax(fXStart - fMouseX, fMouseX - fXEnd); - bool bHover = fXDist < MICROPROFILE_HOVER_DIST && fYStart <= fMouseY && fMouseY <= fYEnd && nBaseY < fMouseY; - uint32_t nIntegerWidth = (uint32_t)(fXEnd - fXStart); - if(nIntegerWidth) - { - if(bHover && UI.nActiveMenu == UINT32_MAX) - { - nHoverToken = MicroProfileLogTimerIndex(*pEntry); - #if MICROPROFILE_DEBUG - UI.nHoverAddressEnter = (uint64_t)pEntryEnter; - UI.nHoverAddressLeave = (uint64_t)pEntry; - #endif - nHoverTime = MicroProfileLogTickDifference(nTickStart, nTickEnd); - pMouseOverNext = pEntry; - } - - MicroProfileDrawBox(fXStart, fYStart, fXEnd, fYEnd, nColor|UI.nOpacityForeground, MicroProfileBoxTypeBar); -#if MICROPROFILE_DETAILED_BAR_NAMES - if(nIntegerWidth>3*MICROPROFILE_TEXT_WIDTH) - { - float fXStartText = MicroProfileMax(fXStart, 0.f); - int nTextWidth = (int)(fXEnd - fXStartText); - int nCharacters = (nTextWidth - 2*MICROPROFILE_TEXT_WIDTH) / MICROPROFILE_TEXT_WIDTH; - if(nCharacters>0) - { - MicroProfileDrawText(fXStartText + 1, fYStart + 1, UINT32_MAX, S.TimerInfo[nTimerIndex].pName, MicroProfileMin(S.TimerInfo[nTimerIndex].nNameLen, nCharacters)); - } - } -#endif - } - else - { - float fXAvg = 0.5f * (fXStart + fXEnd); - int nLineX = (int)floor(fXAvg+0.5f); - if(nLineX != (int)nLinesDrawn[nStackPos]) - { - if(bHover && UI.nActiveMenu == UINT32_MAX) - { - nHoverToken = (uint32_t)MicroProfileLogTimerIndex(*pEntry); - nHoverTime = MicroProfileLogTickDifference(nTickStart, nTickEnd); - pMouseOverNext = pEntry; - } - nLinesDrawn[nStackPos] = nLineX; - MicroProfileDrawLineVertical(nLineX, fYStart + 0.5f, fYEnd + 0.5f, nColor|UI.nOpacityForeground); - } - } - nStackPos--; - if(0 == nStackPos) - { - if(bGpu ? (nTickStart > nBaseTicksEndGpu) : (nTickStart > nBaseTicksEndCpu)) - { - break; - } - } - } - } - } - nY += nMaxStackDepth * nYDelta + MICROPROFILE_DETAILED_BAR_HEIGHT+1; - } - } - if(S.bContextSwitchRunning && (S.bContextSwitchAllThreads||S.bContextSwitchNoBars)) - { - uint32_t nNumThreads = 0; - uint32_t nThreads[MICROPROFILE_MAX_CONTEXT_SWITCH_THREADS]; - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS && S.Pool[i]; ++i) - nThreads[nNumThreads++] = S.Pool[i]->nThreadId; - uint32_t nNumThreadsBase = nNumThreads; - if(S.bContextSwitchAllThreads) - { - for(uint32_t i = nContextSwitchStart; i != nContextSwitchEnd; i = (i+1) % MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE) - { - MicroProfileContextSwitch CS = S.ContextSwitch[i]; - ThreadIdType nThreadId = CS.nThreadIn; - if(nThreadId) - { - bool bSeen = false; - for(uint32_t j = 0; j < nNumThreads; ++j) - { - if(nThreads[j] == nThreadId) - { - bSeen = true; - break; - } - } - if(!bSeen) - { - nThreads[nNumThreads++] = nThreadId; - } - } - if(nNumThreads == MICROPROFILE_MAX_CONTEXT_SWITCH_THREADS) - { - S.nOverflow = 10; - break; - } - } - std::sort(&nThreads[nNumThreadsBase], &nThreads[nNumThreads]); - } - uint32_t nStart = nNumThreadsBase; - if(S.bContextSwitchNoBars) - nStart = 0; - for(uint32_t i = nStart; i < nNumThreads; ++i) - { - ThreadIdType nThreadId = nThreads[i]; - if(nThreadId) - { - char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16]; - const char* cLocal = MicroProfileIsLocalThread(nThreadId) ? "*": " "; - -#if defined(_WIN32) - // nThreadId is 32-bit on Windows - int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); -#else - int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); -#endif - uint32_t nThreadColor = UINT32_MAX; - if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore) - nThreadColor = UI.nHoverColorShared|0x906060; - MicroProfileDrawDetailedContextSwitchBars(nY+2, nThreadId, nContextSwitchStart, nContextSwitchEnd, nBaseTicksCpu, nBaseY); - MicroProfileDrawText(0, nY, nThreadColor, &ThreadName[0], nStrLen); - nY += MICROPROFILE_TEXT_HEIGHT+1; - } - } - } - - S.nContextSwitchHoverCpu = S.nContextSwitchHoverCpuNext; - - UI.pDisplayMouseOver = pMouseOverNext; - - if(!S.nRunning) - { - if(nHoverToken != MICROPROFILE_INVALID_TOKEN && nHoverTime) - { - UI.nHoverToken = nHoverToken; - UI.nHoverTime = nHoverTime; - } - - if(nSelectedFrame != -1) - { - UI.nRangeBegin = S.Frames[nSelectedFrame].nFrameStartCpu; - UI.nRangeEnd = S.Frames[(nSelectedFrame+1)%MICROPROFILE_MAX_FRAME_HISTORY].nFrameStartCpu; - UI.nRangeBeginGpu = S.Frames[nSelectedFrame].nFrameStartGpu; - UI.nRangeEndGpu = S.Frames[(nSelectedFrame+1)%MICROPROFILE_MAX_FRAME_HISTORY].nFrameStartGpu; - } - if(UI.nRangeBegin != UI.nRangeEnd) - { - float fMsStart = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeBegin); - float fMsEnd3 = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeEnd); - float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd3 * fMsToScreen; - MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT, MicroProfileBoxTypeFlat); - MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); - MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); - - fMsStart += fDetailedOffset; - fMsEnd3 += fDetailedOffset; - char sBuffer[32]; - uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); - float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); - float fStartTextX = fXStart - fStartTextWidth - 2; - MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); - uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd3); - MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); - - if(UI.nMouseRight) - { - MicroProfileZoomTo(UI.nRangeBegin, UI.nRangeEnd); - } - } - - if(UI.nRangeBeginGpu != UI.nRangeEndGpu) - { - float fMsStart = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeBeginGpu); - float fMsEnd4 = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeEndGpu); - float fXStart = fMsStart * fMsToScreen; - float fXEnd = fMsEnd4 * fMsToScreen; - MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU, MicroProfileBoxTypeFlat); - MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); - MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); - - nBaseY += MICROPROFILE_TEXT_HEIGHT+1; - - fMsStart += fDetailedOffset; - fMsEnd4 += fDetailedOffset; - char sBuffer[32]; - uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); - float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); - float fStartTextX = fXStart - fStartTextWidth - 2; - MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); - uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd4); - MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); - } - } -} - - -inline void MicroProfileDrawDetailedFrameHistory(uint32_t nWidth, uint32_t nHeight, uint32_t nBaseY, uint32_t nSelectedFrame) -{ - MicroProfile& S = *MicroProfileGet(); - - const uint32_t nBarHeight = MICROPROFILE_FRAME_HISTORY_HEIGHT; - float fBaseX = (float)nWidth; - float fDx = fBaseX / MICROPROFILE_NUM_FRAMES; - - uint32_t nLastIndex = (S.nFrameCurrent+1) % MICROPROFILE_MAX_FRAME_HISTORY; - MicroProfileDrawBox(0, nBaseY, nWidth, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, 0xff000000 | g_nMicroProfileBackColors[0], MicroProfileBoxTypeFlat); - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()) * S.fRcpReferenceTime; - float fToMsGpu = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondGpu()) * S.fRcpReferenceTime; - - - MicroProfileFrameState* pFrameCurrent = &S.Frames[S.nFrameCurrent]; - uint64_t nFrameStartCpu = pFrameCurrent->nFrameStartCpu; - int64_t nDetailedOffsetTicksCpu = MicroProfileMsToTick(UI.fDetailedOffset, MicroProfileTicksPerSecondCpu()); - int64_t nCpuStart = nDetailedOffsetTicksCpu + nFrameStartCpu; - int64_t nCpuEnd = nCpuStart + MicroProfileMsToTick(UI.fDetailedRange, MicroProfileTicksPerSecondCpu());; - - - float fSelectionStart = (float)nWidth; - float fSelectionEnd = 0.f; - for(uint32_t i = 0; i < MICROPROFILE_NUM_FRAMES; ++i) - { - uint32_t nIndex = (S.nFrameCurrent + MICROPROFILE_MAX_FRAME_HISTORY - i) % MICROPROFILE_MAX_FRAME_HISTORY; - MicroProfileFrameState* pCurrent = &S.Frames[nIndex]; - MicroProfileFrameState* pNext = &S.Frames[nLastIndex]; - - int64_t nTicks = pNext->nFrameStartCpu - pCurrent->nFrameStartCpu; - int64_t nTicksGpu = pNext->nFrameStartGpu - pCurrent->nFrameStartGpu; - float fScale = fToMs * nTicks; - float fScaleGpu = fToMsGpu * nTicksGpu; - fScale = fScale > 1.f ? 0.f : 1.f - fScale; - fScaleGpu = fScaleGpu > 1.f ? 0.f : 1.f - fScaleGpu; - float fXEnd = fBaseX; - float fXStart = fBaseX - fDx; - fBaseX = fXStart; - uint32_t nColor = MICROPROFILE_FRAME_HISTORY_COLOR_CPU; - if(nIndex == nSelectedFrame) - nColor = UINT32_MAX; - MicroProfileDrawBox(fXStart, nBaseY + fScale * nBarHeight, fXEnd, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, nColor, MicroProfileBoxTypeBar); - if(pNext->nFrameStartCpu > nCpuStart) - { - fSelectionStart = fXStart; - } - if(pCurrent->nFrameStartCpu < nCpuEnd && fSelectionEnd == 0.f) - { - fSelectionEnd = fXEnd; - } - nLastIndex = nIndex; - } - MicroProfileDrawBox(fSelectionStart, nBaseY, fSelectionEnd, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, MICROPROFILE_FRAME_HISTORY_COLOR_HIGHTLIGHT, MicroProfileBoxTypeFlat); -} -inline void MicroProfileDrawDetailedView(uint32_t nWidth, uint32_t nHeight) -{ - MicroProfile& S = *MicroProfileGet(); - - MICROPROFILE_SCOPE(g_MicroProfileDetailed); - uint32_t nBaseY = MICROPROFILE_TEXT_HEIGHT + 1; - - int nSelectedFrame = -1; - if(UI.nMouseY > nBaseY && UI.nMouseY <= nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT && UI.nActiveMenu == UINT32_MAX) - { - - nSelectedFrame = ((MICROPROFILE_NUM_FRAMES) * (UI.nWidth-UI.nMouseX) / UI.nWidth); - nSelectedFrame = (S.nFrameCurrent + MICROPROFILE_MAX_FRAME_HISTORY - nSelectedFrame) % MICROPROFILE_MAX_FRAME_HISTORY; - UI.nHoverFrame = nSelectedFrame; - if(UI.nMouseRight) - { - int64_t nRangeBegin = S.Frames[nSelectedFrame].nFrameStartCpu; - int64_t nRangeEnd = S.Frames[(nSelectedFrame+1)%MICROPROFILE_MAX_FRAME_HISTORY].nFrameStartCpu; - MicroProfileZoomTo(nRangeBegin, nRangeEnd); - } - if(UI.nMouseDownLeft) - { - uint64_t nFrac = (1024 * (MICROPROFILE_NUM_FRAMES) * (UI.nMouseX) / UI.nWidth) % 1024; - int64_t nRangeBegin = S.Frames[nSelectedFrame].nFrameStartCpu; - int64_t nRangeEnd = S.Frames[(nSelectedFrame+1)%MICROPROFILE_MAX_FRAME_HISTORY].nFrameStartCpu; - MicroProfileCenter(nRangeBegin + (nRangeEnd-nRangeBegin) * nFrac / 1024); - } - } - else - { - UI.nHoverFrame = -1; - } - - MicroProfileDrawDetailedBars(nWidth, nHeight, nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT, nSelectedFrame); - MicroProfileDrawDetailedFrameHistory(nWidth, nHeight, nBaseY, nSelectedFrame); -} - -inline void MicroProfileDrawTextRight(uint32_t nX, uint32_t nY, uint32_t nColor, const char* pStr, uint32_t nStrLen) -{ - MicroProfileDrawText(nX - nStrLen * (MICROPROFILE_TEXT_WIDTH+1), nY, nColor, pStr, nStrLen); -} -inline void MicroProfileDrawHeader(int32_t nX, uint32_t nWidth, const char* pName) -{ - if(pName) - { - MicroProfileDrawBox(nX-8, MICROPROFILE_TEXT_HEIGHT + 2, nX + nWidth+5, MICROPROFILE_TEXT_HEIGHT + 2 + (MICROPROFILE_TEXT_HEIGHT+1), 0xff000000|g_nMicroProfileBackColors[1]); - MicroProfileDrawText(nX, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, pName, (uint32_t)strlen(pName)); - } -} - - -typedef void (*MicroProfileLoopGroupCallback)(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pData); - -inline void MicroProfileLoopActiveGroupsDraw(int32_t nX, int32_t nY, const char* pName, MicroProfileLoopGroupCallback CB, void* pData) -{ - MicroProfile& S = *MicroProfileGet(); - nY += MICROPROFILE_TEXT_HEIGHT + 2; - uint64_t nGroup = S.nAllGroupsWanted ? S.nGroupMask : S.nActiveGroupWanted; - uint32_t nCount = 0; - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - uint64_t nMask = 1ULL << j; - if(nMask & nGroup) - { - nY += MICROPROFILE_TEXT_HEIGHT + 1; - for(uint32_t i = 0; i < S.nTotalTimers;++i) - { - uint64_t nTokenMask = MicroProfileGetGroupMask(S.TimerInfo[i].nToken); - if(nTokenMask & nMask) - { - if(nY >= 0) - CB(i, nCount, nMask, nX, nY, pData); - - nCount += 2; - nY += MICROPROFILE_TEXT_HEIGHT + 1; - - if(nY > (int)UI.nHeight) - return; - } - } - - } - } -} - - -inline void MicroProfileCalcTimers(float* pTimers, float* pAverage, float* pMax, float* pCallAverage, float* pExclusive, float* pAverageExclusive, float* pMaxExclusive, uint64_t nGroup, uint32_t nSize) -{ - MicroProfile& S = *MicroProfileGet(); - - uint32_t nCount = 0; - uint64_t nMask = 1; - - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - if(nMask & nGroup) - { - const float fToMs = MicroProfileTickToMsMultiplier(S.GroupInfo[j].Type == MicroProfileTokenTypeGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - for(uint32_t i = 0; i < S.nTotalTimers;++i) - { - uint64_t nTokenMask = MicroProfileGetGroupMask(S.TimerInfo[i].nToken); - if(nTokenMask & nMask) - { - { - uint32_t nTimer = i; - uint32_t nIdx = nCount; - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - uint32_t nAggregateCount = S.Aggregate[nTimer].nCount ? S.Aggregate[nTimer].nCount : 1; - float fToPrc = S.fRcpReferenceTime; - float fMs = fToMs * (S.Frame[nTimer].nTicks); - float fPrc = MicroProfileMin(fMs * fToPrc, 1.f); - float fAverageMs = fToMs * (S.Aggregate[nTimer].nTicks / nAggregateFrames); - float fAveragePrc = MicroProfileMin(fAverageMs * fToPrc, 1.f); - float fMaxMs = fToMs * (S.AggregateMax[nTimer]); - float fMaxPrc = MicroProfileMin(fMaxMs * fToPrc, 1.f); - float fCallAverageMs = fToMs * (S.Aggregate[nTimer].nTicks / nAggregateCount); - float fCallAveragePrc = MicroProfileMin(fCallAverageMs * fToPrc, 1.f); - float fMsExclusive = fToMs * (S.FrameExclusive[nTimer]); - float fPrcExclusive = MicroProfileMin(fMsExclusive * fToPrc, 1.f); - float fAverageMsExclusive = fToMs * (S.AggregateExclusive[nTimer] / nAggregateFrames); - float fAveragePrcExclusive = MicroProfileMin(fAverageMsExclusive * fToPrc, 1.f); - float fMaxMsExclusive = fToMs * (S.AggregateMaxExclusive[nTimer]); - float fMaxPrcExclusive = MicroProfileMin(fMaxMsExclusive * fToPrc, 1.f); - pTimers[nIdx] = fMs; - pTimers[nIdx+1] = fPrc; - pAverage[nIdx] = fAverageMs; - pAverage[nIdx+1] = fAveragePrc; - pMax[nIdx] = fMaxMs; - pMax[nIdx+1] = fMaxPrc; - pCallAverage[nIdx] = fCallAverageMs; - pCallAverage[nIdx+1] = fCallAveragePrc; - pExclusive[nIdx] = fMsExclusive; - pExclusive[nIdx+1] = fPrcExclusive; - pAverageExclusive[nIdx] = fAverageMsExclusive; - pAverageExclusive[nIdx+1] = fAveragePrcExclusive; - pMaxExclusive[nIdx] = fMaxMsExclusive; - pMaxExclusive[nIdx+1] = fMaxPrcExclusive; - } - nCount += 2; - } - } - } - nMask <<= 1; - } -} - -#define SBUF_MAX 32 - -inline void MicroProfileDrawBarArrayCallback(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pExtra) -{ - const uint32_t nHeight = MICROPROFILE_TEXT_HEIGHT; - const uint32_t nTextWidth = 6 * (1+MICROPROFILE_TEXT_WIDTH); - const float fWidth = (float)MICROPROFILE_BAR_WIDTH; - - float* pTimers = ((float**)pExtra)[0]; - float* pTimers2 = ((float**)pExtra)[1]; - MicroProfile& S = *MicroProfileGet(); - char sBuffer[SBUF_MAX]; - if (pTimers2 && pTimers2[nIdx] > 0.1f) - snprintf(sBuffer, SBUF_MAX-1, "%5.2f %3.1fx", pTimers[nIdx], pTimers[nIdx] / pTimers2[nIdx]); - else - snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pTimers[nIdx]); - if (!pTimers2) - MicroProfileDrawBox(nX + nTextWidth, nY, nX + nTextWidth + fWidth * pTimers[nIdx+1], nY + nHeight, UI.nOpacityForeground|S.TimerInfo[nTimer].nColor, MicroProfileBoxTypeBar); - MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, (uint32_t)strlen(sBuffer)); -} - - -inline uint32_t MicroProfileDrawBarArray(int32_t nX, int32_t nY, float* pTimers, const char* pName, uint32_t nTotalHeight, float* pTimers2 = NULL) -{ - const uint32_t nTextWidth = 6 * (1+MICROPROFILE_TEXT_WIDTH); - const uint32_t nWidth = MICROPROFILE_BAR_WIDTH; - - MicroProfileDrawLineVertical(nX-5, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); - float* pTimersArray[2] = {pTimers, pTimers2}; - MicroProfileLoopActiveGroupsDraw(nX, nY, pName, MicroProfileDrawBarArrayCallback, pTimersArray); - MicroProfileDrawHeader(nX, nTextWidth + nWidth, pName); - return nWidth + 5 + nTextWidth; - -} -inline void MicroProfileDrawBarCallCountCallback(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pExtra) -{ - MicroProfile& S = *MicroProfileGet(); - char sBuffer[SBUF_MAX]; - int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5d", S.Frame[nTimer].nCount);//fix - MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, nLen); -} - -inline uint32_t MicroProfileDrawBarCallCount(int32_t nX, int32_t nY, const char* pName) -{ - MicroProfileLoopActiveGroupsDraw(nX, nY, pName, MicroProfileDrawBarCallCountCallback, 0); - const uint32_t nTextWidth = 6 * MICROPROFILE_TEXT_WIDTH; - MicroProfileDrawHeader(nX, 5 + nTextWidth, pName); - return 5 + nTextWidth; -} - -struct MicroProfileMetaAverageArgs -{ - uint64_t* pCounters; - float fRcpFrames; -}; - -inline void MicroProfileDrawBarMetaAverageCallback(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pExtra) -{ - MicroProfileMetaAverageArgs* pArgs = (MicroProfileMetaAverageArgs*)pExtra; - uint64_t* pCounters = pArgs->pCounters; - float fRcpFrames = pArgs->fRcpFrames; - char sBuffer[SBUF_MAX]; - int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pCounters[nTimer] * fRcpFrames); - MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen); -} - -inline uint32_t MicroProfileDrawBarMetaAverage(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) -{ - if(!pName) - return 0; - MicroProfileDrawLineVertical(nX-5, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); - uint32_t nTextWidth = (1+MICROPROFILE_TEXT_WIDTH) * MicroProfileMax(6, (uint32_t)strlen(pName)); - float fRcpFrames = 1.f / (MicroProfileGet()->nAggregateFrames ? MicroProfileGet()->nAggregateFrames : 1); - MicroProfileMetaAverageArgs Args = {pCounters, fRcpFrames}; - MicroProfileLoopActiveGroupsDraw(nX + nTextWidth, nY, pName, MicroProfileDrawBarMetaAverageCallback, &Args); - MicroProfileDrawHeader(nX, 5 + nTextWidth, pName); - return 5 + nTextWidth; -} - - -inline void MicroProfileDrawBarMetaCountCallback(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pExtra) -{ - uint64_t* pCounters = (uint64_t*)pExtra; - char sBuffer[SBUF_MAX]; - int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5" PRIu64, pCounters[nTimer]); - MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen); -} - -inline uint32_t MicroProfileDrawBarMetaCount(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) -{ - if(!pName) - return 0; - - MicroProfileDrawLineVertical(nX-5, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); - uint32_t nTextWidth = (1+MICROPROFILE_TEXT_WIDTH) * MicroProfileMax(6, (uint32_t)strlen(pName)); - MicroProfileLoopActiveGroupsDraw(nX + nTextWidth, nY, pName, MicroProfileDrawBarMetaCountCallback, pCounters); - MicroProfileDrawHeader(nX, 5 + nTextWidth, pName); - return 5 + nTextWidth; -} - -inline void MicroProfileDrawBarLegendCallback(uint32_t nTimer, uint32_t nIdx, uint64_t nGroupMask, uint32_t nX, uint32_t nY, void* pExtra) -{ - MicroProfile& S = *MicroProfileGet(); - if (S.TimerInfo[nTimer].bGraph) - { - MicroProfileDrawText(nX, nY, S.TimerInfo[nTimer].nColor, ">", 1); - } - MicroProfileDrawTextRight(nX, nY, S.TimerInfo[nTimer].nColor, S.TimerInfo[nTimer].pName, (uint32_t)strlen(S.TimerInfo[nTimer].pName)); - if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT+1) - { - UI.nHoverToken = nTimer; - UI.nHoverTime = 0; - } -} - -inline uint32_t MicroProfileDrawBarLegend(int32_t nX, int32_t nY, uint32_t nTotalHeight, uint32_t nMaxWidth) -{ - MicroProfileDrawLineVertical(nX-5, nY, nTotalHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); - MicroProfileLoopActiveGroupsDraw(nMaxWidth, nY, 0, MicroProfileDrawBarLegendCallback, 0); - return nX; -} - -bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight) -{ - MicroProfile& S = *MicroProfileGet(); - - MICROPROFILE_SCOPE(g_MicroProfileDrawGraph); - bool bEnabled = false; - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - if(S.Graph[i].nToken != MICROPROFILE_INVALID_TOKEN) - bEnabled = true; - if(!bEnabled) - return false; - - uint32_t nX = nScreenWidth - MICROPROFILE_GRAPH_WIDTH; - uint32_t nY = nScreenHeight - MICROPROFILE_GRAPH_HEIGHT; - MicroProfileDrawBox(nX, nY, nX + MICROPROFILE_GRAPH_WIDTH, nY + MICROPROFILE_GRAPH_HEIGHT, 0x88000000 | g_nMicroProfileBackColors[0]); - bool bMouseOver = UI.nMouseX >= nX && UI.nMouseY >= nY; - float fMouseXPrc =(float(UI.nMouseX - nX)) / MICROPROFILE_GRAPH_WIDTH; - if(bMouseOver) - { - float fXAvg = fMouseXPrc * MICROPROFILE_GRAPH_WIDTH + nX; - MicroProfileDrawLineVertical(fXAvg, nY, nY + MICROPROFILE_GRAPH_HEIGHT, UINT32_MAX); - } - - - float fY = (float)nScreenHeight; - float fDX = MICROPROFILE_GRAPH_WIDTH * 1.f / MICROPROFILE_GRAPH_HISTORY; - float fDY = MICROPROFILE_GRAPH_HEIGHT; - uint32_t nPut = S.nGraphPut; - float* pGraphData = (float*)alloca(sizeof(float)* MICROPROFILE_GRAPH_HISTORY*2); - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - if(S.Graph[i].nToken != MICROPROFILE_INVALID_TOKEN) - { - uint32_t nGroupId = MicroProfileGetGroupIndex(S.Graph[i].nToken); - bool bGpu = S.GroupInfo[nGroupId].Type == MicroProfileTokenTypeGpu; - float fToMs = MicroProfileTickToMsMultiplier(bGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - float fToPrc = fToMs * S.fRcpReferenceTime * 3 / 4; - - float fX = (float)nX; - for(uint32_t j = 0; j < MICROPROFILE_GRAPH_HISTORY; ++j) - { - float fWeigth = MicroProfileMin(fToPrc * (S.Graph[i].nHistory[(j+nPut)%MICROPROFILE_GRAPH_HISTORY]), 1.f); - pGraphData[(j*2)] = fX; - pGraphData[(j*2)+1] = fY - fDY * fWeigth; - fX += fDX; - } - MicroProfileDrawLine2D(MICROPROFILE_GRAPH_HISTORY, pGraphData, S.TimerInfo[MicroProfileGetTimerIndex(S.Graph[i].nToken)].nColor); - } - } - { - float fY1 = 0.25f * MICROPROFILE_GRAPH_HEIGHT + nY; - float fY2 = 0.50f * MICROPROFILE_GRAPH_HEIGHT + nY; - float fY3 = 0.75f * MICROPROFILE_GRAPH_HEIGHT + nY; - MicroProfileDrawLineHorizontal(nX, nX + MICROPROFILE_GRAPH_WIDTH, fY1, 0xffdd4444); - MicroProfileDrawLineHorizontal(nX, nX + MICROPROFILE_GRAPH_WIDTH, fY2, 0xff000000| g_nMicroProfileBackColors[0]); - MicroProfileDrawLineHorizontal(nX, nX + MICROPROFILE_GRAPH_WIDTH, fY3, 0xff000000|g_nMicroProfileBackColors[0]); - - char buf[32]; - int nLen = snprintf(buf, sizeof(buf)-1, "%5.2fms", S.fReferenceTime); - MicroProfileDrawText(nX+1, fY1 - (2+MICROPROFILE_TEXT_HEIGHT), UINT32_MAX, buf, nLen); - } - - - - if(bMouseOver) - { - uint32_t pColors[MICROPROFILE_MAX_GRAPHS]; - MicroProfileStringArray Strings; - MicroProfileStringArrayClear(&Strings); - uint32_t nTextCount = 0; - uint32_t nGraphIndex = (S.nGraphPut + MICROPROFILE_GRAPH_HISTORY - int(MICROPROFILE_GRAPH_HISTORY*(1.f - fMouseXPrc))) % MICROPROFILE_GRAPH_HISTORY; - - uint32_t nMouseX = UI.nMouseX; - uint32_t nMouseY = UI.nMouseY + 20; - - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - if(S.Graph[i].nToken != MICROPROFILE_INVALID_TOKEN) - { - uint32_t nGroupId = MicroProfileGetGroupIndex(S.Graph[i].nToken); - bool bGpu = S.GroupInfo[nGroupId].Type == MicroProfileTokenTypeGpu; - float fToMs = MicroProfileTickToMsMultiplier(bGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - uint32_t nIndex = MicroProfileGetTimerIndex(S.Graph[i].nToken); - uint32_t nColor = S.TimerInfo[nIndex].nColor; - const char* pName = S.TimerInfo[nIndex].pName; - pColors[nTextCount++] = nColor; - MicroProfileStringArrayAddLiteral(&Strings, pName); - MicroProfileStringArrayFormat(&Strings, "%5.2fms", fToMs * (S.Graph[i].nHistory[nGraphIndex])); - } - } - if(nTextCount) - { - MicroProfileDrawFloatWindow(nMouseX, nMouseY, Strings.ppStrings, Strings.nNumStrings, 0, pColors); - } - - if(UI.nMouseRight) - { - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - } - } - } - - return bMouseOver; -} - -void MicroProfileDumpTimers() -{ - MicroProfile& S = *MicroProfileGet(); - - uint64_t nActiveGroup = S.nGroupMask; - - uint32_t nNumTimers = S.nTotalTimers; - uint32_t nBlockSize = 2 * nNumTimers; - float* pTimers = (float*)alloca(nBlockSize * 7 * sizeof(float)); - float* pAverage = pTimers + nBlockSize; - float* pMax = pTimers + 2 * nBlockSize; - float* pCallAverage = pTimers + 3 * nBlockSize; - float* pTimersExclusive = pTimers + 4 * nBlockSize; - float* pAverageExclusive = pTimers + 5 * nBlockSize; - float* pMaxExclusive = pTimers + 6 * nBlockSize; - MicroProfileCalcTimers(pTimers, pAverage, pMax, pCallAverage, pTimersExclusive, pAverageExclusive, pMaxExclusive, nActiveGroup, nNumTimers); - - MICROPROFILE_PRINTF("%11s, ", "Time"); - MICROPROFILE_PRINTF("%11s, ", "Average"); - MICROPROFILE_PRINTF("%11s, ", "Max"); - MICROPROFILE_PRINTF("%11s, ", "Call Avg"); - MICROPROFILE_PRINTF("%9s, ", "Count"); - MICROPROFILE_PRINTF("%11s, ", "Excl"); - MICROPROFILE_PRINTF("%11s, ", "Avg Excl"); - MICROPROFILE_PRINTF("%11s, \n", "Max Excl"); - - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - uint64_t nMask = 1ULL << j; - if(nMask & nActiveGroup) - { - MICROPROFILE_PRINTF("%s\n", S.GroupInfo[j].pName); - for(uint32_t i = 0; i < S.nTotalTimers;++i) - { - uint64_t nTokenMask = MicroProfileGetGroupMask(S.TimerInfo[i].nToken); - if(nTokenMask & nMask) - { - uint32_t nIdx = i * 2; - MICROPROFILE_PRINTF("%9.2fms, ", pTimers[nIdx]); - MICROPROFILE_PRINTF("%9.2fms, ", pAverage[nIdx]); - MICROPROFILE_PRINTF("%9.2fms, ", pMax[nIdx]); - MICROPROFILE_PRINTF("%9.2fms, ", pCallAverage[nIdx]); - MICROPROFILE_PRINTF("%9d, ", S.Frame[i].nCount); - MICROPROFILE_PRINTF("%9.2fms, ", pTimersExclusive[nIdx]); - MICROPROFILE_PRINTF("%9.2fms, ", pAverageExclusive[nIdx]); - MICROPROFILE_PRINTF("%9.2fms, ", pMaxExclusive[nIdx]); - MICROPROFILE_PRINTF("%s\n", S.TimerInfo[i].pName); - } - } - } - } -} - -inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeight) -{ - MicroProfile& S = *MicroProfileGet(); - - uint64_t nActiveGroup = S.nAllGroupsWanted ? S.nGroupMask : S.nActiveGroupWanted; - if(!nActiveGroup) - return; - MICROPROFILE_SCOPE(g_MicroProfileDrawBarView); - - const uint32_t nHeight = MICROPROFILE_TEXT_HEIGHT; - int nColorIndex = 0; - uint32_t nMaxTimerNameLen = 1; - uint32_t nNumTimers = 0; - uint32_t nNumGroups = 0; - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - if(nActiveGroup & (1ULL << j)) - { - nNumTimers += S.GroupInfo[j].nNumTimers; - nNumGroups += 1; - nMaxTimerNameLen = MicroProfileMax(nMaxTimerNameLen, S.GroupInfo[j].nMaxTimerNameLen); - } - } - uint32_t nTimerWidth = 2+(4+nMaxTimerNameLen) * (MICROPROFILE_TEXT_WIDTH+1); - uint32_t nX = nTimerWidth + UI.nOffsetX; - uint32_t nY = nHeight + 3 - UI.nOffsetY; - uint32_t nBlockSize = 2 * nNumTimers; - float* pTimers = (float*)alloca(nBlockSize * 7 * sizeof(float)); - float* pAverage = pTimers + nBlockSize; - float* pMax = pTimers + 2 * nBlockSize; - float* pCallAverage = pTimers + 3 * nBlockSize; - float* pTimersExclusive = pTimers + 4 * nBlockSize; - float* pAverageExclusive = pTimers + 5 * nBlockSize; - float* pMaxExclusive = pTimers + 6 * nBlockSize; - MicroProfileCalcTimers(pTimers, pAverage, pMax, pCallAverage, pTimersExclusive, pAverageExclusive, pMaxExclusive, nActiveGroup, nNumTimers); - uint32_t nWidth = 0; - { - uint32_t nMetaIndex = 0; - for(uint32_t i = 1; i ; i <<= 1) - { - if(S.nBars & i) - { - if(i >= MP_DRAW_META_FIRST) - { - if(nMetaIndex < MICROPROFILE_META_MAX && S.MetaCounters[nMetaIndex].pName) - { - uint32_t nStrWidth = static_cast(strlen(S.MetaCounters[nMetaIndex].pName)); - if(S.nBars & MP_DRAW_TIMERS) - nWidth += 6 + (1+MICROPROFILE_TEXT_WIDTH) * (nStrWidth); - if(S.nBars & MP_DRAW_AVERAGE) - nWidth += 6 + (1+MICROPROFILE_TEXT_WIDTH) * (nStrWidth + 4); - if(S.nBars & MP_DRAW_MAX) - nWidth += 6 + (1+MICROPROFILE_TEXT_WIDTH) * (nStrWidth + 4); - } - } - else - { - nWidth += MICROPROFILE_BAR_WIDTH + 6 + 6 * (1+MICROPROFILE_TEXT_WIDTH); - if(i & MP_DRAW_CALL_COUNT) - nWidth += 6 + 6 * MICROPROFILE_TEXT_WIDTH; - } - } - if(i >= MP_DRAW_META_FIRST) - { - ++nMetaIndex; - } - } - nWidth += (1+nMaxTimerNameLen) * (MICROPROFILE_TEXT_WIDTH+1); - for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) - { - uint32_t nY0 = nY + i * (nHeight + 1); - bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); - MicroProfileDrawBox(nX, nY0, nWidth+nX, nY0 + (nHeight+1)+1, UI.nOpacityBackground | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); - } - nX += 10; - } - int nTotalHeight = (nNumTimers+nNumGroups+1) * (nHeight+1); - uint32_t nLegendOffset = 1; - if(S.nBars & MP_DRAW_TIMERS) - nX += MicroProfileDrawBarArray(nX, nY, pTimers, "Time", nTotalHeight) + 1; - if(S.nBars & MP_DRAW_AVERAGE) - nX += MicroProfileDrawBarArray(nX, nY, pAverage, "Average", nTotalHeight) + 1; - if(S.nBars & MP_DRAW_MAX) - nX += MicroProfileDrawBarArray(nX, nY, pMax, (!UI.bShowSpikes) ? "Max Time" : "Max Time, Spike", nTotalHeight, UI.bShowSpikes ? pAverage : NULL) + 1; - if(S.nBars & MP_DRAW_CALL_COUNT) - { - nX += MicroProfileDrawBarArray(nX, nY, pCallAverage, "Call Average", nTotalHeight) + 1; - nX += MicroProfileDrawBarCallCount(nX, nY, "Count") + 1; - } - if(S.nBars & MP_DRAW_TIMERS_EXCLUSIVE) - nX += MicroProfileDrawBarArray(nX, nY, pTimersExclusive, "Exclusive Time", nTotalHeight) + 1; - if(S.nBars & MP_DRAW_AVERAGE_EXCLUSIVE) - nX += MicroProfileDrawBarArray(nX, nY, pAverageExclusive, "Exclusive Average", nTotalHeight) + 1; - if(S.nBars & MP_DRAW_MAX_EXCLUSIVE) - nX += MicroProfileDrawBarArray(nX, nY, pMaxExclusive, (!UI.bShowSpikes) ? "Exclusive Max Time" :"Excl Max Time, Spike", nTotalHeight, UI.bShowSpikes ? pAverageExclusive : NULL) + 1; - - for(int i = 0; i < MICROPROFILE_META_MAX; ++i) - { - if(0 != (S.nBars & (MP_DRAW_META_FIRST<(strlen(S.MetaCounters[i].pName) + 32); - char* buffer = (char*)alloca(nBufferSize); - if(S.nBars & MP_DRAW_TIMERS) - nX += MicroProfileDrawBarMetaCount(nX, nY, &S.MetaCounters[i].nCounters[0], S.MetaCounters[i].pName, nTotalHeight) + 1; - if(S.nBars & MP_DRAW_AVERAGE) - { - snprintf(buffer, nBufferSize-1, "%s Avg", S.MetaCounters[i].pName); - nX += MicroProfileDrawBarMetaAverage(nX, nY, &S.MetaCounters[i].nAggregate[0], buffer, nTotalHeight) + 1; - } - if(S.nBars & MP_DRAW_MAX) - { - snprintf(buffer, nBufferSize-1, "%s Max", S.MetaCounters[i].pName); - nX += MicroProfileDrawBarMetaCount(nX, nY, &S.MetaCounters[i].nAggregateMax[0], buffer, nTotalHeight) + 1; - } - } - } - nX = 0; - nY = nHeight + 3 - UI.nOffsetY; - for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) - { - const uint32_t nY0 = nY + i * (nHeight + 1); - const bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); - MicroProfileDrawBox(nX, nY0, nTimerWidth, nY0 + (nHeight+1)+1, 0xff0000000 | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); - } - nX += MicroProfileDrawBarLegend(nX, nY, nTotalHeight, nTimerWidth-5) + 1; - - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - if(nActiveGroup & (1ULL << j)) - { - MicroProfileDrawText(nX, nY + (1+nHeight) * nLegendOffset, UINT32_MAX, S.GroupInfo[j].pName, S.GroupInfo[j].nNameLen); - nLegendOffset += S.GroupInfo[j].nNumTimers+1; - } - } - MicroProfileDrawHeader(nX, nTimerWidth-5, "Group"); - MicroProfileDrawTextRight(nTimerWidth-3, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, "Timer", 5); - MicroProfileDrawLineVertical(nTimerWidth, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); - MicroProfileDrawLineHorizontal(0, nWidth, 2*MICROPROFILE_TEXT_HEIGHT + 3, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); -} - -typedef const char* (*MicroProfileSubmenuCallback)(int, bool* bSelected); -typedef void (*MicroProfileClickCallback)(int); - - -inline const char* MicroProfileUIMenuMode(int nIndex, bool* bSelected) -{ - MicroProfile& S = *MicroProfileGet(); - switch(nIndex) - { - case 0: - *bSelected = S.nDisplay == MP_DRAW_DETAILED; - return "Detailed"; - case 1: - *bSelected = S.nDisplay == MP_DRAW_BARS; - return "Timers"; - case 2: - *bSelected = S.nDisplay == MP_DRAW_HIDDEN; - return "Hidden"; - case 3: - *bSelected = true; - return "Off"; - case 4: - *bSelected = true; - return "------"; - case 5: - *bSelected = S.nForceEnable != 0; - return "Force Enable"; - - default: return 0; - } -} - -inline const char* MicroProfileUIMenuGroups(int nIndex, bool* bSelected) -{ - MicroProfile& S = *MicroProfileGet(); - *bSelected = false; - if(nIndex == 0) - { - *bSelected = S.nAllGroupsWanted != 0; - return "[ALL]"; - } - else - { - nIndex = nIndex-1; - if(static_cast(nIndex) < UI.GroupMenuCount) - { - MicroProfileGroupMenuItem& Item = UI.GroupMenu[nIndex]; - static char buffer[MICROPROFILE_NAME_MAX_LEN+32]; - if(Item.nIsCategory) - { - uint64_t nGroupMask = S.CategoryInfo[Item.nIndex].nGroupMask; - *bSelected = nGroupMask == (nGroupMask & S.nActiveGroupWanted); - snprintf(buffer, sizeof(buffer)-1, "[%s]", Item.pName); - } - else - { - *bSelected = 0 != (S.nActiveGroupWanted & (1ULL << Item.nIndex)); - snprintf(buffer, sizeof(buffer)-1, " %s", Item.pName); - } - return buffer; - } - return 0; - } -} - -inline const char* MicroProfileUIMenuAggregate(int nIndex, bool* bSelected) -{ - MicroProfile& S = *MicroProfileGet(); - if(static_cast(nIndex) < g_MicroProfileAggregatePresets.size()) - { - uint32_t val = g_MicroProfileAggregatePresets[nIndex]; - *bSelected = S.nAggregateFlip == val; - if (0 == val) - { - return "Infinite"; - } - else - { - static char buf[128]; - snprintf(buf, sizeof(buf)-1, "%7u", val); - return buf; - } - } - return 0; - -} - -inline const char* MicroProfileUIMenuTimers(int nIndex, bool* bSelected) -{ - MicroProfile& S = *MicroProfileGet(); - *bSelected = 0 != (S.nBars & (1 << nIndex)); - switch(nIndex) - { - case 0: return "Time"; - case 1: return "Average"; - case 2: return "Max"; - case 3: return "Call Count"; - case 4: return "Exclusive Timers"; - case 5: return "Exclusive Average"; - case 6: return "Exclusive Max"; - } - int nMetaIndex = nIndex - 7; - if(nMetaIndex < MICROPROFILE_META_MAX) - { - return S.MetaCounters[nMetaIndex].pName; - } - return 0; -} - -inline const char* MicroProfileUIMenuOptions(int nIndex, bool* bSelected) -{ - MicroProfile& S = *MicroProfileGet(); - if(nIndex >= MICROPROFILE_OPTION_SIZE) return 0; - switch(UI.Options[nIndex].nSubType) - { - case 0: - *bSelected = S.fReferenceTime == g_MicroProfileReferenceTimePresets[UI.Options[nIndex].nIndex]; - break; - case 1: - *bSelected = UI.nOpacityBackground>>24 == g_MicroProfileOpacityPresets[UI.Options[nIndex].nIndex]; - break; - case 2: - *bSelected = UI.nOpacityForeground>>24 == g_MicroProfileOpacityPresets[UI.Options[nIndex].nIndex]; - break; - case 3: - *bSelected = UI.bShowSpikes; - break; -#if MICROPROFILE_CONTEXT_SWITCH_TRACE - case 4: - { - switch(UI.Options[nIndex].nIndex) - { - case 0: - *bSelected = S.bContextSwitchRunning; - break; - case 1: - *bSelected = S.bContextSwitchAllThreads; - break; - case 2: - *bSelected = S.bContextSwitchNoBars; - break; - } - } - break; -#endif - } - return UI.Options[nIndex].Text; -} - -inline const char* MicroProfileUIMenuPreset(int nIndex, bool* bSelected) -{ - static char buf[128]; - *bSelected = false; - int nNumPresets = static_cast(g_MicroProfilePresetNames.size()); - int nIndexSave = nIndex - nNumPresets - 1; - if (nIndex == nNumPresets) - { - return "--"; - } - else if(nIndexSave >=0 && nIndexSave < nNumPresets) - { - snprintf(buf, sizeof(buf)-1, "Save '%s'", g_MicroProfilePresetNames[nIndexSave]); - return buf; - } - else if(nIndex < nNumPresets) - { - snprintf(buf, sizeof(buf)-1, "Load '%s'", g_MicroProfilePresetNames[nIndex]); - return buf; - } - else - { - return 0; - } -} - -inline const char* MicroProfileUIMenuCustom(int nIndex, bool* bSelected) -{ - if(UINT32_MAX == UI.nCustomActive) - { - *bSelected = nIndex == 0; - } - else - { - *bSelected = nIndex-2 == static_cast(UI.nCustomActive); - } - switch(nIndex) - { - case 0: return "Disable"; - case 1: return "--"; - default: - nIndex -= 2; - if(static_cast(nIndex) < UI.nCustomCount) - { - return UI.Custom[nIndex].pName; - } - else - { - return 0; - } - } -} - -inline const char* MicroProfileUIMenuEmpty(int nIndex, bool* bSelected) -{ - return 0; -} - - -inline void MicroProfileUIClickMode(int nIndex) -{ - MicroProfile& S = *MicroProfileGet(); - switch(nIndex) - { - case 0: - S.nDisplay = MP_DRAW_DETAILED; - break; - case 1: - S.nDisplay = MP_DRAW_BARS; - break; - case 2: - S.nDisplay = MP_DRAW_HIDDEN; - break; - case 3: - S.nDisplay = 0; - break; - case 4: - break; - case 5: - S.nForceEnable = !S.nForceEnable; - break; - } -} - -inline void MicroProfileUIClickGroups(int nIndex) -{ - MicroProfile& S = *MicroProfileGet(); - if(nIndex == 0) - S.nAllGroupsWanted = 1-S.nAllGroupsWanted; - else - { - nIndex -= 1; - if(static_cast(nIndex) < UI.GroupMenuCount) - { - MicroProfileGroupMenuItem& Item = UI.GroupMenu[nIndex]; - if(Item.nIsCategory) - { - uint64_t nGroupMask = S.CategoryInfo[Item.nIndex].nGroupMask; - if(nGroupMask != (nGroupMask & S.nActiveGroupWanted)) - { - S.nActiveGroupWanted |= nGroupMask; - } - else - { - S.nActiveGroupWanted &= ~nGroupMask; - } - } - else - { - MP_ASSERT(Item.nIndex < S.nGroupCount); - S.nActiveGroupWanted ^= (1ULL << Item.nIndex); - } - } - } -} - -inline void MicroProfileUIClickAggregate(int nIndex) -{ - MicroProfile& S = *MicroProfileGet(); - S.nAggregateFlip = g_MicroProfileAggregatePresets[nIndex]; - if(0 == S.nAggregateFlip) - { - S.nAggregateClear = 1; - } -} - -inline void MicroProfileUIClickTimers(int nIndex) -{ - MicroProfile& S = *MicroProfileGet(); - S.nBars ^= (1 << nIndex); -} - -inline void MicroProfileUIClickOptions(int nIndex) -{ - MicroProfile& S = *MicroProfileGet(); - switch(UI.Options[nIndex].nSubType) - { - case 0: - S.fReferenceTime = g_MicroProfileReferenceTimePresets[UI.Options[nIndex].nIndex]; - S.fRcpReferenceTime = 1.f / S.fReferenceTime; - break; - case 1: - UI.nOpacityBackground = g_MicroProfileOpacityPresets[UI.Options[nIndex].nIndex]<<24; - break; - case 2: - UI.nOpacityForeground = g_MicroProfileOpacityPresets[UI.Options[nIndex].nIndex]<<24; - break; - case 3: - UI.bShowSpikes = !UI.bShowSpikes; - break; -#if MICROPROFILE_CONTEXT_SWITCH_TRACE - case 4: - { - switch(UI.Options[nIndex].nIndex) - { - case 0: - if(S.bContextSwitchRunning) - { - MicroProfileStopContextSwitchTrace(); - } - else - { - MicroProfileStartContextSwitchTrace(); - } - break; - case 1: - S.bContextSwitchAllThreads = !S.bContextSwitchAllThreads; - break; - case 2: - S.bContextSwitchNoBars= !S.bContextSwitchNoBars; - break; - - } - } - break; -#endif - } -} - -inline void MicroProfileUIClickPreset(int nIndex) -{ - int nNumPresets = static_cast(g_MicroProfilePresetNames.size()); - int nIndexSave = nIndex - nNumPresets - 1; - if(nIndexSave >= 0 && nIndexSave < nNumPresets) - { - MicroProfileSavePreset(g_MicroProfilePresetNames[nIndexSave]); - } - else if(nIndex >= 0 && nIndex < nNumPresets) - { - MicroProfileLoadPreset(g_MicroProfilePresetNames[nIndex]); - } -} - -inline void MicroProfileUIClickCustom(int nIndex) -{ - if(nIndex == 0) - { - MicroProfileCustomGroupDisable(); - } - else - { - MicroProfileCustomGroupEnable(nIndex-2); - } - -} - -inline void MicroProfileUIClickEmpty(int nIndex) -{ - -} - - -inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) -{ - MicroProfile& S = *MicroProfileGet(); - - uint32_t nX = 0; - uint32_t nY = 0; - -#define SBUF_SIZE 256 - char buffer[256]; - MicroProfileDrawBox(nX, nY, nX + nWidth, nY + (MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff000000|g_nMicroProfileBackColors[1]); - -#define MICROPROFILE_MENU_MAX 16 - const char* pMenuText[MICROPROFILE_MENU_MAX] = {0}; - uint32_t nMenuX[MICROPROFILE_MENU_MAX] = {0}; - uint32_t nNumMenuItems = 0; - - int nMPTextLen = snprintf(buffer, 127, "MicroProfile"); - MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nMPTextLen); - nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1); - pMenuText[nNumMenuItems++] = "Mode"; - pMenuText[nNumMenuItems++] = "Groups"; - char AggregateText[64]; - snprintf(AggregateText, sizeof(AggregateText)-1, "Aggregate[%d]", S.nAggregateFlip ? S.nAggregateFlip : S.nAggregateFlipCount); - pMenuText[nNumMenuItems++] = &AggregateText[0]; - pMenuText[nNumMenuItems++] = "Timers"; - pMenuText[nNumMenuItems++] = "Options"; - pMenuText[nNumMenuItems++] = "Preset"; - pMenuText[nNumMenuItems++] = "Custom"; - const int nPauseIndex = nNumMenuItems; - pMenuText[nNumMenuItems++] = S.nRunning ? "Pause" : "Unpause"; - pMenuText[nNumMenuItems++] = "Help"; - - if(S.nOverflow) - { - pMenuText[nNumMenuItems++] = "!BUFFERSFULL!"; - } - - - if(UI.GroupMenuCount != S.nGroupCount + S.nCategoryCount) - { - UI.GroupMenuCount = S.nGroupCount + S.nCategoryCount; - for(uint32_t i = 0; i < S.nCategoryCount; ++i) - { - UI.GroupMenu[i].nIsCategory = 1; - UI.GroupMenu[i].nCategoryIndex = i; - UI.GroupMenu[i].nIndex = i; - UI.GroupMenu[i].pName = S.CategoryInfo[i].pName; - } - for(uint32_t i = 0; i < S.nGroupCount; ++i) - { - uint32_t idx = i + S.nCategoryCount; - UI.GroupMenu[idx].nIsCategory = 0; - UI.GroupMenu[idx].nCategoryIndex = S.GroupInfo[i].nCategory; - UI.GroupMenu[idx].nIndex = i; - UI.GroupMenu[idx].pName = S.GroupInfo[i].pName; - } - std::sort(&UI.GroupMenu[0], &UI.GroupMenu[UI.GroupMenuCount], - [] (const MicroProfileGroupMenuItem& l, const MicroProfileGroupMenuItem& r) -> bool - { - if(l.nCategoryIndex < r.nCategoryIndex) - { - return true; - } - else if(r.nCategoryIndex < l.nCategoryIndex) - { - return false; - } - if(r.nIsCategory || l.nIsCategory) - { - return l.nIsCategory > r.nIsCategory; - } - return MP_STRCASECMP(l.pName, r.pName)<0; - } - ); - } - - MicroProfileSubmenuCallback GroupCallback[MICROPROFILE_MENU_MAX] = - { - MicroProfileUIMenuMode, - MicroProfileUIMenuGroups, - MicroProfileUIMenuAggregate, - MicroProfileUIMenuTimers, - MicroProfileUIMenuOptions, - MicroProfileUIMenuPreset, - MicroProfileUIMenuCustom, - MicroProfileUIMenuEmpty, - MicroProfileUIMenuEmpty, - MicroProfileUIMenuEmpty, - }; - - MicroProfileClickCallback CBClick[MICROPROFILE_MENU_MAX] = - { - MicroProfileUIClickMode, - MicroProfileUIClickGroups, - MicroProfileUIClickAggregate, - MicroProfileUIClickTimers, - MicroProfileUIClickOptions, - MicroProfileUIClickPreset, - MicroProfileUIClickCustom, - MicroProfileUIClickEmpty, - MicroProfileUIClickEmpty, - MicroProfileUIClickEmpty, - }; - - - uint32_t nSelectMenu = UINT32_MAX; - for(uint32_t i = 0; i < nNumMenuItems; ++i) - { - nMenuX[i] = nX; - uint32_t nLen = (uint32_t)strlen(pMenuText[i]); - uint32_t nEnd = nX + nLen * (MICROPROFILE_TEXT_WIDTH+1); - if(UI.nMouseY <= MICROPROFILE_TEXT_HEIGHT && UI.nMouseX <= nEnd && UI.nMouseX >= nX) - { - MicroProfileDrawBox(nX-1, nY, nX + nLen * (MICROPROFILE_TEXT_WIDTH+1), nY +(MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff888888); - nSelectMenu = i; - if((UI.nMouseLeft || UI.nMouseRight) && i == (uint32_t)nPauseIndex) - { - S.nToggleRunning = 1; - } - } - MicroProfileDrawText(nX, nY, UINT32_MAX, pMenuText[i], (uint32_t)strlen(pMenuText[i])); - nX += (nLen+1) * (MICROPROFILE_TEXT_WIDTH+1); - } - uint32_t nMenu = nSelectMenu != UINT32_MAX ? nSelectMenu : UI.nActiveMenu; - UI.nActiveMenu = nMenu; - if(UINT32_MAX != nMenu) - { - nX = nMenuX[nMenu]; - nY += MICROPROFILE_TEXT_HEIGHT+1; - MicroProfileSubmenuCallback CB = GroupCallback[nMenu]; - int nNumLines = 0; - bool bSelected = false; - const char* pString = CB(nNumLines, &bSelected); - uint32_t nTextWidth = 0, nTextHeight = 0; - while(pString) - { - nTextWidth = MicroProfileMax(nTextWidth, (int)strlen(pString)); - nNumLines++; - pString = CB(nNumLines, &bSelected); - } - nTextWidth = (2+nTextWidth) * (MICROPROFILE_TEXT_WIDTH+1); - nTextHeight = nNumLines * (MICROPROFILE_TEXT_HEIGHT+1); - if(UI.nMouseY <= nY + nTextHeight+0 && UI.nMouseY >= nY-0 && UI.nMouseX <= nX + nTextWidth + 0 && UI.nMouseX >= nX - 0) - { - UI.nActiveMenu = nMenu; - } - else if(nSelectMenu == UINT32_MAX) - { - UI.nActiveMenu = UINT32_MAX; - } - MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + nTextHeight, 0xff000000|g_nMicroProfileBackColors[1]); - for(int i = 0; i < nNumLines; ++i) - { - bool bSelected2 = false; - const char* pString2 = CB(i, &bSelected2); - if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1) - { - if(UI.nMouseLeft || UI.nMouseRight) - { - CBClick[nMenu](i); - } - MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); - } - int nTextLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected2 ? '*' : ' ' ,pString2); - MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nTextLen); - nY += MICROPROFILE_TEXT_HEIGHT+1; - } - } - - - { - static char FrameTimeMessage[64]; - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - float fMs = fToMs * (S.nFlipTicks); - float fAverageMs = fToMs * (S.nFlipAggregateDisplay / nAggregateFrames); - float fMaxMs = fToMs * S.nFlipMaxDisplay; - int nLen = snprintf(FrameTimeMessage, sizeof(FrameTimeMessage)-1, "Time[%6.2f] Avg[%6.2f] Max[%6.2f]", fMs, fAverageMs, fMaxMs); - pMenuText[nNumMenuItems++] = &FrameTimeMessage[0]; - MicroProfileDrawText(nWidth - nLen * (MICROPROFILE_TEXT_WIDTH+1), 0, UINT32_MAX, FrameTimeMessage, nLen); - } -} - - -inline void MicroProfileMoveGraph() -{ - - int nZoom = UI.nMouseWheelDelta; - int nPanX = 0; - int nPanY = 0; - static int X = 0, Y = 0; - if(UI.nMouseDownLeft && !UI.nModDown) - { - nPanX = UI.nMouseX - X; - nPanY = UI.nMouseY - Y; - } - X = UI.nMouseX; - Y = UI.nMouseY; - - if(nZoom) - { - float fOldRange = UI.fDetailedRange; - if(nZoom>0) - { - UI.fDetailedRangeTarget = UI.fDetailedRange *= UI.nModDown ? 1.40f : 1.05f; - } - else - { - float fNewDetailedRange = UI.fDetailedRange / (UI.nModDown ? 1.40f : 1.05f); - if(fNewDetailedRange < 1e-4f) //100ns - fNewDetailedRange = 1e-4f; - UI.fDetailedRangeTarget = UI.fDetailedRange = fNewDetailedRange; - } - - float fDiff = fOldRange - UI.fDetailedRange; - float fMousePrc = MicroProfileMax((float)UI.nMouseX / UI.nWidth ,0.f); - UI.fDetailedOffsetTarget = UI.fDetailedOffset += fDiff * fMousePrc; - - } - if(nPanX) - { - UI.fDetailedOffsetTarget = UI.fDetailedOffset += -nPanX * UI.fDetailedRange / UI.nWidth; - } - UI.nOffsetY -= nPanY; - UI.nOffsetX += nPanX; - if(UI.nOffsetX > 0) - UI.nOffsetX = 0; - if(UI.nOffsetY<0) - UI.nOffsetY = 0; -} - -inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) -{ - if(UINT32_MAX != UI.nCustomActive) - { - MicroProfile& S = *MicroProfileGet(); - MP_ASSERT(UI.nCustomActive < MICROPROFILE_CUSTOM_MAX); - MicroProfileCustom* pCustom = &UI.Custom[UI.nCustomActive]; - uint32_t nCount = pCustom->nNumTimers; - uint32_t nAggregateFrames = S.nAggregateFrames ? S.nAggregateFrames : 1; - uint32_t nExtraOffset = 1 + ((pCustom->nFlags & MICROPROFILE_CUSTOM_STACK) != 0 ? 3 : 0); - uint32_t nOffsetYBase = nHeight - (nExtraOffset+nCount)* (1+MICROPROFILE_TEXT_HEIGHT) - MICROPROFILE_CUSTOM_PADDING; - uint32_t nOffsetY = nOffsetYBase; - float fReference = pCustom->fReference; - float fRcpReference = 1.f / fReference; - uint32_t nReducedWidth = UI.nWidth - 2*MICROPROFILE_CUSTOM_PADDING - MICROPROFILE_GRAPH_WIDTH; - - char Buffer[MICROPROFILE_NAME_MAX_LEN*2+1]; - float* pTime = (float*)alloca(sizeof(float)*nCount); - float* pTimeAvg = (float*)alloca(sizeof(float)*nCount); - float* pTimeMax = (float*)alloca(sizeof(float)*nCount); - uint32_t* pColors = (uint32_t*)alloca(sizeof(uint32_t)*nCount); - uint32_t nMaxOffsetX = 0; - MicroProfileDrawBox(MICROPROFILE_CUSTOM_PADDING-1, nOffsetY-1, MICROPROFILE_CUSTOM_PADDING+nReducedWidth+1, UI.nHeight - MICROPROFILE_CUSTOM_PADDING+1, 0x88000000|g_nMicroProfileBackColors[0]); - - for(uint32_t i = 0; i < nCount; ++i) - { - uint16_t nTimerIndex = MicroProfileGetTimerIndex(pCustom->pTimers[i]); - uint16_t nGroupIndex = MicroProfileGetGroupIndex(pCustom->pTimers[i]); - float fToMs = MicroProfileTickToMsMultiplier(S.GroupInfo[nGroupIndex].Type == MicroProfileTokenTypeGpu ? MicroProfileTicksPerSecondGpu() : MicroProfileTicksPerSecondCpu()); - pTime[i] = S.Frame[nTimerIndex].nTicks * fToMs; - pTimeAvg[i] = fToMs * (S.Aggregate[nTimerIndex].nTicks / nAggregateFrames); - pTimeMax[i] = fToMs * (S.AggregateMax[nTimerIndex]); - pColors[i] = S.TimerInfo[nTimerIndex].nColor; - } - - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 3*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Avg", sizeof("Avg")-1); - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 13*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Max", sizeof("Max")-1); - for(uint32_t i = 0; i < nCount; ++i) - { - nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); - uint16_t nTimerIndex = MicroProfileGetTimerIndex(pCustom->pTimers[i]); - uint16_t nGroupIndex = MicroProfileGetGroupIndex(pCustom->pTimers[i]); - MicroProfileTimerInfo* pTimerInfo = &S.TimerInfo[nTimerIndex]; - int nSize; - uint32_t nOffsetX = MICROPROFILE_CUSTOM_PADDING; - nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeAvg[i]); - MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize); - nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); - nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeMax[i]); - MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize); - nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); - nSize = snprintf(Buffer, sizeof(Buffer)-1, "%s:%s", S.GroupInfo[nGroupIndex].pName, pTimerInfo->pName); - MicroProfileDrawText(nOffsetX, nOffsetY, pTimerInfo->nColor, Buffer, nSize); - nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); - nMaxOffsetX = MicroProfileMax(nMaxOffsetX, nOffsetX); - } - uint32_t nMaxWidth = nReducedWidth- nMaxOffsetX; - - if(pCustom->nFlags & MICROPROFILE_CUSTOM_BARS) - { - nOffsetY = nOffsetYBase; - float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? pTimeMax : pTimeAvg; - const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(nMaxOffsetX, nOffsetY, UINT32_MAX, pString, static_cast(strlen(pString))); - int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); - MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize); - for(uint32_t i = 0; i < nCount; ++i) - { - nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); - nWidth = MicroProfileMin(nMaxWidth, (uint32_t)(nMaxWidth * pMs[i] * fRcpReference)); - MicroProfileDrawBox(nMaxOffsetX, nOffsetY, nMaxOffsetX+nWidth, nOffsetY+MICROPROFILE_TEXT_HEIGHT, pColors[i]|0xff000000); - } - } - if(pCustom->nFlags & MICROPROFILE_CUSTOM_STACK) - { - nOffsetY += 2*(1+MICROPROFILE_TEXT_HEIGHT); - const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, UINT32_MAX, pString, static_cast(strlen(pString))); - int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); - MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize); - nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); - float fPosX = MICROPROFILE_CUSTOM_PADDING; - float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? pTimeMax : pTimeAvg; - for(uint32_t i = 0; i < nCount; ++i) - { - float fWidth = pMs[i] * fRcpReference * nReducedWidth; - uint32_t nX = fPosX; - fPosX += fWidth; - uint32_t nXEnd = fPosX; - if(nX < nXEnd) - { - MicroProfileDrawBox(nX, nOffsetY, nXEnd, nOffsetY+MICROPROFILE_TEXT_HEIGHT, pColors[i]|0xff000000); - } - } - } - } -} -inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) -{ - MICROPROFILE_SCOPE(g_MicroProfileDraw); - MicroProfile& S = *MicroProfileGet(); - - { - static int once = 0; - if(0 == once) - { - std::recursive_mutex& m = MicroProfileGetMutex(); - m.lock(); - MicroProfileInitUI(); - - - - uint32_t nDisplay = S.nDisplay; - MicroProfileLoadPreset(MICROPROFILE_DEFAULT_PRESET); - once++; - S.nDisplay = nDisplay;// dont load display, just state - m.unlock(); - - } - } - - - if(S.nDisplay) - { - std::recursive_mutex& m = MicroProfileGetMutex(); - m.lock(); - UI.nWidth = nWidth; - UI.nHeight = nHeight; - UI.nHoverToken = MICROPROFILE_INVALID_TOKEN; - UI.nHoverTime = 0; - UI.nHoverFrame = -1; - if(S.nDisplay != MP_DRAW_DETAILED) - S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX; - MicroProfileMoveGraph(); - - - if(S.nDisplay == MP_DRAW_DETAILED) - { - MicroProfileDrawDetailedView(nWidth, nHeight); - } - else if(S.nDisplay == MP_DRAW_BARS && S.nBars) - { - MicroProfileDrawBarView(nWidth, nHeight); - } - - MicroProfileDrawMenu(nWidth, nHeight); - bool bMouseOverGraph = MicroProfileDrawGraph(nWidth, nHeight); - MicroProfileDrawCustom(nWidth, nHeight); - bool bHidden = S.nDisplay == MP_DRAW_HIDDEN; - if(!bHidden) - { - uint32_t nLockedToolTipX = 3; - bool bDeleted = false; - for(int i = 0; i < MICROPROFILE_TOOLTIP_MAX_LOCKED; ++i) - { - int nIndex = (g_MicroProfileUI.LockedToolTipFront + i) % MICROPROFILE_TOOLTIP_MAX_LOCKED; - if(g_MicroProfileUI.LockedToolTips[nIndex].ppStrings[0]) - { - uint32_t nToolTipWidth = 0, nToolTipHeight = 0; - MicroProfileFloatWindowSize(g_MicroProfileUI.LockedToolTips[nIndex].ppStrings, g_MicroProfileUI.LockedToolTips[nIndex].nNumStrings, 0, nToolTipWidth, nToolTipHeight, 0); - uint32_t nStartY = nHeight - nToolTipHeight - 2; - if(!bDeleted && UI.nMouseY > nStartY && UI.nMouseX > nLockedToolTipX && UI.nMouseX <= nLockedToolTipX + nToolTipWidth && (UI.nMouseLeft || UI.nMouseRight) ) - { - bDeleted = true; - int j = i; - for(; j < MICROPROFILE_TOOLTIP_MAX_LOCKED-1; ++j) - { - int nIndex0 = (g_MicroProfileUI.LockedToolTipFront + j) % MICROPROFILE_TOOLTIP_MAX_LOCKED; - int nIndex1 = (g_MicroProfileUI.LockedToolTipFront + j+1) % MICROPROFILE_TOOLTIP_MAX_LOCKED; - MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nIndex0], &g_MicroProfileUI.LockedToolTips[nIndex1]); - } - MicroProfileStringArrayClear(&g_MicroProfileUI.LockedToolTips[(g_MicroProfileUI.LockedToolTipFront + j) % MICROPROFILE_TOOLTIP_MAX_LOCKED]); - } - else - { - MicroProfileDrawFloatWindow(nLockedToolTipX, nHeight-nToolTipHeight-2, &g_MicroProfileUI.LockedToolTips[nIndex].ppStrings[0], g_MicroProfileUI.LockedToolTips[nIndex].nNumStrings, g_MicroProfileUI.nLockedToolTipColor[nIndex]); - nLockedToolTipX += nToolTipWidth + 4; - } - } - } - - if(UI.nActiveMenu == 8) - { - if(S.nDisplay & MP_DRAW_DETAILED) - { - MicroProfileStringArray DetailedHelp; - MicroProfileStringArrayClear(&DetailedHelp); - MicroProfileStringArrayFormat(&DetailedHelp, "%s", MICROPROFILE_HELP_LEFT); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Toggle Graph"); - MicroProfileStringArrayFormat(&DetailedHelp, "%s", MICROPROFILE_HELP_ALT); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Zoom"); - MicroProfileStringArrayFormat(&DetailedHelp, "%s + %s", MICROPROFILE_HELP_MOD, MICROPROFILE_HELP_LEFT); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Lock Tooltip"); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Drag"); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Pan View"); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Mouse Wheel"); - MicroProfileStringArrayAddLiteral(&DetailedHelp, "Zoom"); - MicroProfileDrawFloatWindow(nWidth, MICROPROFILE_FRAME_HISTORY_HEIGHT+20, DetailedHelp.ppStrings, DetailedHelp.nNumStrings, 0xff777777); - - MicroProfileStringArray DetailedHistoryHelp; - MicroProfileStringArrayClear(&DetailedHistoryHelp); - MicroProfileStringArrayFormat(&DetailedHistoryHelp, "%s", MICROPROFILE_HELP_LEFT); - MicroProfileStringArrayAddLiteral(&DetailedHistoryHelp, "Center View"); - MicroProfileStringArrayFormat(&DetailedHistoryHelp, "%s", MICROPROFILE_HELP_ALT); - MicroProfileStringArrayAddLiteral(&DetailedHistoryHelp, "Zoom to frame"); - MicroProfileDrawFloatWindow(nWidth, 20, DetailedHistoryHelp.ppStrings, DetailedHistoryHelp.nNumStrings, 0xff777777); - - - - } - else if(0 != (S.nDisplay & MP_DRAW_BARS) && S.nBars) - { - MicroProfileStringArray BarHelp; - MicroProfileStringArrayClear(&BarHelp); - MicroProfileStringArrayFormat(&BarHelp, "%s", MICROPROFILE_HELP_LEFT); - MicroProfileStringArrayAddLiteral(&BarHelp, "Toggle Graph"); - MicroProfileStringArrayFormat(&BarHelp, "%s + %s", MICROPROFILE_HELP_MOD, MICROPROFILE_HELP_LEFT); - MicroProfileStringArrayAddLiteral(&BarHelp, "Lock Tooltip"); - MicroProfileStringArrayAddLiteral(&BarHelp, "Drag"); - MicroProfileStringArrayAddLiteral(&BarHelp, "Pan View"); - MicroProfileDrawFloatWindow(nWidth, MICROPROFILE_FRAME_HISTORY_HEIGHT+20, BarHelp.ppStrings, BarHelp.nNumStrings, 0xff777777); - - } - MicroProfileStringArray Debug; - MicroProfileStringArrayClear(&Debug); - MicroProfileStringArrayAddLiteral(&Debug, "Memory Usage"); - MicroProfileStringArrayFormat(&Debug, "%4.2fmb", S.nMemUsage / (1024.f * 1024.f)); - MicroProfileStringArrayAddLiteral(&Debug, "Web Server Port"); - MicroProfileStringArrayFormat(&Debug, "%d", MicroProfileWebServerPort()); - uint32_t nFrameNext = (S.nFrameCurrent+1) % MICROPROFILE_MAX_FRAME_HISTORY; - MicroProfileFrameState* pFrameCurrent = &S.Frames[S.nFrameCurrent]; - MicroProfileFrameState* pFrameNext = &S.Frames[nFrameNext]; - - - MicroProfileStringArrayAddLiteral(&Debug, ""); - MicroProfileStringArrayAddLiteral(&Debug, ""); - MicroProfileStringArrayAddLiteral(&Debug, "Usage"); - MicroProfileStringArrayAddLiteral(&Debug, "markers [frames] "); - -#if MICROPROFILE_CONTEXT_SWITCH_TRACE - MicroProfileStringArrayAddLiteral(&Debug, "Context Switch"); - MicroProfileStringArrayFormat(&Debug, "%9d [%7d]", S.nContextSwitchUsage, MICROPROFILE_CONTEXT_SWITCH_BUFFER_SIZE / S.nContextSwitchUsage ); -#endif - - for(int i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - if(pFrameCurrent->nLogStart[i] && S.Pool[i]) - { - uint32_t nEnd = pFrameNext->nLogStart[i]; - uint32_t nStart = pFrameCurrent->nLogStart[i]; - uint32_t nUsage = nStart < nEnd ? (nEnd - nStart) : (nEnd + MICROPROFILE_BUFFER_SIZE - nStart); - uint32_t nFrameSupport = MICROPROFILE_BUFFER_SIZE / nUsage; - MicroProfileStringArrayFormat(&Debug, "%s", &S.Pool[i]->ThreadName[0]); - MicroProfileStringArrayFormat(&Debug, "%9d [%7d]", nUsage, nFrameSupport); - } - } - - MicroProfileDrawFloatWindow(0, nHeight-10, Debug.ppStrings, Debug.nNumStrings, 0xff777777); - } - - - - if(UI.nActiveMenu == UINT32_MAX && !bMouseOverGraph) - { - if(UI.nHoverToken != MICROPROFILE_INVALID_TOKEN) - { - MicroProfileDrawFloatTooltip(UI.nMouseX, UI.nMouseY, UI.nHoverToken, UI.nHoverTime); - } - else if(S.nContextSwitchHoverThreadAfter != UINT32_MAX && S.nContextSwitchHoverThreadBefore != UINT32_MAX) - { - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - MicroProfileStringArray ToolTip; - MicroProfileStringArrayClear(&ToolTip); - MicroProfileStringArrayAddLiteral(&ToolTip, "Context Switch"); - MicroProfileStringArrayFormat(&ToolTip, "%04x", S.nContextSwitchHoverThread); - MicroProfileStringArrayAddLiteral(&ToolTip, "Before"); - MicroProfileStringArrayFormat(&ToolTip, "%04x", S.nContextSwitchHoverThreadBefore); - MicroProfileStringArrayAddLiteral(&ToolTip, "After"); - MicroProfileStringArrayFormat(&ToolTip, "%04x", S.nContextSwitchHoverThreadAfter); - MicroProfileStringArrayAddLiteral(&ToolTip, "Duration"); - int64_t nDifference = MicroProfileLogTickDifference(S.nContextSwitchHoverTickIn, S.nContextSwitchHoverTickOut); - MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fToMs * nDifference ); - MicroProfileStringArrayAddLiteral(&ToolTip, "CPU"); - MicroProfileStringArrayFormat(&ToolTip, "%d", S.nContextSwitchHoverCpu); - MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX); - - - } - else if(UI.nHoverFrame != -1) - { - uint32_t nNextFrame = (UI.nHoverFrame+1)%MICROPROFILE_MAX_FRAME_HISTORY; - int64_t nTick = S.Frames[UI.nHoverFrame].nFrameStartCpu; - int64_t nTickNext = S.Frames[nNextFrame].nFrameStartCpu; - int64_t nTickGpu = S.Frames[UI.nHoverFrame].nFrameStartGpu; - int64_t nTickNextGpu = S.Frames[nNextFrame].nFrameStartGpu; - - float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); - float fToMsGpu = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondGpu()); - float fMs = fToMs * (nTickNext - nTick); - float fMsGpu = fToMsGpu * (nTickNextGpu - nTickGpu); - MicroProfileStringArray ToolTip; - MicroProfileStringArrayClear(&ToolTip); - MicroProfileStringArrayFormat(&ToolTip, "Frame %d", UI.nHoverFrame); - #if MICROPROFILE_DEBUG - MicroProfileStringArrayFormat(&ToolTip, "%p", &S.Frames[UI.nHoverFrame]); - #else - MicroProfileStringArrayAddLiteral(&ToolTip, ""); - #endif - MicroProfileStringArrayAddLiteral(&ToolTip, "CPU Time"); - MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fMs); - MicroProfileStringArrayAddLiteral(&ToolTip, "GPU Time"); - MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fMsGpu); - #if MICROPROFILE_DEBUG - for(int i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - if(S.Frames[UI.nHoverFrame].nLogStart[i]) - { - MicroProfileStringArrayFormat(&ToolTip, "%d", i); - MicroProfileStringArrayFormat(&ToolTip, "%d", S.Frames[UI.nHoverFrame].nLogStart[i]); - } - } - #endif - MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX); - } - if(UI.nMouseLeft) - { - if(UI.nHoverToken != MICROPROFILE_INVALID_TOKEN) - MicroProfileToggleGraph(UI.nHoverToken); - } - } - } - -#if MICROPROFILE_DRAWCURSOR - { - float fCursor[8] = - { - MicroProfileMax(0, (int)UI.nMouseX-3), UI.nMouseY, - MicroProfileMin(nWidth, UI.nMouseX+3), UI.nMouseY, - UI.nMouseX, MicroProfileMax((int)UI.nMouseY-3, 0), - UI.nMouseX, MicroProfileMin(nHeight, UI.nMouseY+3), - }; - MicroProfileDrawLine2D(2, &fCursor[0], 0xff00ff00); - MicroProfileDrawLine2D(2, &fCursor[4], 0xff00ff00); - } -#endif - m.unlock(); - } - else if(UI.nCustomActive != UINT32_MAX) - { - std::recursive_mutex& m = MicroProfileGetMutex(); - m.lock(); - MicroProfileDrawGraph(nWidth, nHeight); - MicroProfileDrawCustom(nWidth, nHeight); - m.unlock(); - - } - UI.nMouseLeft = UI.nMouseRight = 0; - UI.nMouseLeftMod = UI.nMouseRightMod = 0; - UI.nMouseWheelDelta = 0; - if(S.nOverflow) - S.nOverflow--; - - UI.fDetailedOffset = UI.fDetailedOffset + (UI.fDetailedOffsetTarget - UI.fDetailedOffset) * MICROPROFILE_ANIM_DELAY_PRC; - UI.fDetailedRange = UI.fDetailedRange + (UI.fDetailedRangeTarget - UI.fDetailedRange) * MICROPROFILE_ANIM_DELAY_PRC; - - -} - -bool MicroProfileIsDrawing() -{ - MicroProfile& S = *MicroProfileGet(); - return S.nDisplay != 0; -} - -void MicroProfileToggleGraph(MicroProfileToken nToken) -{ - MicroProfile& S = *MicroProfileGet(); - uint32_t nTimerId = MicroProfileGetTimerIndex(nToken); - nToken &= 0xffff; - int32_t nMinSort = 0x7fffffff; - int32_t nFreeIndex = -1; - int32_t nMinIndex = 0; - int32_t nMaxSort = 0x80000000; - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - if(S.Graph[i].nToken == MICROPROFILE_INVALID_TOKEN) - nFreeIndex = i; - if(S.Graph[i].nToken == nToken) - { - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - S.TimerInfo[nTimerId].bGraph = false; - return; - } - if(S.Graph[i].nKey < nMinSort) - { - nMinSort = S.Graph[i].nKey; - nMinIndex = i; - } - if(S.Graph[i].nKey > nMaxSort) - { - nMaxSort = S.Graph[i].nKey; - } - } - int nIndex = nFreeIndex > -1 ? nFreeIndex : nMinIndex; - if (nFreeIndex == -1) - { - uint32_t idx = MicroProfileGetTimerIndex(S.Graph[nIndex].nToken); - S.TimerInfo[idx].bGraph = false; - } - S.Graph[nIndex].nToken = nToken; - S.Graph[nIndex].nKey = nMaxSort+1; - memset(&S.Graph[nIndex].nHistory[0], 0, sizeof(S.Graph[nIndex].nHistory)); - S.TimerInfo[nTimerId].bGraph = true; -} - - -void MicroProfileMousePosition(uint32_t nX, uint32_t nY, int nWheelDelta) -{ - UI.nMouseX = nX; - UI.nMouseY = nY; - UI.nMouseWheelDelta = nWheelDelta; -} - -void MicroProfileModKey(uint32_t nKeyState) -{ - UI.nModDown = nKeyState ? 1 : 0; -} - -void MicroProfileClearGraph() -{ - MicroProfile& S = *MicroProfileGet(); - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - if(S.Graph[i].nToken != 0) - { - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - } - } -} - -void MicroProfileMouseButton(uint32_t nLeft, uint32_t nRight) -{ - bool bCanRelease = abs((int)(UI.nMouseDownX - UI.nMouseX)) + abs((int)(UI.nMouseDownY - UI.nMouseY)) < 3; - - if(0 == nLeft && UI.nMouseDownLeft && bCanRelease) - { - if(UI.nModDown) - UI.nMouseLeftMod = 1; - else - UI.nMouseLeft = 1; - } - - if(0 == nRight && UI.nMouseDownRight && bCanRelease) - { - if(UI.nModDown) - UI.nMouseRightMod = 1; - else - UI.nMouseRight = 1; - } - if((nLeft || nRight) && !(UI.nMouseDownLeft || UI.nMouseDownRight)) - { - UI.nMouseDownX = UI.nMouseX; - UI.nMouseDownY = UI.nMouseY; - } - - UI.nMouseDownLeft = nLeft; - UI.nMouseDownRight = nRight; - -} - -void MicroProfileDrawLineVertical(int nX, int nTop, int nBottom, uint32_t nColor) -{ - MicroProfileDrawBox(nX, nTop, nX + 1, nBottom, nColor); -} - -void MicroProfileDrawLineHorizontal(int nLeft, int nRight, int nY, uint32_t nColor) -{ - MicroProfileDrawBox(nLeft, nY, nRight, nY + 1, nColor); -} - - - -#include - -#define MICROPROFILE_PRESET_HEADER_MAGIC 0x28586813 -#define MICROPROFILE_PRESET_HEADER_VERSION 0x00000102 -struct MicroProfilePresetHeader -{ - uint32_t nMagic; - uint32_t nVersion; - //groups, threads, aggregate, reference frame, graphs timers - uint32_t nGroups[MICROPROFILE_MAX_GROUPS]; - uint32_t nThreads[MICROPROFILE_MAX_THREADS]; - uint32_t nGraphName[MICROPROFILE_MAX_GRAPHS]; - uint32_t nGraphGroupName[MICROPROFILE_MAX_GRAPHS]; - uint32_t nAllGroupsWanted; - uint32_t nAllThreadsWanted; - uint32_t nAggregateFlip; - float fReferenceTime; - uint32_t nBars; - uint32_t nDisplay; - uint32_t nOpacityBackground; - uint32_t nOpacityForeground; - uint32_t nShowSpikes; -}; - -#ifndef MICROPROFILE_PRESET_FILENAME_FUNC -#define MICROPROFILE_PRESET_FILENAME_FUNC MicroProfilePresetFilename -static const char* MicroProfilePresetFilename(const char* pSuffix) -{ - static char filename[512]; - snprintf(filename, sizeof(filename)-1, ".microprofilepreset.%s", pSuffix); - return filename; -} -#endif - -void MicroProfileSavePreset(const char* pPresetName) -{ - std::lock_guard Lock(MicroProfileGetMutex()); - FILE* F = fopen(MICROPROFILE_PRESET_FILENAME_FUNC(pPresetName), "wb"); - if(!F) return; - - MicroProfile& S = *MicroProfileGet(); - - MicroProfilePresetHeader Header; - memset(&Header, 0, sizeof(Header)); - Header.nAggregateFlip = S.nAggregateFlip; - Header.nBars = S.nBars; - Header.fReferenceTime = S.fReferenceTime; - Header.nAllGroupsWanted = S.nAllGroupsWanted; - Header.nAllThreadsWanted = S.nAllThreadsWanted; - Header.nMagic = MICROPROFILE_PRESET_HEADER_MAGIC; - Header.nVersion = MICROPROFILE_PRESET_HEADER_VERSION; - Header.nDisplay = S.nDisplay; - Header.nOpacityBackground = UI.nOpacityBackground; - Header.nOpacityForeground = UI.nOpacityForeground; - Header.nShowSpikes = UI.bShowSpikes ? 1 : 0; - fwrite(&Header, sizeof(Header), 1, F); - uint64_t nMask = 1; - for(uint32_t i = 0; i < MICROPROFILE_MAX_GROUPS; ++i) - { - if(S.nActiveGroupWanted & nMask) - { - uint32_t offset = ftell(F); - const char* pName = S.GroupInfo[i].pName; - int nLen = (int)strlen(pName)+1; - fwrite(pName, nLen, 1, F); - Header.nGroups[i] = offset; - } - nMask <<= 1; - } - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - MicroProfileThreadLog* pLog = S.Pool[i]; - if(pLog && S.nThreadActive[i]) - { - uint32_t nOffset = ftell(F); - const char* pName = &pLog->ThreadName[0]; - int nLen = (int)strlen(pName)+1; - fwrite(pName, nLen, 1, F); - Header.nThreads[i] = nOffset; - } - } - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - MicroProfileToken nToken = S.Graph[i].nToken; - if(nToken != MICROPROFILE_INVALID_TOKEN) - { - uint32_t nGroupIndex = MicroProfileGetGroupIndex(nToken); - uint32_t nTimerIndex = MicroProfileGetTimerIndex(nToken); - const char* pGroupName = S.GroupInfo[nGroupIndex].pName; - const char* pTimerName = S.TimerInfo[nTimerIndex].pName; - MP_ASSERT(pGroupName); - MP_ASSERT(pTimerName); - int nGroupLen = (int)strlen(pGroupName)+1; - int nTimerLen = (int)strlen(pTimerName)+1; - - uint32_t nOffsetGroup = ftell(F); - fwrite(pGroupName, nGroupLen, 1, F); - uint32_t nOffsetTimer = ftell(F); - fwrite(pTimerName, nTimerLen, 1, F); - Header.nGraphName[i] = nOffsetTimer; - Header.nGraphGroupName[i] = nOffsetGroup; - } - } - fseek(F, 0, SEEK_SET); - fwrite(&Header, sizeof(Header), 1, F); - - fclose(F); - -} - - - -void MicroProfileLoadPreset(const char* pSuffix) -{ - std::lock_guard Lock(MicroProfileGetMutex()); - FILE* F = fopen(MICROPROFILE_PRESET_FILENAME_FUNC(pSuffix), "rb"); - if(!F) - { - return; - } - fseek(F, 0, SEEK_END); - int nSize = ftell(F); - char* const pBuffer = (char*)alloca(nSize); - fseek(F, 0, SEEK_SET); - int nRead = (int)fread(pBuffer, nSize, 1, F); - fclose(F); - if(1 != nRead) - return; - - MicroProfile& S = *MicroProfileGet(); - - MicroProfilePresetHeader& Header = *(MicroProfilePresetHeader*)pBuffer; - - if(Header.nMagic != MICROPROFILE_PRESET_HEADER_MAGIC || Header.nVersion != MICROPROFILE_PRESET_HEADER_VERSION) - { - return; - } - - S.nAggregateFlip = Header.nAggregateFlip; - S.nBars = Header.nBars; - S.fReferenceTime = Header.fReferenceTime; - S.fRcpReferenceTime = 1.f / Header.fReferenceTime; - S.nAllGroupsWanted = Header.nAllGroupsWanted; - S.nAllThreadsWanted = Header.nAllThreadsWanted; - S.nDisplay = Header.nDisplay; - S.nActiveGroupWanted = 0; - UI.nOpacityBackground = Header.nOpacityBackground; - UI.nOpacityForeground = Header.nOpacityForeground; - UI.bShowSpikes = Header.nShowSpikes == 1; - - memset(&S.nThreadActive[0], 0, sizeof(S.nThreadActive)); - - for(uint32_t i = 0; i < MICROPROFILE_MAX_GROUPS; ++i) - { - if(Header.nGroups[i]) - { - const char* pGroupName = pBuffer + Header.nGroups[i]; - for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) - { - if(0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName)) - { - S.nActiveGroupWanted |= (1ULL << j); - } - } - } - } - for(uint32_t i = 0; i < MICROPROFILE_MAX_THREADS; ++i) - { - if(Header.nThreads[i]) - { - const char* pThreadName = pBuffer + Header.nThreads[i]; - for(uint32_t j = 0; j < MICROPROFILE_MAX_THREADS; ++j) - { - MicroProfileThreadLog* pLog = S.Pool[j]; - if(pLog && 0 == MP_STRCASECMP(pThreadName, &pLog->ThreadName[0])) - { - S.nThreadActive[j] = 1; - } - } - } - } - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - MicroProfileToken nPrevToken = S.Graph[i].nToken; - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - if(Header.nGraphName[i] && Header.nGraphGroupName[i]) - { - const char* pGraphName = pBuffer + Header.nGraphName[i]; - const char* pGraphGroupName = pBuffer + Header.nGraphGroupName[i]; - for(uint32_t j = 0; j < S.nTotalTimers; ++j) - { - uint64_t nGroupIndex = S.TimerInfo[j].nGroupIndex; - if(0 == MP_STRCASECMP(pGraphName, S.TimerInfo[j].pName) && 0 == MP_STRCASECMP(pGraphGroupName, S.GroupInfo[nGroupIndex].pName)) - { - MicroProfileToken nToken = MicroProfileMakeToken(1ULL << nGroupIndex, (uint16_t)j); - S.Graph[i].nToken = nToken; // note: group index is stored here but is checked without in MicroProfileToggleGraph()! - S.TimerInfo[j].bGraph = true; - if(nToken != nPrevToken) - { - memset(&S.Graph[i].nHistory, 0, sizeof(S.Graph[i].nHistory)); - } - break; - } - } - } - } -} - -inline uint32_t MicroProfileCustomGroupFind(const char* pCustomName) -{ - for(uint32_t i = 0; i < UI.nCustomCount; ++i) - { - if(!MP_STRCASECMP(pCustomName, UI.Custom[i].pName)) - { - return i; - } - } - return UINT32_MAX; -} - -inline uint32_t MicroProfileCustomGroup(const char* pCustomName) -{ - for(uint32_t i = 0; i < UI.nCustomCount; ++i) - { - if(!MP_STRCASECMP(pCustomName, UI.Custom[i].pName)) - { - return i; - } - } - MP_ASSERT(UI.nCustomCount < MICROPROFILE_CUSTOM_MAX); - uint32_t nIndex = UI.nCustomCount; - UI.nCustomCount++; - memset(&UI.Custom[nIndex], 0, sizeof(UI.Custom[nIndex])); - size_t nLen = strlen(pCustomName); - if(nLen > MICROPROFILE_NAME_MAX_LEN-1) - nLen = MICROPROFILE_NAME_MAX_LEN-1; - memcpy(&UI.Custom[nIndex].pName[0], pCustomName, nLen); - UI.Custom[nIndex].pName[nLen] = '\0'; - return nIndex; -} -void MicroProfileCustomGroup(const char* pCustomName, uint32_t nMaxTimers, uint32_t nAggregateFlip, float fReferenceTime, uint32_t nFlags) -{ - uint32_t nIndex = MicroProfileCustomGroup(pCustomName); - MP_ASSERT(UI.Custom[nIndex].pTimers == 0);//only call once! - UI.Custom[nIndex].pTimers = &UI.CustomTimer[UI.nCustomTimerCount]; - UI.Custom[nIndex].nMaxTimers = nMaxTimers; - UI.Custom[nIndex].fReference = fReferenceTime; - UI.nCustomTimerCount += nMaxTimers; - MP_ASSERT(UI.nCustomTimerCount <= MICROPROFILE_CUSTOM_MAX_TIMERS); //bump MICROPROFILE_CUSTOM_MAX_TIMERS - UI.Custom[nIndex].nFlags = nFlags; - UI.Custom[nIndex].nAggregateFlip = nAggregateFlip; -} - -inline void MicroProfileCustomGroupEnable(uint32_t nIndex) -{ - if(nIndex < UI.nCustomCount) - { - MicroProfile& S = *MicroProfileGet(); - S.nForceGroupUI = UI.Custom[nIndex].nGroupMask; - MicroProfileSetAggregateFrames(UI.Custom[nIndex].nAggregateFlip); - S.fReferenceTime = UI.Custom[nIndex].fReference; - S.fRcpReferenceTime = 1.f / UI.Custom[nIndex].fReference; - UI.nCustomActive = nIndex; - - for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) - { - if(S.Graph[i].nToken != MICROPROFILE_INVALID_TOKEN) - { - uint32_t nTimerId = MicroProfileGetTimerIndex(S.Graph[i].nToken); - S.TimerInfo[nTimerId].bGraph = false; - S.Graph[i].nToken = MICROPROFILE_INVALID_TOKEN; - } - } - - for(uint32_t i = 0; i < UI.Custom[nIndex].nNumTimers; ++i) - { - if(i == MICROPROFILE_MAX_GRAPHS) - { - break; - } - S.Graph[i].nToken = UI.Custom[nIndex].pTimers[i]; - S.Graph[i].nKey = i; - uint32_t nTimerId = MicroProfileGetTimerIndex(S.Graph[i].nToken); - S.TimerInfo[nTimerId].bGraph = true; - } - } -} - -void MicroProfileCustomGroupToggle(const char* pCustomName) -{ - uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); - if(nIndex == UINT32_MAX || nIndex == UI.nCustomActive) - { - MicroProfileCustomGroupDisable(); - } - else - { - MicroProfileCustomGroupEnable(nIndex); - } -} - -void MicroProfileCustomGroupEnable(const char* pCustomName) -{ - uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); - MicroProfileCustomGroupEnable(nIndex); -} -void MicroProfileCustomGroupDisable() -{ - MicroProfile& S = *MicroProfileGet(); - S.nForceGroupUI = 0; - UI.nCustomActive = UINT32_MAX; -} - -void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer) -{ - uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); - if(UINT32_MAX == nIndex) - { - return; - } - uint32_t nTimerIndex = UI.Custom[nIndex].nNumTimers; - MP_ASSERT(nTimerIndex < UI.Custom[nIndex].nMaxTimers); - uint64_t nToken = MicroProfileFindToken(pGroup, pTimer); - MP_ASSERT(nToken != MICROPROFILE_INVALID_TOKEN); //Timer must be registered first. - UI.Custom[nIndex].pTimers[nTimerIndex] = nToken; - uint16_t nGroup = MicroProfileGetGroupIndex(nToken); - UI.Custom[nIndex].nGroupMask |= (1ULL << nGroup); - UI.Custom[nIndex].nNumTimers++; -} - -#undef UI - -#endif -#endif diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 9fed0b1449..f8f175d313 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -32,7 +32,6 @@ #include "common/fs/path_util.h" #include "common/logging/backend.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/scm_rev.h" #include "common/scope_exit.h" #include "common/settings.h" @@ -432,11 +431,6 @@ u64 EmulationSession::GetProgramId(JNIEnv* env, jstring jprogramId) { static Core::SystemResultStatus RunEmulation(const std::string& filepath, const size_t program_index, const bool frontend_initiated) { - MicroProfileOnThreadCreate("EmuThread"); - SCOPE_EXIT { - MicroProfileShutdown(); - }; - LOG_INFO(Frontend, "starting"); if (filepath.empty()) { diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp index 7a76c3d0bf..d799f3f06f 100644 --- a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,13 +12,10 @@ #include "audio_core/common/common.h" #include "audio_core/sink/sink.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/thread.h" #include "core/core.h" #include "core/core_timing.h" -MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP_AudioRenderer", MP_RGB(60, 19, 97)); - namespace AudioCore::ADSP::AudioRenderer { AudioRenderer::AudioRenderer(Core::System& system_, Sink::Sink& sink_) @@ -131,7 +131,6 @@ void AudioRenderer::CreateSinkStreams() { void AudioRenderer::Main(std::stop_token stop_token) { static constexpr char name[]{"DSP_AudioRenderer_Main"}; - MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::High); @@ -203,7 +202,6 @@ void AudioRenderer::Main(std::stop_token stop_token) { // Process the command list { - MICROPROFILE_SCOPE(Audio_Renderer); render_times_taken[index] = command_list_processor.Process(index) - start_time; } diff --git a/src/audio_core/adsp/apps/opus/opus_decoder.cpp b/src/audio_core/adsp/apps/opus/opus_decoder.cpp index 75f0fb9ad9..ff4ea8ba2d 100644 --- a/src/audio_core/adsp/apps/opus/opus_decoder.cpp +++ b/src/audio_core/adsp/apps/opus/opus_decoder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -10,13 +13,10 @@ #include "audio_core/audio_core.h" #include "audio_core/common/common.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/thread.h" #include "core/core.h" #include "core/core_timing.h" -MICROPROFILE_DEFINE(OpusDecoder, "Audio", "DSP_OpusDecoder", MP_RGB(60, 19, 97)); - namespace AudioCore::ADSP::OpusDecoder { namespace { diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index a0b8ef29e1..8146cb142c 100644 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,14 +9,10 @@ #include "audio_core/adsp/adsp.h" #include "audio_core/audio_core.h" #include "audio_core/renderer/system_manager.h" -#include "common/microprofile.h" #include "common/thread.h" #include "core/core.h" #include "core/core_timing.h" -MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager", - MP_RGB(60, 19, 97)); - namespace AudioCore::Renderer { SystemManager::SystemManager(Core::System& core_) @@ -80,15 +79,12 @@ bool SystemManager::Remove(System& system_) { void SystemManager::ThreadFunc(std::stop_token stop_token) { static constexpr char name[]{"AudioRenderSystemManager"}; - MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::High); while (active && !stop_token.stop_requested()) { { std::scoped_lock l{mutex1}; - MICROPROFILE_SCOPE(Audio_RenderSystemManager); - for (auto system : systems) { system->SendCommandToDsp(); } diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 302d68fafd..f97dca2432 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -95,9 +95,6 @@ add_library( math_util.h memory_detect.cpp memory_detect.h - microprofile.cpp - microprofile.h - microprofileui.h multi_level_page_table.cpp multi_level_page_table.h nvidia_flags.cpp @@ -263,7 +260,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ) endif() -target_link_libraries(common PUBLIC Boost::headers fmt::fmt microprofile +target_link_libraries(common PUBLIC Boost::headers fmt::fmt stb::headers Threads::Threads) target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle) diff --git a/src/common/microprofile.cpp b/src/common/microprofile.cpp deleted file mode 100644 index e6657c82f0..0000000000 --- a/src/common/microprofile.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-FileCopyrightText: 2015 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -// Includes the MicroProfile implementation in this file for compilation -#define MICROPROFILE_IMPL 1 -#include "common/microprofile.h" diff --git a/src/common/microprofile.h b/src/common/microprofile.h deleted file mode 100644 index 56ef0a2dcf..0000000000 --- a/src/common/microprofile.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-FileCopyrightText: 2015 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -// Uncomment this to disable microprofile. This will get you cleaner profiles when using -// external sampling profilers like "Very Sleepy", and will improve performance somewhat. -// #define MICROPROFILE_ENABLED 0 - -// Customized Citra settings. -// This file wraps the MicroProfile header so that these are consistent everywhere. -#define MICROPROFILE_WEBSERVER 0 -#define MICROPROFILE_GPU_TIMERS 0 // TODO: Implement timer queries when we upgrade to OpenGL 3.3 -#define MICROPROFILE_CONTEXT_SWITCH_TRACE 0 -#define MICROPROFILE_PER_THREAD_BUFFER_SIZE (2048 << 13) // 16 MB - -#ifdef _WIN32 -// This isn't defined by the standard library in MSVC2015 -typedef void* HANDLE; -#endif - -#include - -#define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0) diff --git a/src/common/microprofileui.h b/src/common/microprofileui.h deleted file mode 100644 index 39ed18ffa8..0000000000 --- a/src/common/microprofileui.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2015 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "common/microprofile.h" - -// Customized Citra settings. -// This file wraps the MicroProfile header so that these are consistent everywhere. -#define MICROPROFILE_TEXT_WIDTH 6 -#define MICROPROFILE_TEXT_HEIGHT 12 -#define MICROPROFILE_HELP_ALT "Right-Click" -#define MICROPROFILE_HELP_MOD "Ctrl" - -// This isn't included by microprofileui.h :( -#include // For std::abs - -#include diff --git a/src/core/core.cpp b/src/core/core.cpp index 8aef26d93f..c2852e66f0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -9,7 +9,6 @@ #include "audio_core/audio_core.h" #include "common/fs/fs.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/settings.h" #include "common/settings_enums.h" #include "common/string_util.h" @@ -63,11 +62,6 @@ #include "video_core/renderer_base.h" #include "video_core/video_core.h" -MICROPROFILE_DEFINE(ARM_CPU0, "ARM", "CPU 0", MP_RGB(255, 64, 64)); -MICROPROFILE_DEFINE(ARM_CPU1, "ARM", "CPU 1", MP_RGB(255, 64, 64)); -MICROPROFILE_DEFINE(ARM_CPU2, "ARM", "CPU 2", MP_RGB(255, 64, 64)); -MICROPROFILE_DEFINE(ARM_CPU3, "ARM", "CPU 3", MP_RGB(255, 64, 64)); - namespace Core { FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, @@ -289,13 +283,6 @@ struct System::Impl { exit_locked = false; exit_requested = false; -#if MICROPROFILE_ENABLED - microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0); - microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1); - microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2); - microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3); -#endif - if (Settings::values.enable_renderdoc_hotkey) { renderdoc_api = std::make_unique(); } @@ -575,9 +562,6 @@ struct System::Impl { std::stop_source stop_event; std::array dynarmic_ticks{}; -#if MICROPROFILE_ENABLED - std::array microprofile_cpu{}; -#endif std::array gpu_dirty_memory_managers; @@ -956,18 +940,6 @@ void System::RegisterHostThread() { impl->kernel.RegisterHostThread(); } -#if MICROPROFILE_ENABLED -void System::EnterCPUProfile() { - std::size_t core = impl->kernel.GetCurrentHostThreadID(); - impl->dynarmic_ticks[core] = MicroProfileEnter(impl->microprofile_cpu[core]); -} - -void System::ExitCPUProfile() { - std::size_t core = impl->kernel.GetCurrentHostThreadID(); - MicroProfileLeave(impl->microprofile_cpu[core], impl->dynarmic_ticks[core]); -} -#endif - bool System::IsMulticore() const { return impl->is_multicore; } diff --git a/src/core/core.h b/src/core/core.h index 3f1a3f0388..12a957791d 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -396,14 +396,6 @@ public: /// Register a host thread as an auxiliary thread. void RegisterHostThread(); -#if MICROPROFILE_ENABLED - /// Enter CPU Microprofile - void EnterCPUProfile(); - - /// Exit CPU Microprofile - void ExitCPUProfile(); -#endif - /// Tells if system is running on multicore. [[nodiscard]] bool IsMulticore() const; diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 646f12708e..1c0a2d7bca 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -18,7 +18,6 @@ #endif #include "common/settings.h" -#include "common/microprofile.h" #include "core/core_timing.h" #include "core/hardware_properties.h" @@ -56,14 +55,10 @@ CoreTiming::~CoreTiming() { void CoreTiming::ThreadEntry(CoreTiming& instance) { static constexpr char name[] = "HostTiming"; - MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::High); instance.on_thread_init(); instance.ThreadLoop(); -#if MICROPROFILE_ENABLED - MicroProfileOnThreadExit(); -#endif } void CoreTiming::Initialize(std::function&& on_thread_init_) { diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 1b838eea59..1a80fcfaa4 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -1,8 +1,10 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/fiber.h" -#include "common/microprofile.h" #include "common/scope_exit.h" #include "common/thread.h" #include "core/core.h" @@ -192,7 +194,6 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) { } else { name = "CPUThread"; } - MicroProfileOnThreadCreate(name.c_str()); Common::SetCurrentThreadName(name.c_str()); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); auto& data = core_data[core]; @@ -201,9 +202,6 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) { // Cleanup SCOPE_EXIT { data.host_context->Exit(); -#if MICROPROFILE_ENABLED - MicroProfileOnThreadExit(); -#endif }; // Running diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 7a851e9b02..00177dc943 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -12,7 +15,6 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/scope_exit.h" #include "common/thread.h" #include "common/thread_worker.h" @@ -46,8 +48,6 @@ #include "core/hle/service/sm/sm.h" #include "core/memory.h" -MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); - namespace Kernel { struct KernelCore::Impl { @@ -1278,16 +1278,6 @@ void KernelCore::ExceptionalExitApplication() { SuspendEmulation(true); } -#if MICROPROFILE_ENABLED -void KernelCore::EnterSVCProfile() { - impl->svc_ticks[CurrentPhysicalCoreIndex()] = MicroProfileEnter(MICROPROFILE_TOKEN(Kernel_SVC)); -} - -void KernelCore::ExitSVCProfile() { - MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]); -} -#endif - Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() { return impl->slab_resource_counts; } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index e11241d6aa..5d1a34281a 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -271,12 +274,6 @@ public: bool IsShuttingDown() const; -#if MICROPROFILE_ENABLED - void EnterSVCProfile(); - - void ExitSVCProfile(); -#endif - /// Workaround for single-core mode when preempting threads while idle. bool IsPhantomModeForSingleCore() const; void SetIsPhantomModeForSingleCore(bool value); diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp index 3321032563..04f0010688 100644 --- a/src/core/hle/kernel/physical_core.cpp +++ b/src/core/hle/kernel/physical_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -27,10 +30,6 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) { interface->Initialize(); const auto EnterContext = [&]() { -#if MICROPROFILE_ENABLED - system.EnterCPUProfile(); -#endif - // Lock the core context. std::scoped_lock lk{m_guard}; @@ -60,10 +59,6 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) { // On exit, we no longer are running. m_arm_interface = nullptr; m_current_thread = nullptr; - -#if MICROPROFILE_ENABLED - system.ExitCPUProfile(); -#endif }; while (true) { diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index b1ce1e9daa..8370e62bc4 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -4428,9 +4431,6 @@ void Call(Core::System& system, u32 imm) { std::array args; kernel.CurrentPhysicalCore().SaveSvcArguments(process, args); -#if MICROPROFILE_ENABLED - kernel.EnterSVCProfile(); -#endif if (process.Is64Bit()) { Call64(system, imm, args); @@ -4438,9 +4438,6 @@ void Call(Core::System& system, u32 imm) { Call32(system, imm, args); } -#if MICROPROFILE_ENABLED - kernel.ExitSVCProfile(); -#endif kernel.CurrentPhysicalCore().LoadSvcArguments(process, args); } diff --git a/src/core/hle/service/nvnflinger/hardware_composer.cpp b/src/core/hle/service/nvnflinger/hardware_composer.cpp index f2dfe85a96..77622a7832 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.cpp +++ b/src/core/hle/service/nvnflinger/hardware_composer.cpp @@ -1,9 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #include -#include "common/microprofile.h" #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" #include "core/hle/service/nvnflinger/buffer_item.h" #include "core/hle/service/nvnflinger/buffer_item_consumer.h" @@ -115,9 +117,6 @@ u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, Display& display, nvdisp.Composite(composition_stack); } - // Render MicroProfile. - MicroProfileFlip(); - // Advance by at least one frame. const u32 frame_advance = swap_interval.value_or(1); m_frame_number += frame_advance; diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index a5e1378197..fffbc413bb 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -11,7 +11,6 @@ #include -#include "common/microprofile.h" #include "common/socket_types.h" #include "core/core.h" #include "core/hle/kernel/k_thread.h" diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index d8921e5658..77cd587238 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp @@ -1,9 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include "common/hex_util.h" -#include "common/microprofile.h" #include "common/swap.h" #include "core/arm/debug.h" #include "core/core.h" @@ -269,8 +271,6 @@ void CheatEngine::Reload(std::vector reload_cheats) { is_pending_reload.exchange(true); } -MICROPROFILE_DEFINE(Cheat_Engine, "Add-Ons", "Cheat Engine", MP_RGB(70, 200, 70)); - void CheatEngine::FrameCallback(std::chrono::nanoseconds ns_late) { if (is_pending_reload.exchange(false)) { vm.LoadProgram(cheats); @@ -280,8 +280,6 @@ void CheatEngine::FrameCallback(std::chrono::nanoseconds ns_late) { return; } - MICROPROFILE_SCOPE(Cheat_Engine); - vm.Execute(metadata); } diff --git a/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cache-v2 b/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cache-v2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cmakeFiles-v1 b/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/cmakeFiles-v1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/codemodel-v2 b/src/dynarmic/tests/build/Desktop-Debug/.cmake/api/v1/query/codemodel-v2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/LICENSE.conan b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/LICENSE.conan new file mode 100644 index 0000000000..541f5a3a6f --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/LICENSE.conan @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 JFrog + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake new file mode 100644 index 0000000000..cc6636d175 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake @@ -0,0 +1,405 @@ +# +# Internal Qt Creator variable reference +# +foreach(qtcreator_var + QT_QMAKE_EXECUTABLE CMAKE_PREFIX_PATH CMAKE_C_COMPILER CMAKE_CXX_COMPILER + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELWITHDEBINFO) + set(__just_reference_${qtcreator_var} ${${qtcreator_var}}) +endforeach() + +option(QT_CREATOR_SOURCE_GROUPS "Qt Creator source groups extensions" ON) +if (QT_CREATOR_SOURCE_GROUPS) + source_group("Resources" REGULAR_EXPRESSION "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets|qrc|svg|gif|ico|webp)$") + source_group("Forms" REGULAR_EXPRESSION "\\.(ui)$") + source_group("State charts" REGULAR_EXPRESSION "\\.(scxml)$") + source_group("Source Files" REGULAR_EXPRESSION + "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|ccm|cxxm|c\\+\\+m|cu|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat|qml|js)$" + ) +endif() + +# +# Set a better default value for CMAKE_INSTALL_PREFIX +# +function(qtc_modify_default_install_prefix) + # If at configure time the user didn't specify a CMAKE_INSTALL_PREFIX variable + # Modules/CMakeGenericSystem.cmake will set a default value + # to CMAKE_INSTALL_PREFIX and set CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT to ON + + # In practice there are cases when CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is + # set to ON and a custom CMAKE_INSTALL_PREFIX is set + + # Do the original CMAKE_INSTALL_PREFIX detection + if(CMAKE_HOST_UNIX) + set(original_cmake_install_prefix "/usr/local") + else() + GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) + set(original_cmake_install_prefix + "${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}") + unset(CMAKE_GENERIC_PROGRAM_FILES) + endif() + + # When the user code didn't modify the CMake set CMAKE_INSTALL_PREFIX + # then set the "/tmp" better value for CMAKE_INSTALL_PREFIX + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND + CMAKE_INSTALL_PREFIX STREQUAL "${original_cmake_install_prefix}") + set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "/tmp") + endif() +endfunction() +if (CMAKE_VERSION GREATER_EQUAL "3.19") + cmake_language(DEFER CALL qtc_modify_default_install_prefix) +endif() + +if (EXISTS "${CMAKE_SOURCE_DIR}/QtCreatorPackageManager.cmake") + include("${CMAKE_SOURCE_DIR}/QtCreatorPackageManager.cmake") +endif() + +if (QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP) + return() +endif() +option(QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP "Skip Qt Creator's package manager auto-setup" OFF) + +# Store the C/C++ object output extension +if (CMAKE_VERSION GREATER_EQUAL "3.19") + cmake_language(DEFER CALL set CMAKE_C_OUTPUT_EXTENSION "${CMAKE_C_OUTPUT_EXTENSION}" CACHE STRING "" FORCE) + cmake_language(DEFER CALL set CMAKE_CXX_OUTPUT_EXTENSION "${CMAKE_CXX_OUTPUT_EXTENSION}" CACHE STRING "" FORCE) +endif() + +macro(qtc_auto_setup_compiler_standard toolchainFile) + foreach(lang_var C CXX CUDA OBJC OBJCXX) + foreach(prop_var STANDARD STANDARD_REQUIRED EXTENSIONS) + if (CMAKE_${lang_var}_${prop_var}) + file(APPEND "${toolchainFile}" + "set(CMAKE_${lang_var}_${prop_var} ${CMAKE_${lang_var}_${prop_var}})\n") + endif() + endforeach() + endforeach() + + # Forward important CMake variables to the package manager in the toolchain file + foreach(fwd_var CMAKE_MSVC_RUNTIME_LIBRARY CMAKE_SYSROOT CMAKE_OSX_SYSROOT CMAKE_OSX_ARCHITECTURES) + if (${fwd_var}) + file(APPEND "${toolchainFile}" + "set(${fwd_var} ${${fwd_var}})\n") + endif() + endforeach() +endmacro() + +# +# conan +# +macro(qtc_auto_setup_conan) + foreach(file conanfile.txt conanfile.py) + if (EXISTS "${CMAKE_SOURCE_DIR}/${file}") + set(conanfile_txt "${CMAKE_SOURCE_DIR}/${file}") + break() + endif() + endforeach() + + if (conanfile_txt AND NOT QT_CREATOR_SKIP_CONAN_SETUP) + option(QT_CREATOR_SKIP_CONAN_SETUP "Skip Qt Creator's conan package manager auto-setup" OFF) + set(QT_CREATOR_CONAN_BUILD_POLICY "missing" CACHE STRING "Qt Creator's conan package manager auto-setup build policy. This is used for the BUILD property of cmake_conan_run") + + set_property( + DIRECTORY "${CMAKE_SOURCE_DIR}" + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS "${conanfile_txt}") + + find_program(conan_program conan) + if (NOT conan_program) + message(WARNING "Qt Creator: conan executable not found. " + "Package manager auto-setup will be skipped. " + "To disable this warning set QT_CREATOR_SKIP_CONAN_SETUP to ON.") + return() + endif() + execute_process(COMMAND ${conan_program} --version + RESULT_VARIABLE result_code + OUTPUT_VARIABLE conan_version_output + ERROR_VARIABLE conan_version_output) + if (NOT result_code EQUAL 0) + message(FATAL_ERROR "conan --version failed='${result_code}: ${conan_version_output}") + endif() + + string(REGEX REPLACE ".*Conan version ([0-9].[0-9]).*" "\\1" conan_version "${conan_version_output}") + + set(conanfile_timestamp_file "${CMAKE_BINARY_DIR}/conan-dependencies/conanfile.timestamp") + file(TIMESTAMP "${conanfile_txt}" conanfile_timestamp) + + set(do_conan_installation ON) + if (EXISTS "${conanfile_timestamp_file}") + file(READ "${conanfile_timestamp_file}" old_conanfile_timestamp) + if ("${conanfile_timestamp}" STREQUAL "${old_conanfile_timestamp}") + set(do_conan_installation OFF) + endif() + endif() + + set(conanfile_build_policy_file "${CMAKE_BINARY_DIR}/conan-dependencies/conanfile.buildpolicy") + if (EXISTS "${conanfile_build_policy_file}") + file(READ "${conanfile_build_policy_file}" build_policy) + if (NOT "${build_policy}" STREQUAL "${QT_CREATOR_CONAN_BUILD_POLICY}") + set(do_conan_installation ON) + endif() + endif() + + if (do_conan_installation) + message(STATUS "Qt Creator: conan package manager auto-setup. " + "Skip this step by setting QT_CREATOR_SKIP_CONAN_SETUP to ON.") + + file(COPY "${conanfile_txt}" DESTINATION "${CMAKE_BINARY_DIR}/conan-dependencies/") + + # conanfile should have a generator specified, when both file and conan_install + # specifcy the CMakeDeps generator, conan_install will issue an error + file(READ "${conanfile_txt}" conanfile_text_content) + unset(conan_generator) + if (NOT "${conanfile_text_content}" MATCHES ".*CMakeDeps.*") + set(conan_generator "-g CMakeDeps") + endif() + + file(WRITE "${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake" " + set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\") + set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\") + ") + qtc_auto_setup_compiler_standard("${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake") + + if (CMAKE_TOOLCHAIN_FILE) + file(APPEND "${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake" + "include(\"${CMAKE_TOOLCHAIN_FILE}\")\n") + endif() + + file(WRITE "${CMAKE_BINARY_DIR}/conan-dependencies/CMakeLists.txt" " + cmake_minimum_required(VERSION 3.15) + + unset(CMAKE_PROJECT_INCLUDE_BEFORE CACHE) + project(conan-setup) + + if (${conan_version} VERSION_GREATER_EQUAL 2.0) + set(CONAN_COMMAND \"${conan_program}\") + include(\"${CMAKE_CURRENT_LIST_DIR}/conan_provider.cmake\") + conan_profile_detect_default() + detect_host_profile(\"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\") + + set(build_types \${CMAKE_BUILD_TYPE}) + if (CMAKE_CONFIGURATION_TYPES) + set(build_types \${CMAKE_CONFIGURATION_TYPES}) + endif() + + foreach(type \${build_types}) + conan_install( + -pr \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_host_profile\" + --build=${QT_CREATOR_CONAN_BUILD_POLICY} + -s build_type=\${type} + ${conan_generator}) + endforeach() + + get_property(CONAN_INSTALL_SUCCESS GLOBAL PROPERTY CONAN_INSTALL_SUCCESS) + if (CONAN_INSTALL_SUCCESS) + get_property(CONAN_GENERATORS_FOLDER GLOBAL PROPERTY CONAN_GENERATORS_FOLDER) + file(TO_CMAKE_PATH \"\${CONAN_GENERATORS_FOLDER}\" CONAN_GENERATORS_FOLDER) + file(WRITE \"${CMAKE_BINARY_DIR}/conan-dependencies/conan_paths.cmake\" \" + list(PREPEND CMAKE_PREFIX_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\") + list(PREPEND CMAKE_MODULE_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\") + list(PREPEND CMAKE_FIND_ROOT_PATH \\\"\${CONAN_GENERATORS_FOLDER}\\\") + list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH) + list(REMOVE_DUPLICATES CMAKE_MODULE_PATH) + list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH) + set(CMAKE_PREFIX_PATH \\\"\\\${CMAKE_PREFIX_PATH}\\\" CACHE STRING \\\"\\\" FORCE) + set(CMAKE_MODULE_PATH \\\"\\\${CMAKE_MODULE_PATH}\\\" CACHE STRING \\\"\\\" FORCE) + set(CMAKE_FIND_ROOT_PATH \\\"\\\${CMAKE_FIND_ROOT_PATH}\\\" CACHE STRING \\\"\\\" FORCE) + \") + endif() + else() + include(\"${CMAKE_CURRENT_LIST_DIR}/conan.cmake\") + conan_cmake_run( + CONANFILE \"${conanfile_txt}\" + INSTALL_FOLDER \"${CMAKE_BINARY_DIR}/conan-dependencies\" + GENERATORS cmake_paths cmake_find_package json + BUILD ${QT_CREATOR_CONAN_BUILD_POLICY} + ENV CONAN_CMAKE_TOOLCHAIN_FILE=\"${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake\" + ) + endif() + ") + + if (NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "Debug;Release") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} + -S "${CMAKE_BINARY_DIR}/conan-dependencies/" + -B "${CMAKE_BINARY_DIR}/conan-dependencies/build" + -C "${CMAKE_BINARY_DIR}/qtcsettings.cmake" + -D "CMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/conan-dependencies/toolchain.cmake" + -G ${CMAKE_GENERATOR} + -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -D "CMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}" + RESULT_VARIABLE result + ) + if (result EQUAL 0) + file(WRITE "${conanfile_timestamp_file}" "${conanfile_timestamp}") + file(WRITE "${conanfile_build_policy_file}" ${QT_CREATOR_CONAN_BUILD_POLICY}) + else() + message(WARNING "Qt Creator's conan package manager auto-setup failed. Consider setting " + "QT_CREATOR_SKIP_CONAN_SETUP to ON and reconfigure to skip this step.") + return() + endif() + endif() + + include("${CMAKE_BINARY_DIR}/conan-dependencies/conan_paths.cmake") + endif() + unset(conanfile_txt) +endmacro() +qtc_auto_setup_conan() + +# +# vcpkg +# +macro(qtc_auto_setup_vcpkg) + if (EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json" AND NOT QT_CREATOR_SKIP_VCPKG_SETUP) + option(QT_CREATOR_SKIP_VCPKG_SETUP "Skip Qt Creator's vcpkg package manager auto-setup" OFF) + + set_property( + DIRECTORY "${CMAKE_SOURCE_DIR}" + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/vcpkg.json") + + find_program(vcpkg_program vcpkg + PATHS ${CMAKE_SOURCE_DIR}/vcpkg ${CMAKE_SOURCE_DIR}/3rdparty/vcpkg $ENV{VCPKG_ROOT} + NO_DEFAULT_PATH + ) + if (NOT vcpkg_program) + message(WARNING "Qt Creator: vcpkg executable not found. " + "Package manager auto-setup will be skipped. " + "To disable this warning set QT_CREATOR_SKIP_VCPKG_SETUP to ON.") + return() + endif() + execute_process(COMMAND ${vcpkg_program} version + RESULT_VARIABLE result_code + OUTPUT_VARIABLE vcpkg_version_output + ERROR_VARIABLE vcpkg_version_output) + if (NOT result_code EQUAL 0) + message(FATAL_ERROR "vcpkg version failed='${result_code}: ${vcpkg_version_output}") + endif() + + # Resolve any symlinks + get_filename_component(vpkg_program_real_path ${vcpkg_program} REALPATH) + get_filename_component(vpkg_root ${vpkg_program_real_path} DIRECTORY) + + if (NOT EXISTS "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake") + message(STATUS "Qt Creator: vcpkg package manager auto-setup. " + "Skip this step by setting QT_CREATOR_SKIP_VCPKG_SETUP to ON.") + + file(WRITE "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake" " + set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\") + set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\") + ") + qtc_auto_setup_compiler_standard("${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake") + + if (CMAKE_TOOLCHAIN_FILE AND NOT + CMAKE_TOOLCHAIN_FILE STREQUAL "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake") + file(APPEND "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake" + "include(\"${CMAKE_TOOLCHAIN_FILE}\")\n") + endif() + + if (VCPKG_TARGET_TRIPLET) + set(vcpkg_triplet ${VCPKG_TARGET_TRIPLET}) + else() + if (ANDROID_ABI) + if (ANDROID_ABI STREQUAL "armeabi-v7a") + set(vcpkg_triplet arm-neon-android) + elseif (ANDROID_ABI STREQUAL "arm64-v8a") + set(vcpkg_triplet arm64-android) + elseif (ANDROID_ABI STREQUAL "x86") + set(vcpkg_triplet x86-android) + elseif (ANDROID_ABI STREQUAL "x86_64") + set(vcpkg_triplet x64-android) + else() + message(FATAL_ERROR "Unsupported Android ABI: ${ANDROID_ABI}") + endif() + # Needed by vcpkg/scripts/toolchains/android.cmake + file(APPEND "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake" " + set(ENV{ANDROID_NDK_HOME} \"${ANDROID_NDK}\") + ") + elseif (WIN32) + if ("$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "ARM64") + set(vcpkg_triplet arm64-mingw-static) + else() + set(vcpkg_triplet x64-mingw-static) + endif() + if (CMAKE_CXX_COMPILER MATCHES ".*/(.*)/cl.exe") + string(TOLOWER ${CMAKE_MATCH_1} host_arch_lowercase) + set(vcpkg_triplet ${host_arch_lowercase}-windows) + endif() + elseif(APPLE) + # We're too early to use CMAKE_HOST_SYSTEM_PROCESSOR + execute_process( + COMMAND uname -m + OUTPUT_VARIABLE __apple_host_system_processor + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (__apple_host_system_processor MATCHES "arm64") + set(vcpkg_triplet arm64-osx) + else() + set(vcpkg_triplet x64-osx) + endif() + else() + # We're too early to use CMAKE_HOST_SYSTEM_PROCESSOR + execute_process( + COMMAND uname -m + OUTPUT_VARIABLE __linux_host_system_processor + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (__linux_host_system_processor MATCHES "aarch64") + set(vcpkg_triplet arm64-linux) + else() + set(vcpkg_triplet x64-linux) + endif() + endif() + endif() + + file(APPEND "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake" " + set(VCPKG_TARGET_TRIPLET ${vcpkg_triplet}) + include(\"${vpkg_root}/scripts/buildsystems/vcpkg.cmake\") + ") + endif() + + set(CMAKE_TOOLCHAIN_FILE "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake" CACHE PATH "" FORCE) + + # Save CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH as cache variables + if (CMAKE_VERSION GREATER_EQUAL "3.19") + cmake_language(DEFER CALL list REMOVE_DUPLICATES CMAKE_PREFIX_PATH) + cmake_language(DEFER CALL list REMOVE_DUPLICATES CMAKE_MODULE_PATH) + cmake_language(DEFER CALL set CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" CACHE STRING "" FORCE) + cmake_language(DEFER CALL set CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" CACHE STRING "" FORCE) + endif() + endif() +endmacro() +qtc_auto_setup_vcpkg() + +# +# MaintenanceTool +# +if (QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER) + return() +endif() + +option(QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER + "Skip Qt Creator's MaintenanceTool find_package provider" OFF) +option(QT_CREATOR_MAINTENANCE_TOOL_PROVIDER_USE_CLI + "Use CLI mode for Qt Creator's MaintenanceTool find_package provider" OFF) + +function(qtc_maintenance_provider_missing_variable_message variable) + message(STATUS "Qt Creator: ${variable} was not set. " + "Qt MaintenanceTool cannot be used to install missing Qt modules that you specify in find_package(). " + "To disable this message set QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER to ON.") +endfunction() + +if (NOT QT_MAINTENANCE_TOOL) + qtc_maintenance_provider_missing_variable_message(QT_MAINTENANCE_TOOL) + return() +endif() +if (NOT QT_QMAKE_EXECUTABLE) + qtc_maintenance_provider_missing_variable_message(QT_QMAKE_EXECUTABLE) + return() +endif() + +if (CMAKE_VERSION GREATER_EQUAL "3.24") + list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/maintenance_tool_provider.cmake) +else() + message(WARNING "Qt Creator: CMake version 3.24 is needed for MaintenanceTool find_package() provider. " + "To disable this warning set QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER to ON.") +endif() diff --git a/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan.cmake b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan.cmake new file mode 100644 index 0000000000..7c78f74154 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan.cmake @@ -0,0 +1,1026 @@ +# The MIT License (MIT) + +# Copyright (c) 2018 JFrog + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + + +# This file comes from: https://github.com/conan-io/cmake-conan. Please refer +# to this repository for issues and documentation. + +# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. +# It will take CMake current settings (os, compiler, compiler version, architecture) +# and translate them to conan settings for installing and retrieving dependencies. + +# It is intended to facilitate developers building projects that have conan dependencies, +# but it is only necessary on the end-user side. It is not necessary to create conan +# packages, in fact it shouldn't be use for that. Check the project documentation. + +# version: 0.18.1 + +include(CMakeParseArguments) + +function(_get_msvc_ide_version result) + set(${result} "" PARENT_SCOPE) + if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) + set(${result} 8 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) + set(${result} 9 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) + set(${result} 10 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) + set(${result} 11 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + set(${result} 12 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) + set(${result} 14 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) + set(${result} 15 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) + set(${result} 16 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1950) + set(${result} 17 PARENT_SCOPE) + else() + message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") + endif() +endfunction() + +macro(_conan_detect_build_type) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) + elseif(CMAKE_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) + if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") + set(_CONAN_SETTING_BUILD_TYPE "Debug") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") + set(_CONAN_SETTING_BUILD_TYPE "Release") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") + set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") + set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") + endif() +endmacro() + +macro(_conan_check_system_name) + #handle -s os setting + if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + #use default conan os setting if CMAKE_SYSTEM_NAME is not defined + set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(CONAN_SYSTEM_NAME Macos) + endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") + set(CONAN_SYSTEM_NAME Neutrino) + endif() + set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) + list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) + if (${_index} GREATER -1) + #check if the cmake system is a conan supported one + set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) + else() + message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") + endif() + endif() +endmacro() + +macro(_conan_check_language) + get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) + if (";${_languages};" MATCHES ";CXX;") + set(LANGUAGE CXX) + set(USING_CXX 1) + elseif (";${_languages};" MATCHES ";C;") + set(LANGUAGE C) + set(USING_CXX 0) + else () + message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") + endif() +endmacro() + +macro(_conan_detect_compiler) + + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_ARCH) + set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) + endif() + + if(USING_CXX) + set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) + endif() + + if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) + # using GCC + # TODO: Handle other params + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + if(${MAJOR} GREATER 4) + set(COMPILER_VERSION ${MAJOR}) + endif() + set(_CONAN_SETTING_COMPILER gcc) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + set(_CONAN_SETTING_COMPILER intel) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) + # using AppleClang + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER apple-clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") + + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if(APPLE) + cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) + if(NOT APPLE_CLANG_POLICY STREQUAL NEW) + message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") + set(_CONAN_SETTING_COMPILER apple-clang) + endif() + endif() + if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) + endif() + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC + OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) + + set(_VISUAL "Visual Studio") + _get_msvc_ide_version(_VISUAL_VERSION) + if("${_VISUAL_VERSION}" STREQUAL "") + message(FATAL_ERROR "Conan: Visual Studio not recognized") + else() + set(_CONAN_SETTING_COMPILER ${_VISUAL}) + set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) + endif() + + if(NOT _CONAN_SETTING_ARCH) + if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") + set(_CONAN_SETTING_ARCH x86_64) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") + message(STATUS "Conan: Using default ARM architecture from MSVC") + set(_CONAN_SETTING_ARCH armv6) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") + set(_CONAN_SETTING_ARCH x86) + else () + message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") + endif() + endif() + + conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) + message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") + set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) + + if (CMAKE_GENERATOR_TOOLSET) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + endif() + else() + message(FATAL_ERROR "Conan: compiler setup not recognized") + endif() + +endmacro() + +function(conan_cmake_settings result) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) + #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) + #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) + #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) + #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) + #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) + #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) + + message(STATUS "Conan: Automatic detection of conan settings from cmake") + + conan_parse_arguments(${ARGV}) + + _conan_detect_build_type(${ARGV}) + + _conan_check_system_name() + + _conan_check_language() + + _conan_detect_compiler(${ARGV}) + + # If profile is defined it is used + if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) + elseif(ARGUMENTS_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) + endif() + + foreach(ARG ${_APPLIED_PROFILES}) + set(_SETTINGS ${_SETTINGS} -pr=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) + conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) + set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) + endforeach() + + if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset) + endif() + + # remove any manually specified settings from the autodetected settings + foreach(ARG ${ARGUMENTS_SETTINGS}) + string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") + message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") + list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") + endforeach() + + # Automatic from CMake + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + + foreach(ARG ${ARGUMENTS_SETTINGS}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}) + endforeach() + + message(STATUS "Conan: Settings= ${_SETTINGS}") + + set(${result} ${_SETTINGS} PARENT_SCOPE) +endfunction() + + +function(conan_cmake_detect_unix_libcxx result) + # Take into account any -stdlib in compile options + get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) + string(GENEX_STRIP "${compile_options}" compile_options) + + # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions + get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) + string(GENEX_STRIP "${defines}" defines) + + foreach(define ${defines}) + if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") + if(define MATCHES "^-D") + set(compile_options ${compile_options} "${define}") + else() + set(compile_options ${compile_options} "-D${define}") + endif() + endif() + endforeach() + + # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable + set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) + if(CMAKE_CXX_COMPILER_ARG1) + # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" + # without this, ccache, winegcc, or other wrappers might lose all their arguments + separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) + list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) + # without --target= we may be calling the wrong underlying GCC + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) + # without --sysroot= we may find the wrong #include + if(CMAKE_SYSROOT_COMPILE) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") + elseif(CMAKE_SYSROOT) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") + endif() + endif() + + separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) + + if(CMAKE_OSX_SYSROOT) + set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") + endif() + + execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "#include " + COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - + OUTPUT_VARIABLE string_defines + ) + + if(string_defines MATCHES "#define __GLIBCXX__") + # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake + if(DEFINED _GLIBCXX_USE_CXX11_ABI) + if(_GLIBCXX_USE_CXX11_ABI) + set(${result} libstdc++11 PARENT_SCOPE) + return() + else() + set(${result} libstdc++ PARENT_SCOPE) + return() + endif() + endif() + + if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") + set(${result} libstdc++11 PARENT_SCOPE) + else() + # Either the compiler is missing the define because it is old, and so + # it can't use the new abi, or the compiler was configured to use the + # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) + set(${result} libstdc++ PARENT_SCOPE) + endif() + else() + set(${result} libc++ PARENT_SCOPE) + endif() +endfunction() + +function(conan_cmake_detect_vs_runtime result) + + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_BUILD_TYPE) + set(build_type "${ARGUMENTS_BUILD_TYPE}") + elseif(CMAKE_BUILD_TYPE) + set(build_type "${CMAKE_BUILD_TYPE}") + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + if(build_type) + string(TOUPPER "${build_type}" build_type) + endif() + set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) + foreach(variable ${variables}) + if(NOT "${${variable}}" STREQUAL "") + string(REPLACE " " ";" flags "${${variable}}") + foreach (flag ${flags}) + if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") + string(SUBSTRING "${flag}" 1 -1 runtime) + set(${result} "${runtime}" PARENT_SCOPE) + return() + endif() + endforeach() + endif() + endforeach() + if("${build_type}" STREQUAL "DEBUG") + set(${result} "MDd" PARENT_SCOPE) + else() + set(${result} "MD" PARENT_SCOPE) + endif() +endfunction() + +function(_collect_settings result) + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset + compiler.cppstd) + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + set(${result} ${detected_setings} PARENT_SCOPE) +endfunction() + +function(conan_cmake_autodetect detected_settings) + _conan_detect_build_type(${ARGV}) + _conan_check_system_name() + _conan_check_language() + _conan_detect_compiler(${ARGV}) + _collect_settings(collected_settings) + set(${detected_settings} ${collected_settings} PARENT_SCOPE) +endfunction() + +macro(conan_parse_arguments) + set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) + set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND) + set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE + PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO + INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) + cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) +endmacro() + +function(old_conan_cmake_install) + # Calls "conan install" + # Argument BUILD is equivalant to --build={missing, PkgName,...} or + # --build when argument is 'BUILD all' (which builds all packages from source) + # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source + # cmake does not identify conan as command, even if it is +x and it is in the path + conan_parse_arguments(${ARGV}) + + if(CONAN_CMAKE_MULTI) + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) + else() + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) + endif() + + set(CONAN_BUILD_POLICY "") + foreach(ARG ${ARGUMENTS_BUILD}) + if(${ARG} STREQUAL "all") + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) + break() + else() + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) + endif() + endforeach() + if(ARGUMENTS_CONAN_COMMAND) + set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + set(CONAN_OPTIONS "") + if(ARGUMENTS_CONANFILE) + if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) + set(CONANFILE ${ARGUMENTS_CONANFILE}) + else() + set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) + endif() + else() + set(CONANFILE ".") + endif() + foreach(ARG ${ARGUMENTS_OPTIONS}) + set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) + endforeach() + if(ARGUMENTS_UPDATE) + set(CONAN_INSTALL_UPDATE --update) + endif() + if(ARGUMENTS_NO_IMPORTS) + set(CONAN_INSTALL_NO_IMPORTS --no-imports) + endif() + set(CONAN_INSTALL_FOLDER "") + if(ARGUMENTS_INSTALL_FOLDER) + set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) + endif() + set(CONAN_OUTPUT_FOLDER "") + if(ARGUMENTS_OUTPUT_FOLDER) + set(CONAN_OUTPUT_FOLDER -of=${ARGUMENTS_OUTPUT_FOLDER}) + endif() + foreach(ARG ${ARGUMENTS_GENERATORS}) + set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_ENV}) + set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) + endforeach() + set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) + + string (REPLACE ";" " " _conan_args "${conan_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") + + if(ARGUMENTS_OUTPUT_QUIET) + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_output + ERROR_VARIABLE conan_output + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + else() + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + +endfunction() + +function(conan_cmake_install) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) + set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER OUTPUT_FOLDER) + set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) + foreach(arg ${installOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") + set(flag "--lockfile-node-id") + elseif("${arg}" STREQUAL "INSTALL_FOLDER") + set(flag "--install-folder") + elseif("${arg}" STREQUAL "OUTPUT_FOLDER") + set(flag "--output-folder") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "GENERATOR") + set(flag "--generator") + elseif("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED NO_IMPORTS) + set(NO_IMPORTS --no-imports) + endif() + set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} ${OUTPUT_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _install_args "${install_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${install_args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan install failed='${return_code}'") + else() + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + endif() + +endfunction() + +function(conan_cmake_lock_create) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(lockCreateOptions UPDATE BASE OUTPUT_QUIET ERROR_QUIET) + set(lockCreateOneValueArgs PATH REFERENCE REMOTE LOCKFILE LOCKFILE_OUT) + set(lockCreateMultiValueArgs BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${lockCreateOptions}" "${lockCreateOneValueArgs}" "${lockCreateMultiValueArgs}" ${ARGN}) + foreach(arg ${lockCreateOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED BASE) + set(BASE --base) + endif() + set(lock_create_Args lock create ${PATH} ${REFERENCE} ${UPDATE} ${BASE} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _lock_create_Args "${lock_create_Args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_lock_create_Args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${lock_create_Args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan lock create failed='${return_code}'") + else() + message(FATAL_ERROR "Conan lock create failed='${return_code}'") + endif() + endif() +endfunction() + +function(conan_cmake_setup_conanfile) + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_CONANFILE) + get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) + # configure_file will make sure cmake re-runs when conanfile is updated + configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) + else() + conan_cmake_generate_conanfile(ON ${ARGV}) + endif() +endfunction() + +function(conan_cmake_configure) + conan_cmake_generate_conanfile(OFF ${ARGV}) +endfunction() + +# Generate, writing in disk a conanfile.txt with the requires, options, and imports +# specified as arguments +# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) +function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) + + conan_parse_arguments(${ARGV}) + + set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") + file(WRITE ${_FN} "") + + if(DEFINED ARGUMENTS_REQUIRES) + file(APPEND ${_FN} "[requires]\n") + foreach(REQUIRE ${ARGUMENTS_REQUIRES}) + file(APPEND ${_FN} ${REQUIRE} "\n") + endforeach() + endif() + + if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) + file(APPEND ${_FN} "[generators]\n") + if (DEFAULT_GENERATOR) + file(APPEND ${_FN} "cmake\n") + endif() + if (DEFINED ARGUMENTS_GENERATORS) + foreach(GENERATOR ${ARGUMENTS_GENERATORS}) + file(APPEND ${_FN} ${GENERATOR} "\n") + endforeach() + endif() + endif() + + if(DEFINED ARGUMENTS_BUILD_REQUIRES) + file(APPEND ${_FN} "[build_requires]\n") + foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) + file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_IMPORTS) + file(APPEND ${_FN} "[imports]\n") + foreach(IMPORTS ${ARGUMENTS_IMPORTS}) + file(APPEND ${_FN} ${IMPORTS} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_OPTIONS) + file(APPEND ${_FN} "[options]\n") + foreach(OPTION ${ARGUMENTS_OPTIONS}) + file(APPEND ${_FN} ${OPTION} "\n") + endforeach() + endif() + +endfunction() + + +macro(conan_load_buildinfo) + if(CONAN_CMAKE_MULTI) + set(_CONANBUILDINFO conanbuildinfo_multi.cmake) + else() + set(_CONANBUILDINFO conanbuildinfo.cmake) + endif() + if(ARGUMENTS_INSTALL_FOLDER) + set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) + else() + set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) + endif() + # Checks for the existence of conanbuildinfo.cmake, and loads it + # important that it is macro, so variables defined at parent scope + if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") + message(STATUS "Conan: Loading ${_CONANBUILDINFO}") + include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) + else() + message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") + endif() +endmacro() + + +macro(conan_cmake_run) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) + message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") + elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) + message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") + endif() + + if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED + AND NOT ARGUMENTS_BUILD_TYPE) + set(CONAN_CMAKE_MULTI ON) + if (NOT ARGUMENTS_CONFIGURATION_TYPES) + set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") + endif() + message(STATUS "Conan: Using cmake-multi generator") + else() + set(CONAN_CMAKE_MULTI OFF) + endif() + + if(NOT CONAN_EXPORTED) + conan_cmake_setup_conanfile(${ARGV}) + if(CONAN_CMAKE_MULTI) + foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) + set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endforeach() + set(CMAKE_BUILD_TYPE) + else() + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endif() + endif() + + if (NOT ARGUMENTS_NO_LOAD) + conan_load_buildinfo() + endif() + + if(ARGUMENTS_BASIC_SETUP) + foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) + if(ARGUMENTS_${_option}) + if(${_option} STREQUAL "CMAKE_TARGETS") + list(APPEND _setup_options "TARGETS") + else() + list(APPEND _setup_options ${_option}) + endif() + endif() + endforeach() + conan_basic_setup(${_setup_options}) + endif() +endmacro() + +macro(conan_check) + # Checks conan availability in PATH + # Arguments REQUIRED, DETECT_QUIET and VERSION are optional + # Example usage: + # conan_check(VERSION 1.0.0 REQUIRED) + set(options REQUIRED DETECT_QUIET) + set(oneValueArgs VERSION) + cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: checking conan executable") + endif() + + find_program(CONAN_CMD conan) + if(NOT CONAN_CMD AND CONAN_REQUIRED) + message(FATAL_ERROR "Conan executable not found! Please install conan.") + endif() + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: Found program ${CONAN_CMD}") + endif() + execute_process(COMMAND ${CONAN_CMD} --version + RESULT_VARIABLE return_code + OUTPUT_VARIABLE CONAN_VERSION_OUTPUT + ERROR_VARIABLE CONAN_VERSION_OUTPUT) + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan --version failed='${return_code}'") + endif() + + if(NOT CONAN_DETECT_QUIET) + string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) + message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") + endif() + + if(DEFINED CONAN_VERSION) + string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO + "${CONAN_VERSION_OUTPUT}") + if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) + message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ + required: ${CONAN_VERSION}. Consider updating via 'pip \ + install conan==${CONAN_VERSION}'.") + endif() + endif() +endmacro() + +function(conan_add_remote) + # Adds a remote + # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional + # Example usage: + # conan_add_remote(NAME bincrafters INDEX 1 + # URL https://api.bintray.com/conan/bincrafters/public-conan + # VERIFY_SSL True) + set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) + + if(DEFINED CONAN_INDEX) + set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") + endif() + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED DETECT_QUIET) + endif() + set(CONAN_VERIFY_SSL_ARG "True") + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) + endif() + message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") + execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan remote failed='${return_code}'") + endif() +endfunction() + +macro(conan_config_install) + # install a full configuration from a local or remote zip file + # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional + # Example usage: + # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git + # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) + set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) + set(multiValueArgs ARGS) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") + endif() + + if(DEFINED CONAN_TYPE) + set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") + endif() + + if(DEFINED CONAN_ARGS) + set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") + endif() + + if(DEFINED CONAN_SOURCE) + set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") + endif() + + if(DEFINED CONAN_TARGET) + set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") + endif() + + set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} + ${CONAN_TYPE_ARG} + ${CONAN_ARGS_ARGS} + ${CONAN_SOURCE_ARGS} + ${CONAN_TARGET_ARGS}) + + message(STATUS "Conan: Installing config from ${CONAN_ITEM}") + execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan config failed='${return_code}'") + endif() +endmacro() diff --git a/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan_provider.cmake b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan_provider.cmake new file mode 100644 index 0000000000..e5fa9cec19 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/conan_provider.cmake @@ -0,0 +1,655 @@ +# https://github.com/conan-io/cmake-conan/blob/develop2/conan_provider.cmake +# commit: f6464d1e13ef7a47c569f5061f9607ea63339d39 +# +# The MIT License (MIT) +# +# Copyright (c) 2019 JFrog +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set(CONAN_MINIMUM_VERSION 2.0.5) + + +function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION) + # it could be cross compilation + message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}") + if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(${OS} Macos PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(${OS} Neutrino PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") + set(${OS} Windows PARENT_SCOPE) + set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS") + set(${OS} Windows PARENT_SCOPE) + set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE) + else() + set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE) + endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + if(DEFINED ANDROID_PLATFORM) + string(REGEX MATCH "[0-9]+" _OS_API_LEVEL ${ANDROID_PLATFORM}) + elseif(DEFINED CMAKE_SYSTEM_VERSION) + set(_OS_API_LEVEL ${CMAKE_SYSTEM_VERSION}) + endif() + message(STATUS "CMake-Conan: android api level=${_OS_API_LEVEL}") + set(${OS_API_LEVEL} ${_OS_API_LEVEL} PARENT_SCOPE) + endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS") + # CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja + # generators, but just has the original input string for Xcode. + if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT}) + set(_OS_SDK ${CMAKE_OSX_SYSROOT}) + else() + if(CMAKE_OSX_SYSROOT MATCHES Simulator) + set(apple_platform_suffix simulator) + else() + set(apple_platform_suffix os) + endif() + if(CMAKE_OSX_SYSROOT MATCHES AppleTV) + set(_OS_SDK "appletv${apple_platform_suffix}") + elseif(CMAKE_OSX_SYSROOT MATCHES iPhone) + set(_OS_SDK "iphone${apple_platform_suffix}") + elseif(CMAKE_OSX_SYSROOT MATCHES Watch) + set(_OS_SDK "watch${apple_platform_suffix}") + endif() + endif() + if(DEFINED _OS_SDK) + message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}") + set(${OS_SDK} ${_OS_SDK} PARENT_SCOPE) + endif() + if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) + message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}") + set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE) + endif() + endif() + endif() +endfunction() + + +function(detect_arch ARCH) + # CMAKE_OSX_ARCHITECTURES can contain multiple architectures, but Conan only supports one. + # Therefore this code only finds one. If the recipes support multiple architectures, the + # build will work. Otherwise, there will be a linker error for the missing architecture(s). + if(DEFINED CMAKE_OSX_ARCHITECTURES) + string(REPLACE " " ";" apple_arch_list "${CMAKE_OSX_ARCHITECTURES}") + list(LENGTH apple_arch_list apple_arch_count) + if(apple_arch_count GREATER 1) + message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.") + endif() + endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "") + set(host_arch ${CMAKE_OSX_ARCHITECTURES}) + elseif(MSVC) + set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}) + else() + set(host_arch ${CMAKE_SYSTEM_PROCESSOR}) + endif() + if(host_arch MATCHES "aarch64|arm64|ARM64") + set(_ARCH armv8) + elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7") + set(_ARCH armv7) + elseif(host_arch MATCHES armv7s) + set(_ARCH armv7s) + elseif(host_arch MATCHES "i686|i386|X86") + set(_ARCH x86) + elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64") + set(_ARCH x86_64) + endif() + message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}") + set(${ARCH} ${_ARCH} PARENT_SCOPE) +endfunction() + + +function(detect_cxx_standard CXX_STANDARD) + set(${CXX_STANDARD} ${CMAKE_CXX_STANDARD} PARENT_SCOPE) + if(CMAKE_CXX_EXTENSIONS) + set(${CXX_STANDARD} "gnu${CMAKE_CXX_STANDARD}" PARENT_SCOPE) + endif() +endfunction() + + +macro(detect_gnu_libstdcxx) + # _CONAN_IS_GNU_LIBSTDCXX true if GNU libstdc++ + check_cxx_source_compiles(" + #include + #if !defined(__GLIBCXX__) && !defined(__GLIBCPP__) + static_assert(false); + #endif + int main(){}" _CONAN_IS_GNU_LIBSTDCXX) + + # _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI true if C++11 ABI + check_cxx_source_compiles(" + #include + static_assert(sizeof(std::string) != sizeof(void*), \"using libstdc++\"); + int main () {}" _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI) + + set(_CONAN_GNU_LIBSTDCXX_SUFFIX "") + if(_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI) + set(_CONAN_GNU_LIBSTDCXX_SUFFIX "11") + endif() + unset (_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI) +endmacro() + + +macro(detect_libcxx) + # _CONAN_IS_LIBCXX true if LLVM libc++ + check_cxx_source_compiles(" + #include + #if !defined(_LIBCPP_VERSION) + static_assert(false); + #endif + int main(){}" _CONAN_IS_LIBCXX) +endmacro() + + +function(detect_lib_cxx LIB_CXX) + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + message(STATUS "CMake-Conan: android_stl=${CMAKE_ANDROID_STL_TYPE}") + set(${LIB_CXX} ${CMAKE_ANDROID_STL_TYPE} PARENT_SCOPE) + return() + endif() + + include(CheckCXXSourceCompiles) + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + detect_gnu_libstdcxx() + set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") + set(${LIB_CXX} "libc++" PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows") + # Check for libc++ + detect_libcxx() + if(_CONAN_IS_LIBCXX) + set(${LIB_CXX} "libc++" PARENT_SCOPE) + return() + endif() + + # Check for libstdc++ + detect_gnu_libstdcxx() + if(_CONAN_IS_GNU_LIBSTDCXX) + set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE) + return() + endif() + + # TODO: it would be an error if we reach this point + elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # Do nothing - compiler.runtime and compiler.runtime_type + # should be handled separately: https://github.com/conan-io/cmake-conan/pull/516 + return() + else() + # TODO: unable to determine, ask user to provide a full profile file instead + endif() +endfunction() + + +function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUNTIME_TYPE) + if(DEFINED CMAKE_CXX_COMPILER_ID) + set(_COMPILER ${CMAKE_CXX_COMPILER_ID}) + set(_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + else() + if(NOT DEFINED CMAKE_C_COMPILER_ID) + message(FATAL_ERROR "C or C++ compiler not defined") + endif() + set(_COMPILER ${CMAKE_C_COMPILER_ID}) + set(_COMPILER_VERSION ${CMAKE_C_COMPILER_VERSION}) + endif() + + message(STATUS "CMake-Conan: CMake compiler=${_COMPILER}") + message(STATUS "CMake-Conan: CMake compiler version=${_COMPILER_VERSION}") + + if(_COMPILER MATCHES MSVC) + set(_COMPILER "msvc") + string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION) + # Configure compiler.runtime and compiler.runtime_type settings for MSVC + if(CMAKE_MSVC_RUNTIME_LIBRARY) + set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY}) + else() + set(_msvc_runtime_library MultiThreaded$<$:Debug>DLL) # default value documented by CMake + endif() + + set(_KNOWN_MSVC_RUNTIME_VALUES "") + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded MultiThreadedDLL) + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreadedDebug MultiThreadedDebugDLL) + list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded$<$:Debug> MultiThreaded$<$:Debug>DLL) + + # only accept the 6 possible values, otherwise we don't don't know to map this + if(NOT _msvc_runtime_library IN_LIST _KNOWN_MSVC_RUNTIME_VALUES) + message(FATAL_ERROR "CMake-Conan: unable to map MSVC runtime: ${_msvc_runtime_library} to Conan settings") + endif() + + # Runtime is "dynamic" in all cases if it ends in DLL + if(_msvc_runtime_library MATCHES ".*DLL$") + set(_COMPILER_RUNTIME "dynamic") + else() + set(_COMPILER_RUNTIME "static") + endif() + message(STATUS "CMake-Conan: CMake compiler.runtime=${_COMPILER_RUNTIME}") + + # Only define compiler.runtime_type when explicitly requested + # If a generator expression is used, let Conan handle it conditional on build_type + if(NOT _msvc_runtime_library MATCHES ":Debug>") + if(_msvc_runtime_library MATCHES "Debug") + set(_COMPILER_RUNTIME_TYPE "Debug") + else() + set(_COMPILER_RUNTIME_TYPE "Release") + endif() + message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}") + endif() + + unset(_KNOWN_MSVC_RUNTIME_VALUES) + + elseif(_COMPILER MATCHES AppleClang) + set(_COMPILER "apple-clang") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _COMPILER_VERSION) + elseif(_COMPILER MATCHES Clang) + set(_COMPILER "clang") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _COMPILER_VERSION) + elseif(_COMPILER MATCHES GNU) + set(_COMPILER "gcc") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _COMPILER_VERSION) + endif() + + message(STATUS "CMake-Conan: [settings] compiler=${_COMPILER}") + message(STATUS "CMake-Conan: [settings] compiler.version=${_COMPILER_VERSION}") + if (_COMPILER_RUNTIME) + message(STATUS "CMake-Conan: [settings] compiler.runtime=${_COMPILER_RUNTIME}") + endif() + if (_COMPILER_RUNTIME_TYPE) + message(STATUS "CMake-Conan: [settings] compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}") + endif() + + set(${COMPILER} ${_COMPILER} PARENT_SCOPE) + set(${COMPILER_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE) + set(${COMPILER_RUNTIME} ${_COMPILER_RUNTIME} PARENT_SCOPE) + set(${COMPILER_RUNTIME_TYPE} ${_COMPILER_RUNTIME_TYPE} PARENT_SCOPE) +endfunction() + + +function(detect_build_type BUILD_TYPE) + get_property(_MULTICONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(NOT _MULTICONFIG_GENERATOR) + # Only set when we know we are in a single-configuration generator + # Note: we may want to fail early if `CMAKE_BUILD_TYPE` is not defined + set(${BUILD_TYPE} ${CMAKE_BUILD_TYPE} PARENT_SCOPE) + endif() +endfunction() + +macro(set_conan_compiler_if_appleclang lang command output_variable) + if(CMAKE_${lang}_COMPILER_ID STREQUAL "AppleClang") + execute_process(COMMAND xcrun --find ${command} + OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE) + cmake_path(GET _xcrun_out PARENT_PATH _xcrun_toolchain_path) + cmake_path(GET CMAKE_${lang}_COMPILER PARENT_PATH _compiler_parent_path) + if ("${_xcrun_toolchain_path}" STREQUAL "${_compiler_parent_path}") + set(${output_variable} "") + endif() + unset(_xcrun_out) + unset(_xcrun_toolchain_path) + unset(_compiler_parent_path) + endif() +endmacro() + + +macro(append_compiler_executables_configuration) + set(_conan_c_compiler "") + set(_conan_cpp_compiler "") + if(CMAKE_C_COMPILER) + set(_conan_c_compiler "\"c\":\"${CMAKE_C_COMPILER}\",") + set_conan_compiler_if_appleclang(C cc _conan_c_compiler) + else() + message(WARNING "CMake-Conan: The C compiler is not defined. " + "Please define CMAKE_C_COMPILER or enable the C language.") + endif() + if(CMAKE_CXX_COMPILER) + set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"") + set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler) + else() + message(WARNING "CMake-Conan: The C++ compiler is not defined. " + "Please define CMAKE_CXX_COMPILER or enable the C++ language.") + endif() + + if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "x") + string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n") + endif() + unset(_conan_c_compiler) + unset(_conan_cpp_compiler) +endmacro() + + +function(detect_host_profile output_file) + detect_os(MYOS MYOS_API_LEVEL MYOS_SDK MYOS_SUBSYSTEM MYOS_VERSION) + detect_arch(MYARCH) + detect_compiler(MYCOMPILER MYCOMPILER_VERSION MYCOMPILER_RUNTIME MYCOMPILER_RUNTIME_TYPE) + detect_cxx_standard(MYCXX_STANDARD) + detect_lib_cxx(MYLIB_CXX) + detect_build_type(MYBUILD_TYPE) + + set(PROFILE "") + string(APPEND PROFILE "[settings]\n") + if(MYARCH) + string(APPEND PROFILE arch=${MYARCH} "\n") + endif() + if(MYOS) + string(APPEND PROFILE os=${MYOS} "\n") + endif() + if(MYOS_API_LEVEL) + string(APPEND PROFILE os.api_level=${MYOS_API_LEVEL} "\n") + endif() + if(MYOS_VERSION) + string(APPEND PROFILE os.version=${MYOS_VERSION} "\n") + endif() + if(MYOS_SDK) + string(APPEND PROFILE os.sdk=${MYOS_SDK} "\n") + endif() + if(MYOS_SUBSYSTEM) + string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n") + endif() + if(MYCOMPILER) + string(APPEND PROFILE compiler=${MYCOMPILER} "\n") + endif() + if(MYCOMPILER_VERSION) + string(APPEND PROFILE compiler.version=${MYCOMPILER_VERSION} "\n") + endif() + if(MYCOMPILER_RUNTIME) + string(APPEND PROFILE compiler.runtime=${MYCOMPILER_RUNTIME} "\n") + endif() + if(MYCOMPILER_RUNTIME_TYPE) + string(APPEND PROFILE compiler.runtime_type=${MYCOMPILER_RUNTIME_TYPE} "\n") + endif() + if(MYCXX_STANDARD) + string(APPEND PROFILE compiler.cppstd=${MYCXX_STANDARD} "\n") + endif() + if(MYLIB_CXX) + string(APPEND PROFILE compiler.libcxx=${MYLIB_CXX} "\n") + endif() + if(MYBUILD_TYPE) + string(APPEND PROFILE "build_type=${MYBUILD_TYPE}\n") + endif() + + if(NOT DEFINED output_file) + set(_FN "${CMAKE_BINARY_DIR}/profile") + else() + set(_FN ${output_file}) + endif() + + string(APPEND PROFILE "[conf]\n") + string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n") + + # propagate compilers via profile + append_compiler_executables_configuration() + + if(MYOS STREQUAL "Android") + string(APPEND PROFILE "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n") + endif() + + message(STATUS "CMake-Conan: Creating profile ${_FN}") + file(WRITE ${_FN} ${PROFILE}) + message(STATUS "CMake-Conan: Profile: \n${PROFILE}") +endfunction() + + +function(conan_profile_detect_default) + message(STATUS "CMake-Conan: Checking if a default profile exists") + execute_process(COMMAND ${CONAN_COMMAND} profile path default + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + ECHO_OUTPUT_VARIABLE + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + if(NOT ${return_code} EQUAL "0") + message(STATUS "CMake-Conan: The default profile doesn't exist, detecting it.") + execute_process(COMMAND ${CONAN_COMMAND} profile detect + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + ECHO_OUTPUT_VARIABLE + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() +endfunction() + + +function(conan_install) + cmake_parse_arguments(ARGS CONAN_ARGS ${ARGN}) + set(CONAN_OUTPUT_FOLDER ${CMAKE_BINARY_DIR}/conan) + # Invoke "conan install" with the provided arguments + set(CONAN_ARGS ${CONAN_ARGS} -of=${CONAN_OUTPUT_FOLDER}) + message(STATUS "CMake-Conan: conan install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN}") + + + # In case there was not a valid cmake executable in the PATH, we inject the + # same we used to invoke the provider to the PATH + if(DEFINED PATH_TO_CMAKE_BIN) + set(_OLD_PATH $ENV{PATH}) + set(ENV{PATH} "$ENV{PATH}:${PATH_TO_CMAKE_BIN}") + endif() + + execute_process(COMMAND ${CONAN_COMMAND} install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN} --format=json + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + ECHO_ERROR_VARIABLE # show the text output regardless + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(DEFINED PATH_TO_CMAKE_BIN) + set(ENV{PATH} "${_OLD_PATH}") + endif() + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan install failed='${return_code}'") + else() + # the files are generated in a folder that depends on the layout used, if + # one is specified, but we don't know a priori where this is. + # TODO: this can be made more robust if Conan can provide this in the json output + string(JSON CONAN_GENERATORS_FOLDER GET ${conan_stdout} graph nodes 0 generators_folder) + cmake_path(CONVERT ${CONAN_GENERATORS_FOLDER} TO_CMAKE_PATH_LIST CONAN_GENERATORS_FOLDER) + # message("conan stdout: ${conan_stdout}") + message(STATUS "CMake-Conan: CONAN_GENERATORS_FOLDER=${CONAN_GENERATORS_FOLDER}") + set_property(GLOBAL PROPERTY CONAN_GENERATORS_FOLDER "${CONAN_GENERATORS_FOLDER}") + # reconfigure on conanfile changes + string(JSON CONANFILE GET ${conan_stdout} graph nodes 0 label) + message(STATUS "CMake-Conan: CONANFILE=${CMAKE_SOURCE_DIR}/${CONANFILE}") + set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/${CONANFILE}") + # success + set_property(GLOBAL PROPERTY CONAN_INSTALL_SUCCESS TRUE) + endif() +endfunction() + + +function(conan_get_version conan_command conan_current_version) + execute_process( + COMMAND ${conan_command} --version + OUTPUT_VARIABLE conan_output + RESULT_VARIABLE conan_result + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(conan_result) + message(FATAL_ERROR "CMake-Conan: Error when trying to run Conan") + endif() + + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" conan_version ${conan_output}) + set(${conan_current_version} ${conan_version} PARENT_SCOPE) +endfunction() + + +function(conan_version_check) + set(options ) + set(oneValueArgs MINIMUM CURRENT) + set(multiValueArgs ) + cmake_parse_arguments(CONAN_VERSION_CHECK + "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT CONAN_VERSION_CHECK_MINIMUM) + message(FATAL_ERROR "CMake-Conan: Required parameter MINIMUM not set!") + endif() + if(NOT CONAN_VERSION_CHECK_CURRENT) + message(FATAL_ERROR "CMake-Conan: Required parameter CURRENT not set!") + endif() + + if(CONAN_VERSION_CHECK_CURRENT VERSION_LESS CONAN_VERSION_CHECK_MINIMUM) + message(FATAL_ERROR "CMake-Conan: Conan version must be ${CONAN_VERSION_CHECK_MINIMUM} or later") + endif() +endfunction() + + +macro(construct_profile_argument argument_variable profile_list) + set(${argument_variable} "") + if("${profile_list}" STREQUAL "CONAN_HOST_PROFILE") + set(_arg_flag "--profile:host=") + elseif("${profile_list}" STREQUAL "CONAN_BUILD_PROFILE") + set(_arg_flag "--profile:build=") + endif() + + set(_profile_list "${${profile_list}}") + list(TRANSFORM _profile_list REPLACE "auto-cmake" "${CMAKE_BINARY_DIR}/conan_host_profile") + list(TRANSFORM _profile_list PREPEND ${_arg_flag}) + set(${argument_variable} ${_profile_list}) + + unset(_arg_flag) + unset(_profile_list) +endmacro() + + +macro(conan_provide_dependency method package_name) + set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE) + get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS) + if(NOT _conan_install_success) + find_program(CONAN_COMMAND "conan" REQUIRED) + conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION) + conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION}) + message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan") + if("default" IN_LIST CONAN_HOST_PROFILE OR "default" IN_LIST CONAN_BUILD_PROFILE) + conan_profile_detect_default() + endif() + if("auto-cmake" IN_LIST CONAN_HOST_PROFILE) + detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile) + endif() + construct_profile_argument(_host_profile_flags CONAN_HOST_PROFILE) + construct_profile_argument(_build_profile_flags CONAN_BUILD_PROFILE) + if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py") + file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile) + if(NOT "${outfile}" MATCHES ".*CMakeDeps.*") + message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile") + endif() + set(generator "") + elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt") + file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile) + if(NOT "${outfile}" MATCHES ".*CMakeDeps.*") + message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. " + "Please define the generator as it will be mandatory in the future") + endif() + set(generator "-g;CMakeDeps") + endif() + get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(NOT _multiconfig_generator) + message(STATUS "CMake-Conan: Installing single configuration ${CMAKE_BUILD_TYPE}") + conan_install(${_host_profile_flags} ${_build_profile_flags} ${CONAN_INSTALL_ARGS} ${generator}) + else() + message(STATUS "CMake-Conan: Installing both Debug and Release") + conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Release ${CONAN_INSTALL_ARGS} ${generator}) + conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Debug ${CONAN_INSTALL_ARGS} ${generator}) + endif() + unset(_host_profile_flags) + unset(_build_profile_flags) + unset(_multiconfig_generator) + unset(_conan_install_success) + else() + message(STATUS "CMake-Conan: find_package(${ARGV1}) found, 'conan install' already ran") + unset(_conan_install_success) + endif() + + get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER) + + # Ensure that we consider Conan-provided packages ahead of any other, + # irrespective of other settings that modify the search order or search paths + # This follows the guidelines from the find_package documentation + # (https://cmake.org/cmake/help/latest/command/find_package.html): + # find_package ( PATHS paths... NO_DEFAULT_PATH) + # find_package () + + # Filter out `REQUIRED` from the argument list, as the first call may fail + set(_find_args_${package_name} "${ARGN}") + list(REMOVE_ITEM _find_args_${package_name} "REQUIRED") + if(NOT "MODULE" IN_LIST _find_args_${package_name}) + find_package(${package_name} ${_find_args_${package_name}} BYPASS_PROVIDER PATHS "${_conan_generators_folder}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + unset(_find_args_${package_name}) + endif() + + # Invoke find_package a second time - if the first call succeeded, + # this will simply reuse the result. If not, fall back to CMake default search + # behaviour, also allowing modules to be searched. + if(NOT ${package_name}_FOUND) + list(FIND CMAKE_MODULE_PATH "${_conan_generators_folder}" _index) + if(_index EQUAL -1) + list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}") + endif() + unset(_index) + find_package(${package_name} ${ARGN} BYPASS_PROVIDER) + list(REMOVE_ITEM CMAKE_MODULE_PATH "${_conan_generators_folder}") + endif() +endmacro() + +#[=[ not needed by Qt Creator, and if not commented it would break the auto-setup feature + +cmake_language( + SET_DEPENDENCY_PROVIDER conan_provide_dependency + SUPPORTED_METHODS FIND_PACKAGE +) + + +macro(conan_provide_dependency_check) + set(_CONAN_PROVIDE_DEPENDENCY_INVOKED FALSE) + get_property(_CONAN_PROVIDE_DEPENDENCY_INVOKED GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED) + if(NOT _CONAN_PROVIDE_DEPENDENCY_INVOKED) + message(WARNING "Conan is correctly configured as dependency provider, " + "but Conan has not been invoked. Please add at least one " + "call to `find_package()`.") + if(DEFINED CONAN_COMMAND) + # supress warning in case `CONAN_COMMAND` was specified but unused. + set(_CONAN_COMMAND ${CONAN_COMMAND}) + unset(_CONAN_COMMAND) + endif() + endif() + unset(_CONAN_PROVIDE_DEPENDENCY_INVOKED) +endmacro() + + +# Add a deferred call at the end of processing the top-level directory +# to check if the dependency provider was invoked at all. +cmake_language(DEFER DIRECTORY "${CMAKE_SOURCE_DIR}" CALL conan_provide_dependency_check) + +]=] + +# Configurable variables for Conan profiles +set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile") +set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile") +set(CONAN_INSTALL_ARGS "--build=missing" CACHE STRING "Command line arguments for conan install") + +find_program(_cmake_program NAMES cmake NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) +if(NOT _cmake_program) + get_filename_component(PATH_TO_CMAKE_BIN "${CMAKE_COMMAND}" DIRECTORY) + set(PATH_TO_CMAKE_BIN "${PATH_TO_CMAKE_BIN}" CACHE INTERNAL "Path where the CMake executable is") +endif() + diff --git a/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/maintenance_tool_provider.cmake b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/maintenance_tool_provider.cmake new file mode 100644 index 0000000000..06adab687b --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/maintenance_tool_provider.cmake @@ -0,0 +1,329 @@ +function(qt_maintenance_tool_get_component_platform platform_dir component_platform) + # Mapping between platform file directory and component platform + set(map_llvm-mingw_64 win64_llvm_mingw) + set(map_mingw_64 win64_mingw) + set(map_msvc2019_64 win64_msvc2019_64) + set(map_msvc2022_64 win64_msvc2022_64) + set(map_msvc2022_arm64 win64_msvc2022_arm64) + set(map_gcc_64 linux_gcc_64) + set(map_gcc_arm64 linux_gcc_arm64) + set(map_ios ios) + set(map_macos clang_64) + set(map_android_arm64_v8a android) + set(map_android_armv7 android) + set(map_android_x86 android) + set(map_android_x86_64 android) + set(map_wasm_multithread wasm_multithread) + set(map_wasm_singlethread wasm_singlethread) + + if (platform_dir STREQUAL "msvc2022_arm64" AND QT_HOST_PATH) + set(${component_platform} "win64_msvc2022_arm64_cross_compiled" PARENT_SCOPE) + return() + endif() + + set(${component_platform} ${map_${platform_dir}} PARENT_SCOPE) +endfunction() + +function(qt_maintenance_tool_get_addons addon_list) + set(${addon_list} + qt3d + qt5compat + qtcharts + qtconnectivity + qtdatavis3d + qtgraphs + qtgrpc + qthttpserver + qtimageformats + qtlocation + qtlottie + qtmultimedia + qtnetworkauth + qtpositioning + qtquick3d + qtquick3dphysics + qtquickeffectmaker + qtquicktimeline + qtremoteobjects + qtscxml + qtsensors + qtserialbus + qtserialport + qtshadertools + qtspeech + qtvirtualkeyboard + qtwebchannel + qtwebsockets + qtwebview + + # found in commercial version + qtapplicationmanager + qtinterfraceframework + qtlanguageserver + qtmqtt + qtstatemachine + qtopcua + tqtc-qtvncserver + + PARENT_SCOPE + ) +endfunction() + +function(qt_maintenance_tool_get_extensions extensions) + set(${extensions} + qtinsighttracker + qtpdf + qtwebengine + + PARENT_SCOPE + ) +endfunction() + +function(qt_maintenance_tool_get_standalone_addons standalone_addons_list) + set(${standalone_addons_list} + qtquick3d + qt5compat + qtshadertools + qtquicktimeline + + PARENT_SCOPE + ) +endfunction() + +function(qt_maintenance_tool_remove_installed_components components_list) + set(actual_components_list ${${components_list}}) + execute_process( + COMMAND "${QT_MAINTENANCE_TOOL}" list + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + TIMEOUT 600 + ) + if (NOT result EQUAL 0) + message(WARNING "Qt MaintenanceTool returned an error.\n${output}") + set(${components_list} "" PARENT_SCOPE) + return() + endif() + + foreach(component_name IN LISTS actual_components_list) + string(FIND "${output}" "
" + + "Do you want to install the missing packages?", + QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes); + if (result == QMessageBox.No) { + gui.rejectWithoutPrompt(); + } else { + var ifwVersion = installer.value("FrameworkVersion"); + if (installer.versionMatches(ifwVersion, "=4.9.0")) + gui.clickButton("submitButtonLogin"); + else + gui.clickButton(buttons.NextButton); + } +} + +usageStatisticVisible = function() +{ + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.CredentialsPageCallback = function() +{ + var page = gui.currentPageWidget(); + page.accountFieldsVisible.connect(accountFieldsVisible) + var ifwVersion = installer.value("FrameworkVersion"); + if (installer.versionMatches(ifwVersion, "=4.9.0")) + page.usageStatisticVisible.connect(usageStatisticVisible); +} + +Controller.prototype.IntroductionPageCallback = function() +{ + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ComponentSelectionPageCallback = function() +{ + var componentsString = installer.environmentVariable("QTC_MAINTENANCE_TOOL_COMPONENTS"); + var componentsList = componentsString.split(";"); + for (var idx = 0; idx < componentsList.length; idx++) { + installer.selectComponent(componentsList[idx]); + } + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.FinishedPageCallback = function() +{ + gui.clickButton(buttons.FinishButton); +} + +function Controller() +{ + installer.installationFinished.connect(function() { + gui.clickButton(buttons.NextButton); + }) +} diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeCache.txt b/src/dynarmic/tests/build/Desktop-Debug/CMakeCache.txt new file mode 100644 index 0000000000..03332625f5 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/CMakeCache.txt @@ -0,0 +1,409 @@ +# This is the CMakeCache file. +# For build in directory: /data/code/eden/src/dynarmic/tests/build/Desktop-Debug +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//No help, variable specified on the command line. +CMAKE_BUILD_TYPE:STRING=Debug + +//No help, variable specified on the command line. +CMAKE_COLOR_DIAGNOSTICS:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:STRING=/usr/lib/ccache/bin/g++-14 + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING=-DQT_QML_DEBUG + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//No help, variable specified on the command line. +CMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:STRING=/usr/lib/ccache/bin/gcc-14 + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=/usr/lib/llvm/20/bin/dlltool + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of build database during the build. +CMAKE_EXPORT_BUILD_DATABASE:BOOL= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/pkgRedirects + +//No help, variable specified on the command line. +CMAKE_GENERATOR:STRING=Ninja + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Program used to build from build.ninja files. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//No help, variable specified on the command line. +CMAKE_PREFIX_PATH:PATH=/usr + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//No help, variable specified on the command line. +CMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=Project + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +Project_BINARY_DIR:STATIC=/data/code/eden/src/dynarmic/tests/build/Desktop-Debug + +//Value Computed by CMake +Project_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +Project_SOURCE_DIR:STATIC=/data/code/eden/src/dynarmic/tests + +//Use CLI mode for Qt Creator's MaintenanceTool find_package provider +QT_CREATOR_MAINTENANCE_TOOL_PROVIDER_USE_CLI:BOOL=OFF + +//Skip Qt Creator's MaintenanceTool find_package provider +QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER:BOOL=OFF + +//Skip Qt Creator's package manager auto-setup +QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP:BOOL=OFF + +//Qt Creator source groups extensions +QT_CREATOR_SOURCE_GROUPS:BOOL=ON + +//No help, variable specified on the command line. +QT_MAINTENANCE_TOOL:FILEPATH=/data/Qt/MaintenanceTool + +//No help, variable specified on the command line. +QT_QMAKE_EXECUTABLE:FILEPATH=/usr/bin/qmake6 + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/data/code/eden/src/dynarmic/tests/build/Desktop-Debug +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=4 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=0 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_BUILD_DATABASE +CMAKE_EXPORT_BUILD_DATABASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/data/code/eden/src/dynarmic/tests +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//Name of CMakeLists files to read +CMAKE_LIST_FILE_NAME:INTERNAL=CMakeLists.txt +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCCompiler.cmake b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCCompiler.cmake new file mode 100644 index 0000000000..b8bbaeeb03 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCCompiler.cmake @@ -0,0 +1,84 @@ +set(CMAKE_C_COMPILER "/usr/lib/ccache/bin/gcc-14") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "14.2.1") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_STANDARD_LATEST "23") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_COMPILER_APPLE_SYSROOT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_LINKER_LINK "") +set(CMAKE_LINKER_LLD "") +set(CMAKE_C_COMPILER_LINKER "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld") +set(CMAKE_C_COMPILER_LINKER_ID "GNU") +set(CMAKE_C_COMPILER_LINKER_VERSION 2.44.0) +set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT GNU) +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE) +set(CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) +set(CMAKE_C_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include;/usr/local/include;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-pc-linux-gnu/14;/usr/lib64;/lib64;/usr/x86_64-pc-linux-gnu/lib;/usr/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCXXCompiler.cmake b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000000..aff992c4f2 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeCXXCompiler.cmake @@ -0,0 +1,108 @@ +set(CMAKE_CXX_COMPILER "/usr/lib/ccache/bin/g++-14") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "14.2.1") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_STANDARD_LATEST "26") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23;cxx_std_26") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") +set(CMAKE_CXX26_COMPILE_FEATURES "cxx_std_26") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_COMPILER_APPLE_SYSROOT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_LINKER_LINK "") +set(CMAKE_LINKER_LLD "") +set(CMAKE_CXX_COMPILER_LINKER "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld") +set(CMAKE_CXX_COMPILER_LINKER_ID "GNU") +set(CMAKE_CXX_COMPILER_LINKER_VERSION 2.44.0) +set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT GNU) +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang IN ITEMS C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) +set(CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) +set(CMAKE_CXX_LINKER_PUSHPOP_STATE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include;/usr/local/include;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-pc-linux-gnu/14;/usr/lib64;/lib64;/usr/x86_64-pc-linux-gnu/lib;/usr/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") +set(CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR "") + +set(CMAKE_CXX_COMPILER_IMPORT_STD "") +### Imported target for C++23 standard library +set(CMAKE_CXX23_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE "Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)") + + +### Imported target for C++26 standard library +set(CMAKE_CXX26_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE "Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)") + + + diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeDetermineCompilerABI_C.bin b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000000000000000000000000000000000000..a69a148093882715069d5048a0ab23b1ee0e5380 GIT binary patch literal 15424 zcmeHOU2Ggz6~4QP8;7L!Ce*Jy@q*VuJ_% zUOE7Ruk{y~9s~GG(EkRWtyvQAkho;HUmf)(ixhL*N_a>cotKI6X)sJ>4Cp|XgWZjZGohy58X>2H&FBaUf%tYR$wx(x`1!>(e zp&JG&6{XzqpE&?T$ma24yUp*-ZCB*u{eZcjeEpl0<|rL`Ou_#X_T!Vg48JD-XW*6a z^$Ft#5Bv2KhUaa_+XUr`kC$CUyRP|oIdo}$)yHF>WyhM2$G)Kj;UdgHn1L_@VFtns zgc%4k5N06E!2clwe{X!?U3=+zy?w6kw?~w+zgqF4)l2r$EAcO*J0qQ`&BOJH2xGbN0%c_R=3$PmZP9Ds8XX=eysf2C7YE3jN2F)p+15 zx;^5bBgQ^o_YHrZo?y53d2GIcAK`@0yhNqmeBb@Jy>ivtX`kzUi>zzgtJUhY zK3bf4weAffBK|S?>&VZao}gfEnA=%-`ntU`f8`gc8@&GKQrGQo+2@i(8|OF9tn7-pJGRvp`EX&Rnc*)7n<#uEP>$Ak09RfiMGM2Eq)4 z83;2FW+2Q!n1L_@@8=Bgd$&84^l<;k@iM&^EKWJuIj?lOwd;&OemFhSKXKe!blg(W z&7Ll$d!2#dRJw1tN9j1NpIG!C?axf)PSZRD7DV=K z`2@f7<9BEm{#vb$6FyJ4O!y;0oA9;OYV~_+0a(3?>0$2&-R zJG#zhEsvM|+#VNh>&{zGhlPtU17QZj41^g7GZ1DV%s`ldFau!*-lrMBJW0%p#Qlc8 z>7ktLL|*jGk)nCtru;_cQGQr#%)i_xHg0|Pij8@ge80p6{(s)A7TNBS8zIbzTos$= zVR9K4`vb;Q%Yr)un+2N$0U}csnRmHO96#k7C@L67MO#YIBvW0`-UDJI?%!22UdofE zZi>Au?a`ZFy*|hz-4<$lLHzHCjd4ly|2x3^@c*(!%!eIFCXdGt4Y&obSd6!I(A?iP zXRf`qy|eXbYg>G->#&elKVKw%ca;7m|8GImU?>A)}+c6ri#w3hfvN$ZrX7R z*<7Y@n=7C5yu7>4OHZei(|2mPXDFSd3GVdt#Yx#t|7g!p%CY-Kl`}9n(%UoWjP&DzT>&#?H4@+5vqUY*C%$16BZpm8|iuRBeFEedA za5AM*hCJLP>ePE?HaAJ*<*i^*29-5goSmgZWNoK=?-f3O(ym;4ju-qM3g=Jsz_I@F zQ8NBT=a{IFIIjW^3Xk&-&TD9cKTqOwD)cz-0xw7)A0N1H=yAU6B#zsL9_Ml3GWq-^ zIR0*O@;MZGoHv2E9>Mq#2Yi(Dd`^aq^D>anCtQN#H>^^p#0NdD6Mz*7ME}9{pCmu8 z6Rulo$0Io|;rd9L(c?g!F-JeYJ}x?-m^BG(U?HGy6$cP;XaF|w$$&l~4&bwa4F(kv+wVq503v8a`3ef_D@`w<9oMYf3Sgv-?*0I-~MZVP-)oBQmwRdcz6h9gz+}Ty>}&wA`!q zs9Q+hqB&0=_kgrsdpEifYlN>NWWQb9sepSunsRszBV=U1&Dw=(PXko49_*)8B7+CM zFA0F)%lTrGF@TrE59s&f+7uf-zhdV`9G1F_3Br#>_FECZ74ZYENj@Oz$u;5M*xj_K zfWscGfI+_>iC++7;s-?SAH3qG|C4;f;&)yG2JwrM4~TqUCO@vrzuK^wMg&CBkmF5ADD(ZnW; zUgB@7pyP4JD)5}A63=z2#E%hw5B)yTENf~epR)>X%5g1AS;^4>D{VXWRHoqC&gejQ zHlMRcQ{!3N(^b}3RGtY5GLy>Wlx0oKr>x0LE|twZZYxq3-1NkuLtL?T7H7)6sR{CA zsfGCokMHYGp6Iq(jl*pU-Bv>%bE>Gu{O4^b#%F1zuzi2>?e9?etJDj^&F#+Is>tRg zS#kW|VSgXq=_xMB{}p&8d`;ZbgNOX?agXP1jcv@#s*mSwgm%@(%Pyu>Yd&5MeVV`S z-TOU~ChPY1C@r`AKDm7P5p($ibLm%W!=s6oV#_<` zxz3L%K&jygGW~GUsN4Sy9gp}Ii80SrKgV$Ny1S23Kf--Vy|c7Bxo*q(E(T=sKdJqX zj4&L$X)dpsZ(Of3-}u9EGxC;s`KG&<0`8N5^?`t&h{x-**jY{HYVNSP)OpdM-b3c{ z6?eONw)58{UA?tbDqZcN#p$=I-yDxD#`K=?G_D}*NDJ8PxV1wwAOd!QnZkEqCe zePqw}tu^QAMI7@yci;^9e4cH3w(3`g2dLXdzx#;SL~VU z^lMZ0f0%ytu%kXVj_K0xZW_ZAOeAXSzZLD?aZA*p%uINV#~-I3zbot;e2Cv(7Ma64 zzv!YT*Ad5!-f(I?-XTT8 zafALZH%obzJLE@ zl%mO^x*^_OBE#-)C2zb`M@`)n`4x#rZ+i9mpw4t#sO1Zy|43wvOTvF@fO+BnZ9vR( z?d$G77Q3&{&bj$~tfkFpHCn9M*5=kD&4-&?VzV6wg^YpwCyBW(ThyOQK{MWuBJ>qO zEaqvj9h-!Y3yWlS1(YNFq7d{pyxc0~eM)O<73Q78_&MrC=&3=lp5N7cLwSFK z{j1ceS9hrTI2aEPMU;vWuW$Z+s-IGSC#^3jb(7sgy-m_R9<^cl0ZF&1ZR(`_-|1%! z#QlbTJEM0fY%e%{$oA3g3je3zc@jpYdFD+tPL3a!iPZWT3EAGse3W)|;Spya@tilf zz6XitIt16ZUGsOUU2#P4@P6Tgar%glZ8X)=#3sD639q^bQeU&X$HuzzGqahj?R1?; z8WXd#%KB=5OM50anYVmTvzTr5*!5>r)_7*hvUBN7il()b{;2ly>9ZNv&DuVb4sAhC zv1l4RJ)E%;rqw&rHIT5(o)KmBoE+>LNOmi$uYc%7SHCsX+xuW*)EezNK@Y-|Wv5ea zissr6(RBKBCTGnR>~vr{ecV4KUZ&fp3wdigl}qzHeVTU9sRMKJ%U(36-XaT^OlW>T zKYQbe{}$)w?VK-=h)d4J19f1mob}l6)%jbJat@qo|d{OhLhLj zHSB3?(n-zO)^wWuAt@u5cWph0StmbhJMMx|wA(bgsVOgkm2#XEX*eYMlsz?*nV|9V z<};{t%9zN{%+Qgu!fyO;Q+!^fUA+8!FZi7l&Z`K_w*K}x68=i(o~V#G-vSQ^kMk1F zcZk8CAMv>s{x}~4&x;`+$2d3qaUSJQH#j!@aefEBOgeuHj=z(Xd~St5&Zj_Jr(pcB z13p0he6EI!^EI$pk_X3+F`c9i>)^l20ySV!OY6^bgX=#*dR`}7&yGvvKd!6rT_e6<#JJ&y{m3C-u0Q;7JzwMtL~3!pTwlN+c!gAc|FT1~=Yu?m z06)mTqYiV(kL#6s@ekT_E`M7ifjKcRtKi>SX1osk{fK?XZ)!@wr$x#4TYQg%@!>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && defined(__ti__) +# define COMPILER_ID "TIClang" + # define COMPILER_VERSION_MAJOR DEC(__ti_major__) + # define COMPILER_VERSION_MINOR DEC(__ti_minor__) + # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__) +# define COMPILER_VERSION_INTERNAL DEC(__ti_version__) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "ARM" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) || defined(__CPARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#define C_STD_99 199901L +#define C_STD_11 201112L +#define C_STD_17 201710L +#define C_STD_23 202311L + +#ifdef __STDC_VERSION__ +# define C_STD __STDC_VERSION__ +#endif + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif C_STD > C_STD_17 +# define C_VERSION "23" +#elif C_STD > C_STD_11 +# define C_VERSION "17" +#elif C_STD > C_STD_99 +# define C_VERSION "11" +#elif C_STD >= C_STD_99 +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR) + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdC/a.out b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdC/a.out new file mode 100755 index 0000000000000000000000000000000000000000..62c5a7412faadd6ba9e14dbb7ddb3c8aca687df1 GIT binary patch literal 15544 zcmeHOUu+yl8J{~liAz%Z9B>+vv{`6crKsNcUxHg?a{hDny0R0Kx}eAn%f`31Pn_?p zyESnlMNMUB?-EY3%_h)9lncLmjnSCxb)E|$<6jF`)v|=uqFi27a=l4p6NK$pG`{}$x zZCC4wuhp25Ck-K~Nmt^lX`SFTMA>dDXR6R02BtDhLJgU+-CAjRosoblX$RYBk?_Dl z8>OD0z{}-XQev2jodT^Wk7KjkZ0wf1R#QjxM?!YYvYoPxK6QslLYE{Epok~Ogpacy zGwNYFVqgUtw!12JVQPsTC}RKgwIKc9ls6)FzZQpK`nZ$_it;`~b~-L1zZXF_ACmIc z>W75HA5_At_GB|h_jT;arkk^w-0WQQT<5;#eI0f&Z@1~9*^I{%>zjH#uW=cE>azcv zX$`D#V!O>%WW9u0Rd9C=Jhuk^VZuLN#gB4bYT3A347@_%PJ5XgA>(tNJCVtG*~|%F zv6$PrPYnzW_Vl`KcALGooNwOY(D3YdPlQ9`I?;0=ft~f zRI4f~`oqNZ&s+dv#B+VoZ?oGn_bFAQcpNbH)31G#!W^e7k4gAHVH}S%8hl0mXTX)< zbx9)!4n7gWEz9U_4dDgBtq}gA;JZWkHw149;Xe`l%6_F2j~yNhNLMRx9%D$?D{#4F zYSD59j{gb^Rw{6eN%)Fr6oDuLQ3Rq0L=lK05Je!0!2fRq-fnp4U1$DAowK;^cYBm_ zzOod=OP8Gai*>K*pp^E0pWxCXKcsWR&ZJ`f(j%`DH_@=OPiemOuY(JhKkqF3!I}Tl z^2lhab*c3Y=S zT;6LTp6s93_Ipn-dF+<6u>!6t;xG|%c!xi3&#A6vQdhI> z&V1J&dEWhuvv4igk;{gPiOX7ahQ7M)rr)LIkJX)0`?o#uiS}K*e5viZ+$+#ykP`b0=y;R- z{+NMOed2|9@BQoJ-=mTlFp2A)q=VP&DB9dRON?R7FMi7K4TN!`HB>Ff8X~Q#uHxC2 z>&tTX$BBL2z1Ou`bc!MnMIeem6oDuLQ3Rq0L=lK05Jlhv9s%r=#J)((8}#Ib+O`Sp z(~}%U`@Bu6mCdRj6(0L9w+oLc%r@b%50mFToFM<_tx}%(PMOePZ{o7>ydRR&7li+i zVby7&8-;Ea+9VW2%+!+Xf7~E~^E?rvgnD#J!)cSLPVo1T@X-5r$<&wBHFQh()8da- zdUbmcN19%0eoo}?2oHba{{17^AO0RaVn3{98AsUf`l9gI&x-x41HHXZTDu4QT#(OO zG|_LfTiuzqmbSeu?Jcd=Oy^?)TEOm6KaO9m`g^IGS~Z;K=`o&dhuZ(3c2KXduN?kb zw0={0TmbK8Cg~OO=O~|0TU2MV0;KE}$GCi(*o1mO zB?UK9rM^y?&1z%$dyq#(utKzv>Yqp&0Djg}N3x%A95xfqeh$liZ2b;|OdlYe+ZEP- zm~rwS-dEj2xMhl5b$*s`T*E2_#|YmXr`pN&46>7ibKH`aLE1#{lE$|vD`^0z!V$xGBf&Kh!;(a-F_I${iRw*wa1a9_;UbIyLH! zcJ~aWXg_>-^L-L~?C-U&-cNghr+AlshP*IiHrd~?7!ghF=xZH!{WJ(}8!CXizY83b{;p7M%Q z%1$58k-DKl!ARg!s|n+htl(!oHc+-M-=4_^icj`ro-zRiOWC?B>_T35jO|ak69sSD zcc;>14^G*+eBf*EGll$&UkHv1)ZH`K9C(wa0M{!NJd&_WJfl`Cblt z-0wlpiXLCjxNO+tKFyz_v2WPp`2qAa$tqL0{#_*GdpGQHzXru~5b6&-(5J|rp9R3< zc>t8}H=M%tH>gsFMFx93pMc`|1m%a@KTh`CruA@$>zhzKmqE<+s7x7RD(x+?1BE-- zfCtTm>{~`$VgUNfP=|&6oebII{tAlcR+JxZ|Gd~E{>lGHaA~0CB zNI9+|?D4z-`gmE>WWwe1eZJCu#WH%JuNby`M*jo&0cH5v7Ui$?y&v?$_UA(OYkl_z z`*8g)lAxXrj8Du5@SR<_Jn*2G$d=bIV2}C23SSr~LC@bcBq{Aw($9!RF4_hmh)aTnL*n?gpQKfy^pvBm9-Zs@a*a7|vWf(*Gc>d`W z`>?(=2j*&-a*T<38HYWdXCQ!mCB@i*4$~QNcwU6t2;(@TKDhq!ya{!uY&q?2H`!NE XkVrx-J$qHR|3!x}ct`9&!uJ0GQ?~b3 literal 0 HcmV?d00001 diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000000..4591af6bfb --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,923 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && defined(__ti__) +# define COMPILER_ID "TIClang" + # define COMPILER_VERSION_MAJOR DEC(__ti_major__) + # define COMPILER_VERSION_MINOR DEC(__ti_minor__) + # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__) +# define COMPILER_VERSION_INTERNAL DEC(__ti_version__) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "ARM" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) || defined(__CPARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#define CXX_STD_98 199711L +#define CXX_STD_11 201103L +#define CXX_STD_14 201402L +#define CXX_STD_17 201703L +#define CXX_STD_20 202002L +#define CXX_STD_23 202302L + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) +# if _MSVC_LANG > CXX_STD_17 +# define CXX_STD _MSVC_LANG +# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17 +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 +# define CXX_STD CXX_STD_17 +# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# elif defined(__INTEL_CXX11_MODE__) +# define CXX_STD CXX_STD_11 +# else +# define CXX_STD CXX_STD_98 +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# if _MSVC_LANG > __cplusplus +# define CXX_STD _MSVC_LANG +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__NVCOMPILER) +# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__INTEL_COMPILER) || defined(__PGI) +# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes) +# define CXX_STD CXX_STD_17 +# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__) +# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__) +# define CXX_STD CXX_STD_11 +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > CXX_STD_23 + "26" +#elif CXX_STD > CXX_STD_20 + "23" +#elif CXX_STD > CXX_STD_17 + "20" +#elif CXX_STD > CXX_STD_14 + "17" +#elif CXX_STD > CXX_STD_11 + "14" +#elif CXX_STD >= CXX_STD_11 + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR) + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/a.out b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/4.0.3/CompilerIdCXX/a.out new file mode 100755 index 0000000000000000000000000000000000000000..afcffaa5d8e4bcf78c3a58ef93e53d68df7ec21b GIT binary patch literal 15552 zcmeHOYit}>6~4Q68iypd6Om$)v{_18xerhLN^k=vo7iiQE5`|`D-uFFOm@fiiuLYl zcicKb5v~kWu9Yf0gbLzOQU36wf*&X#B#=W&X{8D||02W>g9u7RC`LS#wo#UI=ALge zzF8Nk@B>wIt(|kvcg}b2y=SiHdFS(~;emK8rcmnC#}#YIW{o7pu&`SyB$BE}ZKUmX zwN2eYdVPRtdr}Ls>T)^0QZ@))N0NChT&W?qYna;51wCZRywyqzcZdq4l5sF^4I4x^ ztYHOd@|J{W%7pMBk^4ul_?dUp-eKXrCILeXlfnurF80d!z2joTqKIEe@q8EkP#TY+gA|dfIiyvUxX`J?$wnm;Fro!3Q~G zdsv;U*2dGsWUYhow8jUAhYs{PomN-3LbcNhjyZLdWB$`SisiF3DD2-KfBEZ_{yO!X zU{hPO>lFFCAOpw$9p?MtP1^8^{9gfAf;S|!9XRx615YHhUyFg41Wy?F(}K4e_*VsQ zH}Dq)zr0Tch36RN76VHmoaYA0)ex>TrY*}MTn@Q`;d%(i{~BUNGRi=dfhYq}2BHi^ z8Hh3vW#GM+fxkE1{gyp@t-+pO^ZQ*&*ySUh~)zl)lFoa@x|rpnUTEnjZ$qM;N2ser%xG>iLh+H=eHh3j?pg*W!u zv6t;jH~sAt@Gc41Yy`Y59*<|Hw~gG@RF^&5d(ooWWA@w?e}g^W`zO+_uB%ikSNmym z;^j5<UjHOHb6}1$cjlTsH?{QZ)D0fLJ-_9f6mvdx&3?{~EjFE3O}|)( zrEU=Z%qsZlTDT5ycFUPY+AZhno2yYqYk5=j{#y8a>c$D$&DA+j-Rs=ds6-ivG7x1T z%0QHXC<9Rjq6|bCh%yjmAj-gdDFb+~w%VA6Mg|V;O&2DM*_>B8J~;B&iItu!?9LNj zshln3kGBVRokJFpjWYNbsue|?(uu9(Z5zIpC*|h$xj}9lJvMjon5X}zD4r= z^y3mceMH5kn`7HHtZg_)FVYz2H3zNae;+&auMJ)`?xbor{g&UTR05!}d7!c7k*4)e zHq5AfTOWR)YiIDfmHFK6W%yB@3&-^7_d3P>0RySV<}bzjHr^3`o?2!=7w&tKe*CVF zvdwQj7Z}4kyZDUOn+W4VZ$<+<-T}r9ow?j!wsSl#94q{8FaV=Xlz}J%Q3j$6L>Y)O z5M?0BK$L+f1ON9Kz8rO

I z{Wit#RM;ONeV1`+*IaM>qTq?7_QX8<38|ao8x;O;wNjvnokXJJDbD_txq=TpNSo!R_Y0nff@B|JT6aZAXLSF8;S{aG_cE^U(sKJlw4y$f z%{x(-g1B&r&F3xqdYoEw>M-IX6E( z<&JyK?N8UV10De?hXVQ(k-ijgQX~EJ3Bk$$=7T$O<Xb!$W0DTNq51r7t9<^ZDPMgaXnv1{ z^EcwNZ@7Gzlz-7VE-oO>>ySGI$9WmY6~t(x3ZK)#$9W&}oH+9Fl-mX$=WG5%gkyt` z>j+3(H;_wE%>MIvfzRRKml?Xevpq4pRWm^5ROhnB$)nKJu>;;x6)4Q6U6|s^+Q2T?GF%ae#cN z>ZvPc``;iq%)c&t$gdfE?0>*7P=&8?(Z2cp-(fh4H2LQZ{%YU_u z7vOt4vpwjLi^OdT@p0eq3LhA#z)x$pbl|@u1J8Z5kLx>pKZ)-o(QoiDk4nVl{DY7C zhJ{@OQb`8eTO05puaGIsuM*ldr{@+msDTIg&s1Ry?c@5TNBE{cw-qkSq%bD#RTKD~ zRYX_74@=CQuxn8Q{#1-x$;k5z{lW2<@1M~3Fu%1+Yu`pgVl-5`_N&eRRktR*DLe?1 F|8F4k46* search starts here: + /usr/lib/gcc/x86_64-pc-linux-gnu/14/include + /usr/local/include + /usr/include + End of search list. + Compiler executable checksum: 692b9f54c8e102112d4f971fe11b8e95 + COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_936b3.dir/' + /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o /tmp/cc5meg4y.s + GNU assembler version 2.44.0 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.44 p4) 2.44.0 + COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.' + [2/2] : && /usr/lib/ccache/bin/gcc-14 -v -Wl,-v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -o cmTC_afe54 && : + Using built-in specs. + COLLECT_GCC=/usr/bin/gcc-14 + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-pc-linux-gnu + Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) + COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_afe54' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_afe54.' + /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cc28VYxI.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_afe54 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o + collect2 version 14.2.1 20250301 + /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cc28VYxI.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_afe54 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o + GNU ld (Gentoo 2.44 p4) 2.44.0 + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_afe54' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_afe54.' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:191 (message)" + - "/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Parsed C implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + add: [/usr/local/include] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include;/usr/local/include;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:227 (message)" + - "/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Parsed C implicit link information: + link line regex: [^( *|.*[/\\])(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + linker tool regex: [^[ ]*(->|")?[ ]*(([^"]*[/\\])?(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)))("|,| |$)] + ignore line: [Change Dir: '/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeScratch/TryCompile-TJTcI4'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/ninja -v cmTC_afe54] + ignore line: [[1/2] /usr/lib/ccache/bin/gcc-14 -v -o CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/gcc-14] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c c++ fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32 m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) ] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_936b3.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-pc-linux-gnu/14/cc1 -quiet -v /usr/share/cmake/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_936b3.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fdiagnostics-color=always -foffload-options=-fno-stack-protector -fcf-protection -foffload-options=-fcf-protection=none -o /tmp/cc5meg4y.s] + ignore line: [GNU C17 (Gentoo 14.2.1_p20250301 p8) version 14.2.1 20250301 (x86_64-pc-linux-gnu)] + ignore line: [ compiled by GNU C version 14.2.1 20250301 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version none] + ignore line: [warning: MPFR header version 4.2.1 differs from library version 4.2.2.] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: 692b9f54c8e102112d4f971fe11b8e95] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_936b3.dir/'] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o /tmp/cc5meg4y.s] + ignore line: [GNU assembler version 2.44.0 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.44 p4) 2.44.0] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_936b3.dir/CMakeCCompilerABI.c.'] + ignore line: [[2/2] : && /usr/lib/ccache/bin/gcc-14 -v -Wl -v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -o cmTC_afe54 && :] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/gcc-14] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c c++ fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32 m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_afe54' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_afe54.'] + link line: [ /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cc28VYxI.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_afe54 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + arg [/usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cc28VYxI.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-o] ==> ignore + arg [cmTC_afe54] ==> ignore + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] + arg [-L/lib/../lib64] ==> dir [/lib/../lib64] + arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] + arg [-v] ==> ignore + arg [CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + ignore line: [collect2 version 14.2.1 20250301] + ignore line: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cc28VYxI.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_afe54 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_afe54.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + linker tool for 'C': /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] ==> [/usr/lib64/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] ==> [/usr/lib64/crti.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] ==> [/usr/lib64/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] ==> [/usr/lib64] + collapse library dir [/lib/../lib64] ==> [/lib64] + collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] ==> [/usr/x86_64-pc-linux-gnu/lib] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib64/Scrt1.o;/usr/lib64/crti.o;/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o;/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o;/usr/lib64/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-pc-linux-gnu/14;/usr/lib64;/lib64;/usr/x86_64-pc-linux-gnu/lib;/usr/lib] + implicit fwks: [] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/Internal/CMakeDetermineLinkerId.cmake:36 (message)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:270 (cmake_determine_linker_id)" + - "/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Running the C compiler's linker: "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld" "-v" + GNU ld (Gentoo 2.44 p4) 2.44.0 + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:83 (try_compile)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeScratch/TryCompile-7iZSQ0" + binary: "/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeScratch/TryCompile-7iZSQ0" + cmakeVariables: + CMAKE_CXX_FLAGS: "-DQT_QML_DEBUG" + CMAKE_CXX_SCAN_FOR_MODULES: "OFF" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeScratch/TryCompile-7iZSQ0' + + Run Build Command(s): /usr/bin/ninja -v cmTC_21184 + [1/2] /usr/lib/ccache/bin/g++-14 -DQT_QML_DEBUG -v -o CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=/usr/bin/g++-14 + OFFLOAD_TARGET_NAMES=nvptx-none + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-pc-linux-gnu + Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) + COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/' + /usr/libexec/gcc/x86_64-pc-linux-gnu/14/cc1plus -quiet -v -D_GNU_SOURCE /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_67fc9.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fdiagnostics-color=always -foffload-options=-fno-stack-protector -fcf-protection -foffload-options=-fcf-protection=none -o /tmp/cct8RPeI.s + GNU C++17 (Gentoo 14.2.1_p20250301 p8) version 14.2.1 20250301 (x86_64-pc-linux-gnu) + compiled by GNU C version 14.2.1 20250301, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none + warning: MPFR header version 4.2.1 differs from library version 4.2.2. + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 + /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu + /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward + /usr/lib/gcc/x86_64-pc-linux-gnu/14/include + /usr/local/include + /usr/include + End of search list. + Compiler executable checksum: b46a38ebc015f9ddd57a5b06b86bc26d + COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/' + /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o /tmp/cct8RPeI.s + GNU assembler version 2.44.0 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.44 p4) 2.44.0 + COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.' + [2/2] : && /usr/lib/ccache/bin/g++-14 -DQT_QML_DEBUG -v -Wl,-v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_21184 && : + Using built-in specs. + COLLECT_GCC=/usr/bin/g++-14 + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-pc-linux-gnu + Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) + COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-D' 'QT_QML_DEBUG' '-v' '-o' 'cmTC_21184' '-foffload-options=-l_GCC_m' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_21184.' + /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cctgQUcb.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_21184 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o + collect2 version 14.2.1 20250301 + /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cctgQUcb.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_21184 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o + GNU ld (Gentoo 2.44 p4) 2.44.0 + COLLECT_GCC_OPTIONS='-D' 'QT_QML_DEBUG' '-v' '-o' 'cmTC_21184' '-foffload-options=-l_GCC_m' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_21184.' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:191 (message)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward] + add: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + add: [/usr/local/include] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward] + collapse include dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward;/usr/lib/gcc/x86_64-pc-linux-gnu/14/include;/usr/local/include;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:227 (message)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + linker tool regex: [^[ ]*(->|")?[ ]*(([^"]*[/\\])?(ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)))("|,| |$)] + ignore line: [Change Dir: '/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/CMakeScratch/TryCompile-7iZSQ0'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/ninja -v cmTC_21184] + ignore line: [[1/2] /usr/lib/ccache/bin/g++-14 -DQT_QML_DEBUG -v -o CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/g++-14] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c c++ fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32 m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) ] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-pc-linux-gnu/14/cc1plus -quiet -v -D_GNU_SOURCE /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_67fc9.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fdiagnostics-color=always -foffload-options=-fno-stack-protector -fcf-protection -foffload-options=-fcf-protection=none -o /tmp/cct8RPeI.s] + ignore line: [GNU C++17 (Gentoo 14.2.1_p20250301 p8) version 14.2.1 20250301 (x86_64-pc-linux-gnu)] + ignore line: [ compiled by GNU C version 14.2.1 20250301 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version none] + ignore line: [warning: MPFR header version 4.2.1 differs from library version 4.2.2.] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/x86_64-pc-linux-gnu] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/backward] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: b46a38ebc015f9ddd57a5b06b86bc26d] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/'] + ignore line: [ /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o /tmp/cct8RPeI.s] + ignore line: [GNU assembler version 2.44.0 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.44 p4) 2.44.0] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-c' '-o' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_67fc9.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [[2/2] : && /usr/lib/ccache/bin/g++-14 -DQT_QML_DEBUG -v -Wl -v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_21184 && :] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/g++-14] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-pc-linux-gnu] + ignore line: [Configured with: /var/tmp/portage/sys-devel/gcc-14.2.1_p20250301/work/gcc-14-20250301/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c c++ fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20250301 p8' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32 m64 --disable-fixed-point --enable-targets=all --enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now --enable-default-ssp --disable-fixincludes --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-build-config=bootstrap-cet] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 14.2.1 20250301 (Gentoo 14.2.1_p20250301 p8) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/14/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/14/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-D' 'QT_QML_DEBUG' '-v' '-o' 'cmTC_21184' '-foffload-options=-l_GCC_m' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_21184.'] + link line: [ /usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cctgQUcb.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_21184 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + arg [/usr/libexec/gcc/x86_64-pc-linux-gnu/14/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cctgQUcb.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-o] ==> ignore + arg [cmTC_21184] ==> ignore + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] + arg [-L/lib/../lib64] ==> dir [/lib/../lib64] + arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] + arg [-L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] ==> dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] + arg [-v] ==> ignore + arg [CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o] + arg [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] ==> obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + ignore line: [collect2 version 14.2.1 20250301] + ignore line: [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper -plugin-opt=-fresolution=/tmp/cctgQUcb.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -o cmTC_21184 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../.. -v CMakeFiles/cmTC_21184.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] + linker tool for 'CXX': /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o] ==> [/usr/lib64/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o] ==> [/usr/lib64/crti.o] + collapse obj [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o] ==> [/usr/lib64/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14] ==> [/usr/lib/gcc/x86_64-pc-linux-gnu/14] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64] ==> [/usr/lib64] + collapse library dir [/lib/../lib64] ==> [/lib64] + collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib] ==> [/usr/x86_64-pc-linux-gnu/lib] + collapse library dir [/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib64/Scrt1.o;/usr/lib64/crti.o;/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o;/usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o;/usr/lib64/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-pc-linux-gnu/14;/usr/lib64;/lib64;/usr/x86_64-pc-linux-gnu/lib;/usr/lib] + implicit fwks: [] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake/Modules/Internal/CMakeDetermineLinkerId.cmake:36 (message)" + - "/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:270 (cmake_determine_linker_id)" + - "/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt" + message: | + Running the CXX compiler's linker: "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld" "-v" + GNU ld (Gentoo 2.44 p4) 2.44.0 +... diff --git a/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/cmake.check_cache b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000000..3dccd73172 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/src/dynarmic/tests/build/Desktop-Debug/qtcsettings.cmake b/src/dynarmic/tests/build/Desktop-Debug/qtcsettings.cmake new file mode 100644 index 0000000000..bf5c39e142 --- /dev/null +++ b/src/dynarmic/tests/build/Desktop-Debug/qtcsettings.cmake @@ -0,0 +1,12 @@ +# This file is managed by Qt Creator, do not edit! + +set("CMAKE_CXX_COMPILER" "/usr/lib/ccache/bin/g++-14" CACHE "FILEPATH" "" FORCE) +set("CMAKE_PREFIX_PATH" "/usr" CACHE "PATH" "" FORCE) +set("CMAKE_PROJECT_INCLUDE_BEFORE" "/data/code/eden/src/dynarmic/tests/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake" CACHE "FILEPATH" "" FORCE) +set("CMAKE_BUILD_TYPE" "Debug" CACHE "STRING" "" FORCE) +set("CMAKE_C_COMPILER" "/usr/lib/ccache/bin/gcc-14" CACHE "FILEPATH" "" FORCE) +set("QT_MAINTENANCE_TOOL" "/data/Qt/MaintenanceTool" CACHE "FILEPATH" "" FORCE) +set("CMAKE_CXX_FLAGS_INIT" "-DQT_QML_DEBUG" CACHE "STRING" "" FORCE) +set("CMAKE_GENERATOR" "Ninja" CACHE "STRING" "" FORCE) +set("QT_QMAKE_EXECUTABLE" "/usr/bin/qmake6" CACHE "FILEPATH" "" FORCE) +set("CMAKE_COLOR_DIAGNOSTICS" "ON" CACHE "BOOL" "" FORCE) \ No newline at end of file diff --git a/src/video_core/buffer_cache/buffer_cache.cpp b/src/video_core/buffer_cache/buffer_cache.cpp index 4b4f7061bf..533255e005 100644 --- a/src/video_core/buffer_cache/buffer_cache.cpp +++ b/src/video_core/buffer_cache/buffer_cache.cpp @@ -1,16 +1,14 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#include "common/microprofile.h" #include "video_core/buffer_cache/buffer_cache_base.h" #include "video_core/control/channel_state_cache.inc" namespace VideoCommon { -MICROPROFILE_DEFINE(GPU_PrepareBuffers, "GPU", "Prepare buffers", MP_RGB(224, 128, 128)); -MICROPROFILE_DEFINE(GPU_BindUploadBuffers, "GPU", "Bind and upload buffers", MP_RGB(224, 128, 128)); -MICROPROFILE_DEFINE(GPU_DownloadMemory, "GPU", "Download buffers", MP_RGB(224, 128, 128)); - template class VideoCommon::ChannelSetupCaches; } // namespace VideoCommon diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 66db162c5d..0cd6861b6d 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -334,7 +334,6 @@ void BufferCache

::DisableGraphicsUniformBuffer(size_t stage, u32 index) { template void BufferCache

::UpdateGraphicsBuffers(bool is_indexed) { - MICROPROFILE_SCOPE(GPU_PrepareBuffers); do { channel_state->has_deleted_buffers = false; DoUpdateGraphicsBuffers(is_indexed); @@ -343,7 +342,6 @@ void BufferCache

::UpdateGraphicsBuffers(bool is_indexed) { template void BufferCache

::UpdateComputeBuffers() { - MICROPROFILE_SCOPE(GPU_PrepareBuffers); do { channel_state->has_deleted_buffers = false; DoUpdateComputeBuffers(); @@ -352,7 +350,6 @@ void BufferCache

::UpdateComputeBuffers() { template void BufferCache

::BindHostGeometryBuffers(bool is_indexed) { - MICROPROFILE_SCOPE(GPU_BindUploadBuffers); if (is_indexed) { BindHostIndexBuffer(); } else if constexpr (!HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) { @@ -372,7 +369,6 @@ void BufferCache

::BindHostGeometryBuffers(bool is_indexed) { template void BufferCache

::BindHostStageBuffers(size_t stage) { - MICROPROFILE_SCOPE(GPU_BindUploadBuffers); BindHostGraphicsUniformBuffers(stage); BindHostGraphicsStorageBuffers(stage); BindHostGraphicsTextureBuffers(stage); @@ -380,7 +376,6 @@ void BufferCache

::BindHostStageBuffers(size_t stage) { template void BufferCache

::BindHostComputeBuffers() { - MICROPROFILE_SCOPE(GPU_BindUploadBuffers); BindHostComputeUniformBuffers(); BindHostComputeStorageBuffers(); BindHostComputeTextureBuffers(); @@ -534,7 +529,6 @@ void BufferCache

::CommitAsyncFlushesHigh() { async_buffers.emplace_back(std::optional{}); return; } - MICROPROFILE_SCOPE(GPU_DownloadMemory); auto it = committed_gpu_modified_ranges.begin(); while (it != committed_gpu_modified_ranges.end()) { @@ -621,7 +615,6 @@ void BufferCache

::CommitAsyncFlushes() { template void BufferCache

::PopAsyncFlushes() { - MICROPROFILE_SCOPE(GPU_DownloadMemory); PopAsyncBuffers(); } @@ -1611,7 +1604,6 @@ void BufferCache

::DownloadBufferMemory(Buffer& buffer, DAddr device_addr, u64 if (total_size_bytes == 0) { return; } - MICROPROFILE_SCOPE(GPU_DownloadMemory); if constexpr (USE_MEMORY_MAPS) { auto download_staging = runtime.DownloadStagingBuffer(total_size_bytes); diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 1c7320dcc1..a45e9b35f1 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h @@ -20,7 +20,6 @@ #include "common/div_ceil.h" #include "common/literals.h" #include "common/lru_cache.h" -#include "common/microprofile.h" #include "common/range_sets.h" #include "common/scope_exit.h" #include "common/settings.h" @@ -38,10 +37,6 @@ namespace VideoCommon { -MICROPROFILE_DECLARE(GPU_PrepareBuffers); -MICROPROFILE_DECLARE(GPU_BindUploadBuffers); -MICROPROFILE_DECLARE(GPU_DownloadMemory); - using BufferId = Common::SlotId; using VideoCore::Surface::PixelFormat; diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 401329eea0..c2c07deb9b 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -1,8 +1,10 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/cityhash.h" -#include "common/microprofile.h" #include "common/settings.h" #include "core/core.h" #include "video_core/dma_pusher.h" @@ -29,11 +31,7 @@ DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_, MemoryManager& memory_man DmaPusher::~DmaPusher() = default; -MICROPROFILE_DEFINE(DispatchCalls, "GPU", "Execute command buffer", MP_RGB(128, 128, 192)); - void DmaPusher::DispatchCalls() { - MICROPROFILE_SCOPE(DispatchCalls); - dma_pushbuffer_subindex = 0; dma_state.is_last_call = true; diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index 91f10aec2e..17fbe9961c 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp @@ -1,9 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "video_core/engines/fermi_2d.h" #include "video_core/engines/sw_blitter/blitter.h" #include "video_core/memory_manager.h" @@ -11,9 +13,6 @@ #include "video_core/surface.h" #include "video_core/textures/decoders.h" -MICROPROFILE_DECLARE(GPU_BlitEngine); -MICROPROFILE_DEFINE(GPU_BlitEngine, "GPU", "Blit Engine", MP_RGB(224, 224, 128)); - using VideoCore::Surface::BytesPerBlock; using VideoCore::Surface::PixelFormatFromRenderTargetFormat; @@ -61,7 +60,6 @@ void Fermi2D::ConsumeSinkImpl() { } void Fermi2D::Blit() { - MICROPROFILE_SCOPE(GPU_BlitEngine); LOG_DEBUG(HW_GPU, "called. source address=0x{:x}, destination address=0x{:x}", regs.src.Address(), regs.dst.Address()); diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 2ebd21fc55..a4b2c1098b 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -1,10 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/algorithm.h" #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/polyfill_ranges.h" #include "common/settings.h" #include "core/core.h" @@ -15,15 +17,6 @@ #include "video_core/renderer_base.h" #include "video_core/textures/decoders.h" -MICROPROFILE_DECLARE(GPU_DMAEngine); -MICROPROFILE_DECLARE(GPU_DMAEngineBL); -MICROPROFILE_DECLARE(GPU_DMAEngineLB); -MICROPROFILE_DECLARE(GPU_DMAEngineBB); -MICROPROFILE_DEFINE(GPU_DMAEngine, "GPU", "DMA Engine", MP_RGB(224, 224, 128)); -MICROPROFILE_DEFINE(GPU_DMAEngineBL, "GPU", "DMA Engine Block - Linear", MP_RGB(224, 224, 128)); -MICROPROFILE_DEFINE(GPU_DMAEngineLB, "GPU", "DMA Engine Linear - Block", MP_RGB(224, 224, 128)); -MICROPROFILE_DEFINE(GPU_DMAEngineBB, "GPU", "DMA Engine Block - Block", MP_RGB(224, 224, 128)); - namespace Tegra::Engines { using namespace Texture; @@ -65,7 +58,6 @@ void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, } void MaxwellDMA::Launch() { - MICROPROFILE_SCOPE(GPU_DMAEngine); LOG_TRACE(Render_OpenGL, "DMA copy 0x{:x} -> 0x{:x}", static_cast(regs.offset_in), static_cast(regs.offset_out)); @@ -80,7 +72,6 @@ void MaxwellDMA::Launch() { memory_manager.FlushCaching(); if (!is_src_pitch && !is_dst_pitch) { // If both the source and the destination are in block layout, assert. - MICROPROFILE_SCOPE(GPU_DMAEngineBB); CopyBlockLinearToBlockLinear(); ReleaseSemaphore(); return; @@ -96,10 +87,8 @@ void MaxwellDMA::Launch() { } } else { if (!is_src_pitch && is_dst_pitch) { - MICROPROFILE_SCOPE(GPU_DMAEngineBL); CopyBlockLinearToPitch(); } else { - MICROPROFILE_SCOPE(GPU_DMAEngineLB); CopyPitchToBlockLinear(); } } diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 7c34005a12..d97620ce91 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,7 +12,6 @@ #include #include "common/assert.h" -#include "common/microprofile.h" #include "common/settings.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 2b4bce4f8d..9392534e7d 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -1,8 +1,10 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/assert.h" -#include "common/microprofile.h" #include "common/scope_exit.h" #include "common/settings.h" #include "common/thread.h" @@ -22,12 +24,6 @@ static void RunThread(std::stop_token stop_token, Core::System& system, VideoCore::RendererBase& renderer, Core::Frontend::GraphicsContext& context, Tegra::Control::Scheduler& scheduler, SynchState& state) { std::string name = "GPU"; - MicroProfileOnThreadCreate(name.c_str()); -#if MICROPROFILE_ENABLED - SCOPE_EXIT { - MicroProfileOnThreadExit(); - }; -#endif Common::SetCurrentThreadName(name.c_str()); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp index 8f51c92af9..7b7353b6ca 100644 --- a/src/video_core/host1x/syncpoint_manager.cpp +++ b/src/video_core/host1x/syncpoint_manager.cpp @@ -1,15 +1,15 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#include "common/microprofile.h" #include "video_core/host1x/syncpoint_manager.h" namespace Tegra { namespace Host1x { -MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192)); - SyncpointManager::ActionHandle SyncpointManager::RegisterAction( std::atomic& syncpoint, std::list& action_storage, u32 expected_value, std::function&& action) { @@ -70,7 +70,6 @@ void SyncpointManager::WaitGuest(u32 syncpoint_id, u32 expected_value) { } void SyncpointManager::WaitHost(u32 syncpoint_id, u32 expected_value) { - MICROPROFILE_SCOPE(GPU_wait); Wait(syncpoints_host[syncpoint_id], wait_host_cv, expected_value); } diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index e476261e3e..2ff5e21c5e 100644 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -12,7 +15,6 @@ #include "common/assert.h" #include "common/fs/fs.h" #include "common/fs/path_util.h" -#include "common/microprofile.h" #include "common/settings.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/macro/macro.h" @@ -23,8 +25,6 @@ #include "video_core/macro/macro_jit_x64.h" #endif -MICROPROFILE_DEFINE(MacroHLE, "GPU", "Execute macro HLE", MP_RGB(128, 192, 192)); - namespace Tegra { static void Dump(u64 hash, std::span code, bool decompiled = false) { @@ -73,7 +73,6 @@ void MacroEngine::Execute(u32 method, const std::vector& parameters) { if (compiled_macro != macro_cache.end()) { const auto& cache_info = compiled_macro->second; if (cache_info.has_hle_program) { - MICROPROFILE_SCOPE(MacroHLE); cache_info.hle_program->Execute(parameters, method); } else { maxwell3d.RefreshParameters(); @@ -118,7 +117,6 @@ void MacroEngine::Execute(u32 method, const std::vector& parameters) { } else { cache_info.has_hle_program = true; cache_info.hle_program = std::move(hle_program); - MICROPROFILE_SCOPE(MacroHLE); cache_info.hle_program->Execute(parameters, method); } diff --git a/src/video_core/macro/macro_interpreter.cpp b/src/video_core/macro/macro_interpreter.cpp index 0d63495a9d..f9befce676 100644 --- a/src/video_core/macro/macro_interpreter.cpp +++ b/src/video_core/macro/macro_interpreter.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,12 +9,9 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/macro/macro_interpreter.h" -MICROPROFILE_DEFINE(MacroInterp, "GPU", "Execute macro interpreter", MP_RGB(128, 128, 192)); - namespace Tegra { namespace { class MacroInterpreterImpl final : public CachedMacro { @@ -90,7 +90,6 @@ private: }; void MacroInterpreterImpl::Execute(const std::vector& params, u32 method) { - MICROPROFILE_SCOPE(MacroInterp); Reset(); registers[1] = params[0]; diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp index 14f265ad71..f8811d29c8 100644 --- a/src/video_core/macro/macro_jit_x64.cpp +++ b/src/video_core/macro/macro_jit_x64.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -10,16 +13,12 @@ #include "common/assert.h" #include "common/bit_field.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/x64/xbyak_abi.h" #include "common/x64/xbyak_util.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/macro/macro_interpreter.h" #include "video_core/macro/macro_jit_x64.h" -MICROPROFILE_DEFINE(MacroJitCompile, "GPU", "Compile macro JIT", MP_RGB(173, 255, 47)); -MICROPROFILE_DEFINE(MacroJitExecute, "GPU", "Execute macro JIT", MP_RGB(255, 255, 0)); - namespace Tegra { namespace { constexpr Xbyak::Reg64 STATE = Xbyak::util::rbx; @@ -109,7 +108,6 @@ private: }; void MacroJITx64Impl::Execute(const std::vector& parameters, u32 method) { - MICROPROFILE_SCOPE(MacroJitExecute); ASSERT_OR_EXECUTE(program != nullptr, { return; }); JITState state{}; state.maxwell3d = &maxwell3d; @@ -449,7 +447,6 @@ void MacroJITx64Impl::Optimizer_ScanFlags() { } void MacroJITx64Impl::Compile() { - MICROPROFILE_SCOPE(MacroJitCompile); labels.fill(Xbyak::Label()); Common::X64::ABI_PushRegistersAndAdjustStack(*this, Common::X64::ABI_ALL_CALLEE_SAVED, 8); diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 131b7463e0..2ea42abf4b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -16,7 +16,6 @@ #include "common/assert.h" #include "common/logging/log.h" #include "common/math_util.h" -#include "common/microprofile.h" #include "common/scope_exit.h" #include "common/settings.h" #include "video_core/control/channel_state.h" @@ -43,11 +42,6 @@ using VideoCore::Surface::PixelFormat; using VideoCore::Surface::SurfaceTarget; using VideoCore::Surface::SurfaceType; -MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192)); -MICROPROFILE_DEFINE(OpenGL_Clears, "OpenGL", "Clears", MP_RGB(128, 128, 192)); -MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(128, 128, 192)); -MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Management", MP_RGB(100, 255, 100)); - namespace { constexpr size_t NUM_SUPPORTED_VERTEX_ATTRIBUTES = 16; @@ -159,8 +153,6 @@ void RasterizerOpenGL::LoadDiskResources(u64 title_id, std::stop_token stop_load } void RasterizerOpenGL::Clear(u32 layer_count) { - MICROPROFILE_SCOPE(OpenGL_Clears); - gpu_memory->FlushCaching(); const auto& regs = maxwell3d->regs; bool use_color{}; @@ -231,8 +223,6 @@ void RasterizerOpenGL::Clear(u32 layer_count) { template void RasterizerOpenGL::PrepareDraw(bool is_indexed, Func&& draw_func) { - MICROPROFILE_SCOPE(OpenGL_Drawing); - SCOPE_EXIT { gpu.TickWork(); }; @@ -359,8 +349,6 @@ void RasterizerOpenGL::DrawIndirect() { } void RasterizerOpenGL::DrawTexture() { - MICROPROFILE_SCOPE(OpenGL_Drawing); - SCOPE_EXIT { gpu.TickWork(); }; @@ -489,7 +477,6 @@ void RasterizerOpenGL::DisableGraphicsUniformBuffer(size_t stage, u32 index) { void RasterizerOpenGL::FlushAll() {} void RasterizerOpenGL::FlushRegion(DAddr addr, u64 size, VideoCommon::CacheType which) { - MICROPROFILE_SCOPE(OpenGL_CacheManagement); if (addr == 0 || size == 0) { return; } @@ -547,7 +534,6 @@ VideoCore::RasterizerDownloadArea RasterizerOpenGL::GetFlushArea(DAddr addr, u64 } void RasterizerOpenGL::InvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheType which) { - MICROPROFILE_SCOPE(OpenGL_CacheManagement); if (addr == 0 || size == 0) { return; } @@ -568,7 +554,6 @@ void RasterizerOpenGL::InvalidateRegion(DAddr addr, u64 size, VideoCommon::Cache } bool RasterizerOpenGL::OnCPUWrite(DAddr addr, u64 size) { - MICROPROFILE_SCOPE(OpenGL_CacheManagement); DEBUG_ASSERT(addr != 0 || size != 0); { std::scoped_lock lock{buffer_cache.mutex}; @@ -585,8 +570,6 @@ bool RasterizerOpenGL::OnCPUWrite(DAddr addr, u64 size) { } void RasterizerOpenGL::OnCacheInvalidation(DAddr addr, u64 size) { - MICROPROFILE_SCOPE(OpenGL_CacheManagement); - if (addr == 0 || size == 0) { return; } @@ -716,7 +699,6 @@ bool RasterizerOpenGL::AccelerateConditionalRendering() { bool RasterizerOpenGL::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Surface& src, const Tegra::Engines::Fermi2D::Surface& dst, const Tegra::Engines::Fermi2D::Config& copy_config) { - MICROPROFILE_SCOPE(OpenGL_Blits); std::scoped_lock lock{texture_cache.mutex}; return texture_cache.BlitImage(dst, src, copy_config); } @@ -752,7 +734,6 @@ std::optional RasterizerOpenGL::AccelerateDisplay( if (framebuffer_addr == 0) { return {}; } - MICROPROFILE_SCOPE(OpenGL_CacheManagement); std::scoped_lock lock{texture_cache.mutex}; const auto [image_view, scaled] = diff --git a/src/video_core/renderer_opengl/gl_resource_manager.cpp b/src/video_core/renderer_opengl/gl_resource_manager.cpp index 1d2c9b70a6..79177489b4 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.cpp +++ b/src/video_core/renderer_opengl/gl_resource_manager.cpp @@ -1,23 +1,21 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2015 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include #include "common/assert.h" -#include "common/microprofile.h" #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_shader_util.h" -MICROPROFILE_DEFINE(OpenGL_ResourceCreation, "OpenGL", "Resource Creation", MP_RGB(128, 128, 192)); -MICROPROFILE_DEFINE(OpenGL_ResourceDeletion, "OpenGL", "Resource Deletion", MP_RGB(128, 128, 192)); - namespace OpenGL { void OGLRenderbuffer::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateRenderbuffers(1, &handle); } @@ -25,7 +23,6 @@ void OGLRenderbuffer::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteRenderbuffers(1, &handle); handle = 0; } @@ -34,7 +31,6 @@ void OGLTexture::Create(GLenum target) { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateTextures(target, 1, &handle); } @@ -42,7 +38,6 @@ void OGLTexture::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteTextures(1, &handle); handle = 0; } @@ -51,7 +46,6 @@ void OGLTextureView::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glGenTextures(1, &handle); } @@ -59,7 +53,6 @@ void OGLTextureView::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteTextures(1, &handle); handle = 0; } @@ -68,7 +61,6 @@ void OGLSampler::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateSamplers(1, &handle); } @@ -76,7 +68,6 @@ void OGLSampler::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteSamplers(1, &handle); handle = 0; } @@ -85,7 +76,6 @@ void OGLShader::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteShader(handle); handle = 0; } @@ -94,7 +84,6 @@ void OGLProgram::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteProgram(handle); handle = 0; } @@ -103,7 +92,6 @@ void OGLAssemblyProgram::Release() { if (handle == 0) { return; } - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteProgramsARB(1, &handle); handle = 0; } @@ -112,7 +100,6 @@ void OGLPipeline::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glGenProgramPipelines(1, &handle); } @@ -120,7 +107,6 @@ void OGLPipeline::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteProgramPipelines(1, &handle); handle = 0; } @@ -129,7 +115,6 @@ void OGLBuffer::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateBuffers(1, &handle); } @@ -137,7 +122,6 @@ void OGLBuffer::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteBuffers(1, &handle); handle = 0; } @@ -172,7 +156,6 @@ void OGLFramebuffer::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); // Bind to READ_FRAMEBUFFER to stop Nvidia's driver from creating an EXT_framebuffer instead of // a core framebuffer. EXT framebuffer attachments have to match in size and can be shared // across contexts. yuzu doesn't share framebuffers across contexts and we need attachments with @@ -185,7 +168,6 @@ void OGLFramebuffer::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteFramebuffers(1, &handle); handle = 0; } @@ -194,7 +176,6 @@ void OGLQuery::Create(GLenum target) { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateQueries(target, 1, &handle); } @@ -202,7 +183,6 @@ void OGLQuery::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteQueries(1, &handle); handle = 0; } @@ -211,7 +191,6 @@ void OGLTransformFeedback::Create() { if (handle != 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceCreation); glCreateTransformFeedbacks(1, &handle); } @@ -219,7 +198,6 @@ void OGLTransformFeedback::Release() { if (handle == 0) return; - MICROPROFILE_SCOPE(OpenGL_ResourceDeletion); glDeleteTransformFeedbacks(1, &handle); handle = 0; } diff --git a/src/video_core/renderer_opengl/gl_staging_buffer_pool.cpp b/src/video_core/renderer_opengl/gl_staging_buffer_pool.cpp index cadad65072..bdd8e47f61 100644 --- a/src/video_core/renderer_opengl/gl_staging_buffer_pool.cpp +++ b/src/video_core/renderer_opengl/gl_staging_buffer_pool.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -10,10 +13,8 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/bit_util.h" -#include "common/microprofile.h" #include "video_core/renderer_opengl/gl_staging_buffer_pool.h" -MICROPROFILE_DEFINE(OpenGL_BufferRequest, "OpenGL", "BufferRequest", MP_RGB(128, 128, 192)); namespace OpenGL { @@ -30,7 +31,6 @@ StagingBuffers::~StagingBuffers() = default; StagingBufferMap StagingBuffers::RequestMap(size_t requested_size, bool insert_fence, bool deferred) { - MICROPROFILE_SCOPE(OpenGL_BufferRequest); const size_t index = RequestBuffer(requested_size); OGLSync* const sync = insert_fence ? &allocs[index].sync : nullptr; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 850bc10c58..3412b1d998 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2014 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -10,7 +13,6 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/settings.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 0311c37bd9..e3fd0b683c 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -16,7 +16,6 @@ #include "common/cityhash.h" #include "common/fs/fs.h" #include "common/fs/path_util.h" -#include "common/microprofile.h" #include "common/thread_worker.h" #include "core/core.h" #include "shader_recompiler/backend/spirv/emit_spirv.h" @@ -44,7 +43,6 @@ #include "video_core/vulkan_common/vulkan_wrapper.h" namespace Vulkan { -MICROPROFILE_DECLARE(Vulkan_PipelineCache); namespace { using Shader::Backend::SPIRV::EmitSPIRV; @@ -438,7 +436,6 @@ PipelineCache::~PipelineCache() { } GraphicsPipeline* PipelineCache::CurrentGraphicsPipeline() { - MICROPROFILE_SCOPE(Vulkan_PipelineCache); if (!RefreshStages(graphics_key.unique_hashes)) { current_pipeline = nullptr; @@ -457,7 +454,6 @@ GraphicsPipeline* PipelineCache::CurrentGraphicsPipeline() { } ComputePipeline* PipelineCache::CurrentComputePipeline() { - MICROPROFILE_SCOPE(Vulkan_PipelineCache); const ShaderInfo* const shader{ComputeShader()}; if (!shader) { diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp index a448dc5288..9422110895 100644 --- a/src/video_core/renderer_vulkan/vk_present_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp @@ -1,7 +1,9 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/microprofile.h" #include "common/settings.h" #include "common/thread.h" #include "core/frontend/emu_window.h" @@ -14,8 +16,6 @@ namespace Vulkan { -MICROPROFILE_DEFINE(Vulkan_WaitPresent, "Vulkan", "Wait For Present", MP_RGB(128, 128, 128)); -MICROPROFILE_DEFINE(Vulkan_CopyToSwapchain, "Vulkan", "Copy to swapchain", MP_RGB(192, 255, 192)); namespace { @@ -157,7 +157,6 @@ PresentManager::PresentManager(const vk::Instance& instance_, PresentManager::~PresentManager() = default; Frame* PresentManager::GetRenderFrame() { - MICROPROFILE_SCOPE(Vulkan_WaitPresent); // Wait for free presentation frames std::unique_lock lock{free_mutex}; @@ -346,7 +345,6 @@ void PresentManager::CopyToSwapchain(Frame* frame) { } void PresentManager::CopyToSwapchainImpl(Frame* frame) { - MICROPROFILE_SCOPE(Vulkan_CopyToSwapchain); // If the size of the incoming frames has changed, recreate the swapchain // to account for that. diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index c803b50e24..dbe2ce66c9 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -13,7 +13,6 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/scope_exit.h" #include "common/settings.h" #include "video_core/buffer_cache/buffer_cache.h" @@ -48,11 +47,6 @@ using MaxwellDrawState = Tegra::Engines::DrawManager::State; using VideoCommon::ImageViewId; using VideoCommon::ImageViewType; -MICROPROFILE_DEFINE(Vulkan_WaitForWorker, "Vulkan", "Wait for worker", MP_RGB(255, 192, 192)); -MICROPROFILE_DEFINE(Vulkan_Drawing, "Vulkan", "Record drawing", MP_RGB(192, 128, 128)); -MICROPROFILE_DEFINE(Vulkan_Compute, "Vulkan", "Record compute", MP_RGB(192, 128, 128)); -MICROPROFILE_DEFINE(Vulkan_Clearing, "Vulkan", "Record clearing", MP_RGB(192, 128, 128)); -MICROPROFILE_DEFINE(Vulkan_PipelineCache, "Vulkan", "Pipeline cache", MP_RGB(192, 128, 128)); namespace { struct DrawParams { @@ -209,7 +203,6 @@ RasterizerVulkan::~RasterizerVulkan() = default; template void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { - MICROPROFILE_SCOPE(Vulkan_Drawing); SCOPE_EXIT { gpu.TickWork(); @@ -306,7 +299,6 @@ void RasterizerVulkan::DrawIndirect() { } void RasterizerVulkan::DrawTexture() { - MICROPROFILE_SCOPE(Vulkan_Drawing); SCOPE_EXIT { gpu.TickWork(); @@ -354,7 +346,6 @@ void RasterizerVulkan::DrawTexture() { } void RasterizerVulkan::Clear(u32 layer_count) { - MICROPROFILE_SCOPE(Vulkan_Clearing); FlushWork(); gpu_memory->FlushCaching(); diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index 7c556588b6..aa56a6affd 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp @@ -11,7 +11,6 @@ #include "video_core/renderer_vulkan/vk_query_cache.h" -#include "common/microprofile.h" #include "common/thread.h" #include "video_core/renderer_vulkan/vk_command_pool.h" #include "video_core/renderer_vulkan/vk_master_semaphore.h" @@ -23,7 +22,6 @@ namespace Vulkan { -MICROPROFILE_DECLARE(Vulkan_WaitForWorker); void Scheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf) { @@ -67,7 +65,6 @@ void Scheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) } void Scheduler::WaitWorker() { - MICROPROFILE_SCOPE(Vulkan_WaitForWorker); DispatchWork(); // Ensure the queue is drained. diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 34f2ba455a..09aa6cc77b 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -160,8 +160,6 @@ add_executable(yuzu debugger/console.h debugger/controller.cpp debugger/controller.h - debugger/profiler.cpp - debugger/profiler.h debugger/wait_tree.cpp debugger/wait_tree.h discord.h diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 6852193b1b..e54064d8a5 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -38,7 +38,6 @@ #include #endif -#include "common/microprofile.h" #include "common/polyfill_thread.h" #include "common/scm_rev.h" #include "common/settings.h" @@ -73,7 +72,6 @@ EmuThread::~EmuThread() = default; void EmuThread::run() { const char* name = "EmuControlThread"; - MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); auto& gpu = m_system.GPU(); @@ -124,10 +122,6 @@ void EmuThread::run() { // Shutdown the main emulated process m_system.DetachDebugger(); m_system.ShutdownMainProcess(); - -#if MICROPROFILE_ENABLED - MicroProfileOnThreadExit(); -#endif } // Unlock while emitting signals so that the main thread can diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp deleted file mode 100644 index 55d4298fa6..0000000000 --- a/src/yuzu/debugger/profiler.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: 2015 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#if MICROPROFILE_ENABLED - -#include -#include -#include -#include -#include -#include -#include "common/common_types.h" -#include "common/microprofile.h" -#include "yuzu/debugger/profiler.h" -#include "yuzu/util/util.h" - -// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the -// non-Qt frontends don't need it (and don't implement the UI drawing hooks either). - -#define MICROPROFILEUI_IMPL 1 -#include "common/microprofileui.h" - -class MicroProfileWidget : public QWidget { -public: - MicroProfileWidget(QWidget* parent = nullptr); - -protected: - void paintEvent(QPaintEvent* ev) override; - void showEvent(QShowEvent* ev) override; - void hideEvent(QHideEvent* ev) override; - - void mouseMoveEvent(QMouseEvent* ev) override; - void mousePressEvent(QMouseEvent* ev) override; - void mouseReleaseEvent(QMouseEvent* ev) override; - void wheelEvent(QWheelEvent* ev) override; - - void keyPressEvent(QKeyEvent* ev) override; - void keyReleaseEvent(QKeyEvent* ev) override; - -private: - /// This timer is used to redraw the widget's contents continuously. To save resources, it only - /// runs while the widget is visible. - QTimer update_timer; - /// Scale the coordinate system appropriately when dpi != 96. - qreal x_scale = 1.0, y_scale = 1.0; -}; - -MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) { - setObjectName(QStringLiteral("MicroProfile")); - setWindowTitle(tr("&MicroProfile")); - resize(1000, 600); - // Enable the maximize button - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); - - MicroProfileWidget* widget = new MicroProfileWidget(this); - - QLayout* layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(widget); - setLayout(layout); - - // Configure focus so that widget is focusable and the dialog automatically forwards focus to - // it. - setFocusProxy(widget); - widget->setFocusPolicy(Qt::StrongFocus); - widget->setFocus(); -} - -QAction* MicroProfileDialog::toggleViewAction() { - if (toggle_view_action == nullptr) { - toggle_view_action = new QAction(windowTitle(), this); - toggle_view_action->setCheckable(true); - toggle_view_action->setChecked(isVisible()); - connect(toggle_view_action, &QAction::toggled, this, &MicroProfileDialog::setVisible); - } - - return toggle_view_action; -} - -void MicroProfileDialog::showEvent(QShowEvent* ev) { - if (toggle_view_action) { - toggle_view_action->setChecked(isVisible()); - } - QWidget::showEvent(ev); -} - -void MicroProfileDialog::hideEvent(QHideEvent* ev) { - if (toggle_view_action) { - toggle_view_action->setChecked(isVisible()); - } - QWidget::hideEvent(ev); -} - -/// There's no way to pass a user pointer to MicroProfile, so this variable is used to make the -/// QPainter available inside the drawing callbacks. -static QPainter* mp_painter = nullptr; - -MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) { - // Send mouse motion events even when not dragging. - setMouseTracking(true); - - MicroProfileSetDisplayMode(1); // Timers screen - MicroProfileInitUI(); - - connect(&update_timer, &QTimer::timeout, this, qOverload<>(&MicroProfileWidget::update)); -} - -void MicroProfileWidget::paintEvent(QPaintEvent* ev) { - QPainter painter(this); - - // The units used by Microprofile for drawing are based in pixels on a 96 dpi display. - x_scale = qreal(painter.device()->logicalDpiX()) / 96.0; - y_scale = qreal(painter.device()->logicalDpiY()) / 96.0; - painter.scale(x_scale, y_scale); - - painter.setBackground(Qt::black); - painter.eraseRect(rect()); - - QFont font = GetMonospaceFont(); - font.setPixelSize(MICROPROFILE_TEXT_HEIGHT); - painter.setFont(font); - - mp_painter = &painter; - MicroProfileDraw(rect().width() / x_scale, rect().height() / y_scale); - mp_painter = nullptr; -} - -void MicroProfileWidget::showEvent(QShowEvent* ev) { - update_timer.start(15); // ~60 Hz - QWidget::showEvent(ev); -} - -void MicroProfileWidget::hideEvent(QHideEvent* ev) { - update_timer.stop(); - QWidget::hideEvent(ev); -} - -void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) { - const auto mouse_position = ev->pos(); - MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); - ev->accept(); -} - -void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) { - const auto mouse_position = ev->pos(); - MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); - MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); - ev->accept(); -} - -void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) { - const auto mouse_position = ev->pos(); - MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); - MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); - ev->accept(); -} - -void MicroProfileWidget::wheelEvent(QWheelEvent* ev) { - const auto wheel_position = ev->position().toPoint(); - MicroProfileMousePosition(wheel_position.x() / x_scale, wheel_position.y() / y_scale, - ev->angleDelta().y() / 120); - ev->accept(); -} - -void MicroProfileWidget::keyPressEvent(QKeyEvent* ev) { - if (ev->key() == Qt::Key_Control) { - // Inform MicroProfile that the user is holding Ctrl. - MicroProfileModKey(1); - } - QWidget::keyPressEvent(ev); -} - -void MicroProfileWidget::keyReleaseEvent(QKeyEvent* ev) { - if (ev->key() == Qt::Key_Control) { - MicroProfileModKey(0); - } - QWidget::keyReleaseEvent(ev); -} - -// These functions are called by MicroProfileDraw to draw the interface elements on the screen. - -void MicroProfileDrawText(int x, int y, u32 hex_color, const char* text, u32 text_length) { - // hex_color does not include an alpha, so it must be assumed to be 255 - mp_painter->setPen(QColor::fromRgb(hex_color)); - - // It's impossible to draw a string using a monospaced font with a fixed width per cell in a - // way that's reliable across different platforms and fonts as far as I (yuriks) can tell, so - // draw each character individually in order to precisely control the text advance. - for (u32 i = 0; i < text_length; ++i) { - // Position the text baseline 1 pixel above the bottom of the text cell, this gives nice - // vertical alignment of text for a wide range of tested fonts. - mp_painter->drawText(x, y + MICROPROFILE_TEXT_HEIGHT - 2, QString{QLatin1Char{text[i]}}); - x += MICROPROFILE_TEXT_WIDTH + 1; - } -} - -void MicroProfileDrawBox(int left, int top, int right, int bottom, u32 hex_color, - MicroProfileBoxType type) { - QColor color = QColor::fromRgba(hex_color); - QBrush brush = color; - if (type == MicroProfileBoxTypeBar) { - QLinearGradient gradient(left, top, left, bottom); - gradient.setColorAt(0.f, color.lighter(125)); - gradient.setColorAt(1.f, color.darker(125)); - brush = gradient; - } - mp_painter->fillRect(left, top, right - left, bottom - top, brush); -} - -void MicroProfileDrawLine2D(u32 vertices_length, float* vertices, u32 hex_color) { - // Temporary vector used to convert between the float array and QPointF. Marked static to reuse - // the allocation across calls. - static std::vector point_buf; - - for (u32 i = 0; i < vertices_length; ++i) { - point_buf.emplace_back(vertices[i * 2 + 0], vertices[i * 2 + 1]); - } - - // hex_color does not include an alpha, so it must be assumed to be 255 - mp_painter->setPen(QColor::fromRgb(hex_color)); - mp_painter->drawPolyline(point_buf.data(), vertices_length); - point_buf.clear(); -} -#endif diff --git a/src/yuzu/debugger/profiler.h b/src/yuzu/debugger/profiler.h deleted file mode 100644 index caf81bdd9b..0000000000 --- a/src/yuzu/debugger/profiler.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: 2015 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#if MICROPROFILE_ENABLED - -#include - -class QAction; -class QHideEvent; -class QShowEvent; - -class MicroProfileDialog : public QWidget { - Q_OBJECT - -public: - explicit MicroProfileDialog(QWidget* parent = nullptr); - - /// Returns a QAction that can be used to toggle visibility of this dialog. - QAction* toggleViewAction(); - -protected: - void showEvent(QShowEvent* ev) override; - void hideEvent(QHideEvent* ev) override; - -private: - QAction* toggle_view_action = nullptr; -}; -#endif diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a46c5cd881..a5f12b814b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -114,7 +114,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "common/logging/backend.h" #include "common/logging/log.h" #include "common/memory_detect.h" -#include "common/microprofile.h" #include "common/scm_rev.h" #include "common/scope_exit.h" #ifdef _WIN32 @@ -159,7 +158,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "yuzu/configuration/qt_config.h" #include "yuzu/debugger/console.h" #include "yuzu/debugger/controller.h" -#include "yuzu/debugger/profiler.h" #include "yuzu/debugger/wait_tree.h" #include "yuzu/discord.h" #include "yuzu/game_list.h" @@ -1344,17 +1342,6 @@ void GMainWindow::InitializeWidgets() { void GMainWindow::InitializeDebugWidgets() { QMenu* debug_menu = ui->menu_View_Debugging; -#if MICROPROFILE_ENABLED - microProfileDialog = new MicroProfileDialog(this); - microProfileDialog->hide(); - debug_menu->addAction(microProfileDialog->toggleViewAction()); -#else - auto micro_profile_stub = new QAction(tr("MicroProfile (unavailable)"), this); - micro_profile_stub->setEnabled(false); - micro_profile_stub->setChecked(false); - debug_menu->addAction(micro_profile_stub); -#endif - waitTreeWidget = new WaitTreeWidget(*system, this); addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); waitTreeWidget->hide(); @@ -1505,10 +1492,6 @@ void GMainWindow::RestoreUIState() { restoreState(UISettings::values.state); render_window->setWindowFlags(render_window->windowFlags() & ~Qt::FramelessWindowHint); render_window->restoreGeometry(UISettings::values.renderwindow_geometry); -#if MICROPROFILE_ENABLED - microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); - microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue()); -#endif game_list->LoadInterfaceLayout(); @@ -5109,10 +5092,6 @@ void GMainWindow::UpdateUISettings() { UISettings::values.renderwindow_geometry = render_window->saveGeometry(); } UISettings::values.state = saveState(); -#if MICROPROFILE_ENABLED - UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry(); - UISettings::values.microprofile_visible = microProfileDialog->isVisible(); -#endif UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked(); UISettings::values.fullscreen = ui->action_Fullscreen->isChecked(); UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked(); @@ -5635,14 +5614,6 @@ int main(int argc, char* argv[]) { #endif Common::DetachedTasks detached_tasks; - -#if MICROPROFILE_ENABLED - MicroProfileOnThreadCreate("Frontend"); - SCOPE_EXIT { - MicroProfileShutdown(); - }; -#endif - Common::ConfigureNvidiaEnvironmentFlags(); // Init settings params diff --git a/src/yuzu/main.h b/src/yuzu/main.h index b6f818099a..9021c26005 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -43,11 +43,7 @@ class GameList; class GImageInfo; class GRenderWindow; class LoadingScreen; -#if MICROPROFILE_ENABLED -class MicroProfileDialog; -#endif class OverlayDialog; -class ProfilerWidget; class ControllerDialog; class QLabel; class MultiplayerState; @@ -566,10 +562,6 @@ private: std::unique_ptr provider; // Debugger panes - ProfilerWidget* profilerWidget; -#if MICROPROFILE_ENABLED - MicroProfileDialog* microProfileDialog; -#endif WaitTreeWidget* waitTreeWidget; ControllerDialog* controller_dialog; diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 02d6bc9006..6da5424775 100644 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2016 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -66,7 +69,6 @@ void SaveWindowState() { config.setValue(QStringLiteral("state"), values.state); config.setValue(QStringLiteral("geometryRenderWindow"), values.renderwindow_geometry); config.setValue(QStringLiteral("gameListHeaderState"), values.gamelist_header_state); - config.setValue(QStringLiteral("microProfileDialogGeometry"), values.microprofile_geometry); config.sync(); } @@ -89,8 +91,6 @@ void RestoreWindowState(std::unique_ptr& qtConfig) { config.value(QStringLiteral("geometryRenderWindow")).toByteArray(); values.gamelist_header_state = config.value(QStringLiteral("gameListHeaderState")).toByteArray(); - values.microprofile_geometry = - config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray(); config.endGroup(); config.endGroup(); return; @@ -105,8 +105,6 @@ void RestoreWindowState(std::unique_ptr& qtConfig) { config.value(QStringLiteral("geometryRenderWindow")).toByteArray(); values.gamelist_header_state = config.value(QStringLiteral("gameListHeaderState")).toByteArray(); - values.microprofile_geometry = - config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray(); } } // namespace UISettings diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index b713b52fcc..0502fe75e4 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2016 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -92,10 +95,6 @@ struct Values { QByteArray gamelist_header_state; - QByteArray microprofile_geometry; - Setting microprofile_visible{linkage, false, "microProfileDialogVisible", - Category::UiLayout}; - Setting single_window_mode{linkage, true, "singleWindowMode", Category::Ui}; Setting fullscreen{linkage, false, "fullscreen", Category::Ui}; Setting display_titlebar{linkage, true, "displayTitleBars", Category::Ui}; diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 6acf7c0ace..599582aba9 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -16,7 +16,6 @@ #include "common/detached_tasks.h" #include "common/logging/backend.h" #include "common/logging/log.h" -#include "common/microprofile.h" #include "common/nvidia_flags.h" #include "common/scm_rev.h" #include "common/scope_exit.h" @@ -335,13 +334,6 @@ int main(int argc, char** argv) { LocalFree(argv_w); #endif -#if MICROPROFILE_ENABLED - MicroProfileOnThreadCreate("EmuThread"); - SCOPE_EXIT { - MicroProfileShutdown(); - }; -#endif - Common::ConfigureNvidiaEnvironmentFlags(); if (filepath.empty()) {