Display all the common different threads in Optick

This commit is contained in:
Robert Beckebans 2023-03-01 16:20:37 +01:00
parent 18e0e7f2e7
commit b3e9c27d74
7 changed files with 31 additions and 13 deletions

View file

@ -72,7 +72,7 @@ option(USE_VMA
"Use VMA allocator instead of the NVRHI builtin one" ON)
option(OPTICK
"Enable profiling with Optick" ON)
"Enable profiling with Optick" OFF)
set(NVRHI_INSTALL OFF)
@ -479,6 +479,16 @@ else (RAPIDJSON_FOUND)
include_directories("libs/rapidjson/include")
endif (RAPIDJSON_FOUND)
if(OPTICK)
file(GLOB OPTICK_INCLUDES libs/optick/*.h)
file(GLOB OPTICK_SOURCES libs/optick/*.cpp)
add_definitions(-DUSE_OPTICK)
include_directories("libs/optick")
source_group("libs\\optick" FILES ${OPTICK_INCLUDES})
source_group("libs\\optick" FILES ${OPTICK_SOURCES})
endif()
add_subdirectory(idlib)
file(GLOB NATVIS_SOURCES .natvis)
@ -629,16 +639,6 @@ if(BINKDEC)
include_directories("libs/libbinkdec/include")
endif()
if(OPTICK)
file(GLOB OPTICK_INCLUDES libs/optick/*.h)
file(GLOB OPTICK_SOURCES libs/optick/*.cpp)
add_definitions(-DUSE_OPTICK)
include_directories("libs/optick")
source_group("libs\\optick" FILES ${OPTICK_INCLUDES})
source_group("libs\\optick" FILES ${OPTICK_SOURCES})
endif()
file(GLOB MINIZIP_INCLUDES libs/zlib/minizip/*.h)
file(GLOB MINIZIP_SOURCES libs/zlib/minizip/*.c libs/zlib/minizip/*.cpp)

View file

@ -103,7 +103,11 @@ public:
}
};
#define SCOPED_PROFILE_EVENT( x ) idScopedProfileEvent scopedProfileEvent_##__LINE__( x )
#if USE_OPTICK
#define SCOPED_PROFILE_EVENT( x ) OPTICK_EVENT( x )
#else
#define SCOPED_PROFILE_EVENT( x ) idScopedProfileEvent scopedProfileEvent_##__LINE__( x )
#endif
ID_INLINE bool BeginTraceRecording( const char* szName )
{

View file

@ -71,6 +71,8 @@ class idSGFcompressThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFcompressThread" );
sgf->CompressBlock();
return 0;
}
@ -81,6 +83,8 @@ class idSGFdecompressThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFdecompressThread" );
sgf->DecompressBlock();
return 0;
}
@ -91,6 +95,8 @@ class idSGFwriteThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFwriteThread" );
sgf->WriteBlock();
return 0;
}
@ -101,6 +107,8 @@ class idSGFreadThread : public idSysThread
public:
virtual int Run()
{
OPTICK_THREAD( "idSGFreadThread" );
sgf->ReadBlock();
return 0;
}

View file

@ -90,6 +90,8 @@ be called directly in the foreground thread for comparison.
*/
int idGameThread::Run()
{
OPTICK_THREAD( "idGameThread" );
commonLocal.frameTiming.startGameTime = Sys_Microseconds();
// debugging tool to test frame dropping behavior

View file

@ -1145,6 +1145,8 @@ idJobThread::Run
*/
int idJobThread::Run()
{
OPTICK_THREAD( GetName() );
threadJobListState_t threadJobListState[MAX_JOBLISTS];
int numJobLists = 0;
int lastStalledJobList = -1;

View file

@ -106,7 +106,7 @@ const int MAX_EXPRESSION_REGISTERS = 4096;
#endif
// RB: make Optick profiling available everywhere
#if 1 //defined( USE_OPTICK )
#if defined( USE_OPTICK )
#include "../libs/optick/optick.h"
#endif

View file

@ -746,6 +746,8 @@ idSaveGameThread::Run
*/
int idSaveGameThread::Run()
{
OPTICK_THREAD( "idSaveGameThread" );
int ret = ERROR_SUCCESS;
try