Move profiler to a separate library to break io <- util dependence
This commit is contained in:
parent
a2323884af
commit
36123f0a7d
9 changed files with 18 additions and 13 deletions
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <psemek/util/clock.hpp>
|
||||
#include <psemek/util/recursive.hpp>
|
||||
#include <psemek/util/profiler.hpp>
|
||||
#include <psemek/prof/profiler.hpp>
|
||||
|
||||
#include <psemek/async/event_loop.hpp>
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ struct physics_2d_app
|
|||
|
||||
~physics_2d_app()
|
||||
{
|
||||
util::profiler::dump();
|
||||
prof::profiler::dump();
|
||||
}
|
||||
|
||||
void on_resize(int width, int height) override
|
||||
|
|
@ -265,7 +265,7 @@ struct physics_2d_app
|
|||
|
||||
void update() override
|
||||
{
|
||||
util::profiler prof("update");
|
||||
prof::profiler prof("update");
|
||||
|
||||
float MOTOR = 15.f;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ file(GLOB_RECURSE PSEMEK_GFX_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "sou
|
|||
|
||||
psemek_add_library(psemek-gfx ${PSEMEK_GFX_HEADERS} ${PSEMEK_GFX_SOURCES})
|
||||
target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(psemek-gfx PUBLIC psemek-util psemek-geom psemek-cg psemek-random OpenGL::GL PNG::PNG)
|
||||
target_link_libraries(psemek-gfx PUBLIC psemek-util psemek-geom psemek-cg psemek-random psemek-io psemek-log OpenGL::GL PNG::PNG)
|
||||
if(NOT KHR_PLATFORM_FILE)
|
||||
message(STATUS "KHR/khrplatform.h not found, using a substitute header")
|
||||
target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/extra/khr/include")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <psemek/gfx/resource/font_9x12_png.hpp>
|
||||
#include <psemek/geom/constants.hpp>
|
||||
#include <psemek/io/memory_stream.hpp>
|
||||
#include <psemek/log/log.hpp>
|
||||
|
||||
static const char vertex_source[] =
|
||||
R"(#version 330
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ file(GLOB_RECURSE PSEMEK_PHYS_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "so
|
|||
|
||||
psemek_add_library(psemek-phys ${PSEMEK_PHYS_HEADERS} ${PSEMEK_PHYS_SOURCES})
|
||||
target_include_directories(psemek-phys PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(psemek-phys PUBLIC psemek-util psemek-geom psemek-cg)
|
||||
target_link_libraries(psemek-phys PUBLIC psemek-util psemek-geom psemek-cg psemek-prof)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <psemek/phys/engine_2d.hpp>
|
||||
|
||||
#include <psemek/util/heterogeneous_container.hpp>
|
||||
#include <psemek/util/profiler.hpp>
|
||||
#include <psemek/prof/profiler.hpp>
|
||||
|
||||
#include <psemek/geom/constants.hpp>
|
||||
#include <psemek/geom/matrix.hpp>
|
||||
|
|
|
|||
6
libs/prof/CMakeLists.txt
Normal file
6
libs/prof/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
file(GLOB_RECURSE PSEMEK_PROF_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp")
|
||||
file(GLOB_RECURSE PSEMEK_PROF_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp")
|
||||
|
||||
psemek_add_library(psemek-prof ${PSEMEK_PROF_HEADERS} ${PSEMEK_PROF_SOURCES})
|
||||
target_include_directories(psemek-prof PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(psemek-prof PUBLIC psemek-log psemek-util)
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <string_view>
|
||||
|
||||
namespace psemek::util
|
||||
namespace psemek::prof
|
||||
{
|
||||
|
||||
struct profiler
|
||||
|
|
@ -28,4 +28,4 @@ namespace psemek::util
|
|||
|
||||
}
|
||||
|
||||
#define profile_function [[maybe_unused]] ::psemek::util::profiler prof ## __LINE__ (__PRETTY_FUNCTION__)
|
||||
#define profile_function [[maybe_unused]] ::psemek::prof::profiler prof ## __LINE__ (__PRETTY_FUNCTION__)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <psemek/util/profiler.hpp>
|
||||
#include <psemek/prof/profiler.hpp>
|
||||
#include <psemek/util/pretty_print.hpp>
|
||||
#include <psemek/util/statistics.hpp>
|
||||
#include <psemek/log/log.hpp>
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace psemek::util
|
||||
namespace psemek::prof
|
||||
{
|
||||
|
||||
namespace
|
||||
|
|
@ -22,7 +22,7 @@ namespace psemek::util
|
|||
profiler_tree * parent = nullptr;
|
||||
std::mutex * mutex = nullptr;
|
||||
|
||||
statistics<double> execution_time;
|
||||
util::statistics<double> execution_time;
|
||||
|
||||
std::map<std::string, profiler_tree> children;
|
||||
std::vector<std::map<std::string, profiler_tree>::iterator> children_list;
|
||||
|
|
@ -6,6 +6,6 @@ file(GLOB_RECURSE PSEMEK_UTIL_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "so
|
|||
|
||||
psemek_add_library(psemek-util ${PSEMEK_UTIL_HEADERS} ${PSEMEK_UTIL_SOURCES})
|
||||
target_include_directories(psemek-util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(psemek-util PUBLIC psemek-log ${CMAKE_THREAD_LIBS_INIT} Boost::boost)
|
||||
target_link_libraries(psemek-util PUBLIC ${CMAKE_THREAD_LIBS_INIT} Boost::boost)
|
||||
|
||||
psemek_glob_tests(psemek-util tests)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue