remove profiler module

This commit is contained in:
BlackMATov
2020-10-29 04:23:30 +07:00
parent d257cf2adf
commit 390e236a57
37 changed files with 26 additions and 648 deletions

View File

@@ -15,7 +15,6 @@
#include "engine.hpp"
#include "input.hpp"
#include "platform.hpp"
#include "profiler.hpp"
#include "render.hpp"
#include "render.inl"
#include "vfs.hpp"

View File

@@ -34,7 +34,6 @@ namespace e2d
class keyboard;
class input;
class platform;
class profiler;
class render;
class shader;
class texture;

View File

@@ -1,221 +0,0 @@
/*******************************************************************************
* This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once
#include "_core.hpp"
#include "deferrer.hpp"
namespace e2d
{
class profiler final : public module<profiler> {
public:
using args_t = flat_map<str, str>;
struct begin_scope_info {
str name;
args_t args;
std::thread::id tid;
std::chrono::microseconds tp;
};
struct end_scope_info {
std::thread::id tid;
std::chrono::microseconds tp;
};
struct thread_event_info {
str name;
args_t args;
std::thread::id tid;
std::chrono::microseconds tp;
};
struct global_event_info {
str name;
args_t args;
std::thread::id tid;
std::chrono::microseconds tp;
};
using event_info = std::variant<
begin_scope_info,
end_scope_info,
thread_event_info,
global_event_info>;
public:
class sink : private e2d::noncopyable {
public:
virtual ~sink() noexcept = default;
virtual void on_event(const event_info& event) noexcept = 0;
};
using sink_uptr = std::unique_ptr<sink>;
public:
class auto_scope final : private e2d::noncopyable {
public:
auto_scope(profiler* profiler, str name);
auto_scope(profiler* profiler, str name, args_t args);
~auto_scope() noexcept;
private:
profiler* profiler_ = nullptr;
};
public:
profiler(deferrer& d);
~profiler() noexcept final;
void begin_scope(str name) noexcept;
void begin_scope(str name, args_t args) noexcept;
void end_scope() noexcept;
void thread_event(str name) noexcept;
void thread_event(str name, args_t args) noexcept;
void global_event(str name) noexcept;
void global_event(str name, args_t args) noexcept;
public:
struct recording_info {
vector<event_info> events;
};
template < typename Rep, typename Period >
stdex::promise<recording_info> record_for(
const std::chrono::duration<Rep, Period>& timeout_duration);
template < typename Clock, typename Duration >
stdex::promise<recording_info> record_until(
const std::chrono::time_point<Clock, Duration>& timeout_time);
public:
template < typename T, typename... Args >
T& register_sink(Args&&... args);
sink& register_sink(sink_uptr sink);
void unregister_sink(const sink& sink) noexcept;
private:
deferrer& deferrer_;
std::size_t depth_{0u};
vector<sink_uptr> sinks_;
std::recursive_mutex rmutex_;
};
}
#define E2D_PROFILER_SCOPE(name)\
auto E2D_PP_CAT(e2d_generated_profiler_auto_scope_, __LINE__) =\
::e2d::profiler::auto_scope(\
modules::is_initialized<profiler>() ? &the<profiler>() : nullptr,\
name);
#define E2D_PROFILER_SCOPE_EX(name, ...)\
auto E2D_PP_CAT(e2d_generated_profiler_auto_scope_, __LINE__) =\
::e2d::profiler::auto_scope(\
modules::is_initialized<profiler>() ? &the<profiler>() : nullptr,\
name,\
__VA_ARGS__);
#define E2D_PROFILER_THREAD_EVENT(name)\
if ( modules::is_initialized<profiler>() ) {\
the<profiler>().thread_event(name);\
}
#define E2D_PROFILER_THREAD_EVENT_EX(name, ...)\
if ( modules::is_initialized<profiler>() ) {\
the<profiler>().thread_event(name, __VA_ARGS___);\
}
#define E2D_PROFILER_GLOBAL_EVENT(name)\
if ( modules::is_initialized<profiler>() ) {\
the<profiler>().global_event(name);\
}
#define E2D_PROFILER_GLOBAL_EVENT_EX(name, ...)\
if ( modules::is_initialized<profiler>() ) {\
the<profiler>().global_event(name, __VA_ARGS__);\
}
namespace e2d
{
template < typename Rep, typename Period >
stdex::promise<profiler::recording_info> profiler::record_for(
const std::chrono::duration<Rep, Period>& timeout_duration)
{
return record_until(std::chrono::steady_clock::now() + timeout_duration);
}
template < typename Clock, typename Duration >
stdex::promise<profiler::recording_info> profiler::record_until(
const std::chrono::time_point<Clock, Duration>& timeout_time)
{
using promise_t = stdex::promise<recording_info>;
using time_point_t = std::chrono::time_point<Clock, Duration>;
class temp_sink final : public sink {
public:
temp_sink(std::size_t depth, time_point_t time_point)
: depth_(depth)
, time_point_(time_point) {}
void on_event(const event_info& event) noexcept final {
const bool skip = info_.events.empty() && depth_;
if ( std::holds_alternative<begin_scope_info>(event) ) {
++depth_;
} else if ( std::holds_alternative<end_scope_info>(event) ) {
E2D_ASSERT(depth_);
--depth_;
}
try {
if ( !skip ) {
info_.events.push_back(event);
}
if ( !depth_ && time_point_ <= Clock::now() ) {
promise_.resolve(std::move(info_));
}
} catch (...) {
promise_.reject(std::current_exception());
}
}
promise_t& promise() noexcept {
return promise_;
}
const promise_t& promise() const noexcept {
return promise_;
}
private:
promise_t promise_;
recording_info info_;
std::size_t depth_{0u};
time_point_t time_point_;
};
temp_sink& s = register_sink<temp_sink>(depth_, timeout_time);
return s.promise().then([&s, this](auto&& info){
return deferrer_.do_in_main_thread([&s, this](auto&& info){
unregister_sink(s);
return std::forward<decltype(info)>(info);
}, std::forward<decltype(info)>(info));
});
}
template < typename T, typename... Args >
T& profiler::register_sink(Args&&... args) {
return static_cast<T&>(
register_sink(std::make_unique<T>(std::forward<Args>(args)...)));
}
}
namespace e2d::profilers
{
bool try_save_recording_info(
const profiler::recording_info& src,
buffer& dst) noexcept;
bool try_save_recording_info(
const profiler::recording_info& src,
const output_stream_uptr& dst) noexcept;
}

View File

@@ -8,4 +8,3 @@
#include <enduro2d/core/audio.hpp>
#include <enduro2d/core/debug.hpp>
#include <enduro2d/core/profiler.hpp>

View File

@@ -479,7 +479,6 @@ namespace e2d
}
void dbgui::frame_tick() {
E2D_PROFILER_SCOPE("dbgui.frame_tick");
state_->frame_tick();
if ( visible() ) {
@@ -488,7 +487,6 @@ namespace e2d
}
void dbgui::frame_render() {
E2D_PROFILER_SCOPE("dbgui.frame_render");
state_->frame_render();
}
}

View File

@@ -11,7 +11,6 @@
#include <enduro2d/core/debug.hpp>
#include <enduro2d/core/engine.hpp>
#include <enduro2d/core/input.hpp>
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/render.hpp>
#include <enduro2d/core/window.hpp>

View File

@@ -6,8 +6,6 @@
#include <enduro2d/core/deferrer.hpp>
#include <enduro2d/core/profiler.hpp>
namespace e2d
{
deferrer::deferrer()
@@ -30,7 +28,6 @@ namespace e2d
}
void deferrer::frame_tick() noexcept {
E2D_PROFILER_SCOPE("deferrer.frame_tick");
scheduler_.process_all_tasks();
}
}

View File

@@ -12,7 +12,6 @@
#include <enduro2d/core/deferrer.hpp>
#include <enduro2d/core/input.hpp>
#include <enduro2d/core/platform.hpp>
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/render.hpp>
#include <enduro2d/core/vfs.hpp>
#include <enduro2d/core/window.hpp>
@@ -306,8 +305,6 @@ namespace e2d
}
public:
void calculate_end_frame_timers() noexcept {
E2D_PROFILER_SCOPE("engine.wait_for_target_fps");
const auto second_us = time::second_us<u64>();
const auto minimal_delta_time_us =
@@ -371,11 +368,6 @@ namespace e2d
safe_module_initialize<deferrer>();
// setup profiler
safe_module_initialize<profiler>(
the<deferrer>());
// setup debug
safe_module_initialize<debug>();
@@ -465,7 +457,6 @@ namespace e2d
input,
vfs,
debug,
profiler,
deferrer,
platform>();
}
@@ -502,8 +493,6 @@ namespace e2d
the<input>().frame_tick();
window::poll_events();
E2D_PROFILER_GLOBAL_EVENT("engine.end_of_frame");
}
app->shutdown();

View File

@@ -6,8 +6,6 @@
#include <enduro2d/core/input.hpp>
#include <enduro2d/core/profiler.hpp>
namespace e2d
{
//
@@ -366,7 +364,6 @@ namespace e2d
}
void input::frame_tick() noexcept {
E2D_PROFILER_SCOPE("input.frame_tick");
state_->mouse.state_->frame_tick();
state_->keyboard.state_->frame_tick();
}

View File

@@ -1,248 +0,0 @@
/*******************************************************************************
* This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/engine.hpp>
#include <enduro2d/core/vfs.hpp>
namespace
{
using namespace e2d;
str recording_args_to_json(const profiler::args_t& args) {
str dst = "{";
for ( auto iter = args.begin(); iter != args.end(); ) {
dst += strings::rformat("\"%0\":\"%1\"", iter->first, iter->second);
if ( ++iter != args.end() ) {
dst += ",";
}
}
dst += "}";
return dst;
}
str recording_info_to_json(const profiler::recording_info& src) {
str dst("{\"traceEvents\":[\n");
dst += strings::rformat(
" {\"name\":\"thread_name\",\"ph\":\"M\",\"tid\":%0,\"pid\":0,\"args\":{\"name\":\"%1\"}},\n",
std::hash<std::thread::id>()(the<engine>().main_thread()),
"Main");
for ( std::thread::id tid : the<vfs>().worker().thread_ids() ) {
dst += strings::rformat(
" {\"name\":\"thread_name\",\"ph\":\"M\",\"tid\":%0,\"pid\":0,\"args\":{\"name\":\"%1\"}},\n",
std::hash<std::thread::id>()(tid),
"VFS");
}
for ( std::thread::id tid : the<deferrer>().worker().thread_ids() ) {
dst += strings::rformat(
" {\"name\":\"thread_name\",\"ph\":\"M\",\"tid\":%0,\"pid\":0,\"args\":{\"name\":\"%1\"}},\n",
std::hash<std::thread::id>()(tid),
"Worker");
}
for ( auto iter = src.events.begin(); iter != src.events.end(); ) {
std::visit(utils::overloaded {
[&dst](const profiler::begin_scope_info& e){
char buf[512] = {'\0'};
strings::format(buf, std::size(buf),
" {\"name\":\"%0\",\"ph\":\"B\",\"ts\":%1,\"tid\":%2,\"pid\":0,\"cat\":\"\",\"args\":%3}",
e.name,
e.tp.count(),
std::hash<std::thread::id>()(e.tid),
recording_args_to_json(e.args));
dst += buf;
},
[&dst](const profiler::end_scope_info& e){
char buf[512] = {'\0'};
strings::format(buf, std::size(buf),
" {\"ph\":\"E\",\"ts\":%0,\"tid\":%1,\"pid\":0,\"cat\":\"\"}",
e.tp.count(),
std::hash<std::thread::id>()(e.tid));
dst += buf;
},
[&dst](const profiler::thread_event_info& e){
char buf[512] = {'\0'};
strings::format(buf, std::size(buf),
" {\"name\":\"%0\",\"ph\":\"i\",\"s\":\"t\",\"ts\":%1,\"tid\":%2,\"pid\":0,\"cat\":\"\",\"args\":%3}",
e.name,
e.tp.count(),
std::hash<std::thread::id>()(e.tid),
recording_args_to_json(e.args));
dst += buf;
},
[&dst](const profiler::global_event_info& e){
char buf[512] = {'\0'};
strings::format(buf, std::size(buf),
" {\"name\":\"%0\",\"ph\":\"i\",\"s\":\"g\",\"ts\":%1,\"tid\":%2,\"pid\":0,\"cat\":\"\",\"args\":%3}",
e.name,
e.tp.count(),
std::hash<std::thread::id>()(e.tid),
recording_args_to_json(e.args));
dst += buf;
}
}, *iter);
if ( ++iter != src.events.end() ) {
dst += ",\n";
}
}
dst += "\n]}";
return dst;
}
}
namespace e2d
{
profiler::auto_scope::auto_scope(profiler* profiler, str name)
: profiler_(profiler) {
if ( profiler_ ) {
profiler_->begin_scope(std::move(name));
}
}
profiler::auto_scope::auto_scope(profiler* profiler, str name, args_t args)
: profiler_(profiler) {
if ( profiler_ ) {
profiler_->begin_scope(std::move(name), std::move(args));
}
}
profiler::auto_scope::~auto_scope() noexcept {
if ( profiler_ ) {
profiler_->end_scope();
}
}
}
namespace e2d
{
profiler::profiler(deferrer& d)
: deferrer_(d) {}
profiler::~profiler() noexcept = default;
profiler::sink& profiler::register_sink(sink_uptr sink) {
E2D_ASSERT(sink);
std::lock_guard guard(rmutex_);
sinks_.push_back(std::move(sink));
return *sinks_.back();
}
void profiler::unregister_sink(const sink& sink) noexcept {
std::lock_guard guard(rmutex_);
for ( auto iter = sinks_.begin(); iter != sinks_.end(); ) {
if ( iter->get() == &sink ) {
iter = sinks_.erase(iter);
} else {
++iter;
}
}
}
void profiler::begin_scope(str name) noexcept {
return begin_scope(std::move(name), {});
}
void profiler::begin_scope(str name, args_t args) noexcept {
++depth_;
begin_scope_info event{
std::move(name),
std::move(args),
std::this_thread::get_id(),
time::to_chrono(time::now_us())};
std::lock_guard guard(rmutex_);
for ( const auto& sink : sinks_ ) {
if ( sink ) {
sink->on_event(event);
}
}
}
void profiler::end_scope() noexcept {
E2D_ASSERT(depth_);
--depth_;
end_scope_info event{
std::this_thread::get_id(),
time::to_chrono(time::now_us())};
std::lock_guard guard(rmutex_);
for ( const auto& sink : sinks_ ) {
if ( sink ) {
sink->on_event(event);
}
}
}
void profiler::thread_event(str name) noexcept {
return thread_event(std::move(name), {});
}
void profiler::thread_event(str name, args_t args) noexcept {
thread_event_info event{
std::move(name),
std::move(args),
std::this_thread::get_id(),
time::to_chrono(time::now_us())};
std::lock_guard guard(rmutex_);
for ( const auto& sink : sinks_ ) {
if ( sink ) {
sink->on_event(event);
}
}
}
void profiler::global_event(str name) noexcept {
return global_event(std::move(name), {});
}
void profiler::global_event(str name, args_t args) noexcept {
global_event_info event{
std::move(name),
std::move(args),
std::this_thread::get_id(),
time::to_chrono(time::now_us())};
std::lock_guard guard(rmutex_);
for ( const auto& sink : sinks_ ) {
if ( sink ) {
sink->on_event(event);
}
}
}
}
namespace e2d::profilers
{
bool try_save_recording_info(
const profiler::recording_info& src,
buffer& dst) noexcept
{
try {
str json = recording_info_to_json(src);
dst.assign(json.data(), json.size());
return true;
} catch (...) {
return false;
}
}
bool try_save_recording_info(
const profiler::recording_info& src,
const output_stream_uptr& dst) noexcept
{
buffer file_data;
return try_save_recording_info(src, file_data)
&& streams::try_write_tail(file_data, dst);
}
}

View File

@@ -7,6 +7,5 @@
#pragma once
#include <enduro2d/core/debug.hpp>
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/render.hpp>
#include <enduro2d/core/window.hpp>

View File

@@ -497,51 +497,33 @@ namespace e2d
{
E2D_ASSERT(is_in_main_thread());
gl_shader_id vs(state_->dbg());
gl_shader_id vs = gl_compile_shader(
state_->dbg(),
vertex_shader_header_cstr(device_capabilities().profile),
vertex_source,
GL_VERTEX_SHADER);
{
E2D_PROFILER_SCOPE("render.compile_vertex_shader");
vs = gl_compile_shader(
state_->dbg(),
vertex_shader_header_cstr(device_capabilities().profile),
vertex_source,
GL_VERTEX_SHADER);
if ( vs.empty() ) {
return nullptr;
}
if ( vs.empty() ) {
return nullptr;
}
gl_shader_id fs(state_->dbg());
gl_shader_id fs = gl_compile_shader(
state_->dbg(),
fragment_shader_header_cstr(device_capabilities().profile),
fragment_source,
GL_FRAGMENT_SHADER);
{
E2D_PROFILER_SCOPE("render.compile_fragment_shader");
fs = gl_compile_shader(
state_->dbg(),
fragment_shader_header_cstr(device_capabilities().profile),
fragment_source,
GL_FRAGMENT_SHADER);
if ( fs.empty() ) {
return nullptr;
}
if ( fs.empty() ) {
return nullptr;
}
gl_program_id ps(state_->dbg());
gl_program_id ps = gl_link_program(
state_->dbg(),
std::move(vs),
std::move(fs));
{
E2D_PROFILER_SCOPE("render.link_shader_program");
ps = gl_link_program(
state_->dbg(),
std::move(vs),
std::move(fs));
if ( ps.empty() ) {
return nullptr;
}
if ( ps.empty() ) {
return nullptr;
}
return std::make_shared<shader>(
@@ -601,11 +583,6 @@ namespace e2d
}
}
E2D_PROFILER_SCOPE_EX("render.create_texture_from_image", {
{"size", strings::rformat("%0", image.size())},
{"format", strings::rformat("%0", image.format())}
});
gl_texture_id id = gl_texture_id::create(state_->dbg(), GL_TEXTURE_2D);
if ( id.empty() ) {
state_->dbg().error("RENDER: Failed to create texture:\n"
@@ -682,11 +659,6 @@ namespace e2d
}
}
E2D_PROFILER_SCOPE_EX("render.create_empty_texture", {
{"size", strings::rformat("%0", size)},
{"format", strings::rformat("%0", decl.type())}
});
gl_texture_id id = gl_texture_id::create(state_->dbg(), GL_TEXTURE_2D);
if ( id.empty() ) {
state_->dbg().error("RENDER: Failed to create texture:\n"
@@ -751,8 +723,6 @@ namespace e2d
return nullptr;
}
E2D_PROFILER_SCOPE("render.create_index_buffer");
gl_buffer_id id = gl_buffer_id::create(state_->dbg(), GL_ELEMENT_ARRAY_BUFFER);
if ( id.empty() ) {
state_->dbg().error("RENDER: Failed to create index buffer:\n"
@@ -787,8 +757,6 @@ namespace e2d
return nullptr;
}
E2D_PROFILER_SCOPE("render.create_vertex_buffer");
gl_buffer_id id = gl_buffer_id::create(state_->dbg(), GL_ARRAY_BUFFER);
if ( id.empty() ) {
state_->dbg().error("RENDER: Failed to create vertex buffer:\n"
@@ -845,8 +813,6 @@ namespace e2d
}
}
E2D_PROFILER_SCOPE("render.create_render_target");
gl_framebuffer_id id = gl_framebuffer_id::create(state_->dbg(), GL_FRAMEBUFFER);
if ( id.empty() ) {
state_->dbg().error("RENDER: Failed to create framebuffer:\n",

View File

@@ -6,8 +6,6 @@
#include <enduro2d/core/vfs.hpp>
#include <enduro2d/core/profiler.hpp>
#include <3rdparty/miniz/miniz.h>
namespace
@@ -175,9 +173,6 @@ namespace e2d
}
std::optional<buffer> vfs::load(const url& url) const {
E2D_PROFILER_SCOPE_EX("vfs.sync_load", {
{"url", url.schemepath()}
});
return load_async(url).then([](auto&& src){
return std::optional<buffer>(std::forward<decltype(src)>(src));
}).get_or_default(std::nullopt);
@@ -185,9 +180,6 @@ namespace e2d
stdex::promise<buffer> vfs::load_async(const url& url) const {
return state_->worker.async([this, url](){
E2D_PROFILER_SCOPE_EX("vfs.load_async", {
{"url", url.schemepath()}
});
buffer content;
const input_stream_uptr stream = read(url);
if ( !stream || !streams::try_read_tail(content, stream) ) {
@@ -198,9 +190,6 @@ namespace e2d
}
std::optional<str> vfs::load_as_string(const url& url) const {
E2D_PROFILER_SCOPE_EX("vfs.sync_load_as_string", {
{"url", url.schemepath()}
});
return load_as_string_async(url).then([](auto&& src){
return std::optional<str>(std::forward<decltype(src)>(src));
}).get_or_default(std::nullopt);
@@ -208,9 +197,6 @@ namespace e2d
stdex::promise<str> vfs::load_as_string_async(const url& url) const {
return state_->worker.async([this, url](){
E2D_PROFILER_SCOPE_EX("vfs.load_as_string_async", {
{"url", url.schemepath()}
});
str content;
const input_stream_uptr stream = read(url);
if ( !stream || !streams::try_read_tail(content, stream) ) {

View File

@@ -7,5 +7,4 @@
#pragma once
#include <enduro2d/core/debug.hpp>
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/window.hpp>

View File

@@ -719,7 +719,6 @@ namespace e2d
}
void window::swap_buffers() noexcept {
E2D_PROFILER_SCOPE("window.swap_buffers");
std::lock_guard<std::recursive_mutex> guard(state_->rmutex);
E2D_ASSERT(
state_->window &&
@@ -728,7 +727,6 @@ namespace e2d
}
bool window::poll_events() noexcept {
E2D_PROFILER_SCOPE("window.poll_events");
return glfw_state::poll_events();
}

View File

@@ -33,9 +33,6 @@ namespace e2d
font_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("font_asset.parsing", {
{"address", address}
});
font content;
if ( !fonts::try_load_font(content, font_data->content()) ) {
throw font_asset_loading_exception();

View File

@@ -31,9 +31,6 @@ namespace e2d
image_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("image_asset.load_async", {
{"address", address}
});
image content;
if ( !images::try_load_image(content, image_data->content()) ) {
throw image_asset_loading_exception();

View File

@@ -31,9 +31,6 @@ namespace e2d
json_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("json_asset.parsing", {
{"address", address}
});
auto json = std::make_shared<rapidjson::Document>();
if ( json->Parse(json_data->content().c_str()).HasParseError() ) {
throw json_asset_loading_exception();

View File

@@ -31,9 +31,6 @@ namespace e2d
mesh_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("mesh_asset.parsing", {
{"address", address}
});
mesh content;
if ( !meshes::try_load_mesh(content, mesh_data->content()) ) {
throw mesh_asset_loading_exception();

View File

@@ -76,10 +76,6 @@ namespace
vertex_a = std::move(vertex_a),
fragment_a = std::move(fragment_a)
](){
E2D_PROFILER_SCOPE_EX("shader_asset.create_shader", {
{"vertex_address", vertex_a},
{"fragment_address", fragment_a}
});
const shader_ptr content = the<render>().create_shader(
std::get<0>(results)->content(),
std::get<1>(results)->content());

View File

@@ -31,9 +31,6 @@ namespace e2d
shape_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("shape_asset.parsing", {
{"address", address}
});
shape content;
if ( !shapes::try_load_shape(content, shape_data->content()) ) {
throw shape_asset_loading_exception();

View File

@@ -126,10 +126,6 @@ namespace
atlas_path,
atlas_folder
](){
E2D_PROFILER_SCOPE_EX("spine_asset.atlas_parsing", {
{"address", atlas_path}
});
auto atlas_internal = std::make_unique<atlas_internal_state>();
spine::atlas_ptr atlas(
@@ -152,10 +148,6 @@ namespace
atlas_path,
atlas_folder
](auto&& dependencies){
E2D_PROFILER_SCOPE_EX("spine_asset.atlas_parsing", {
{"address", atlas_path}
});
auto atlas_internal = std::make_unique<atlas_internal_state>();
atlas_internal->loaded = std::forward<decltype(dependencies)>(dependencies);
@@ -205,9 +197,6 @@ namespace
address = std::move(address),
skeleton_data
](){
E2D_PROFILER_SCOPE_EX("spine_asset.skeleton_parsing", {
{"address", address}
});
if ( strings::ends_with(address, ".skel") ) {
using skeleton_bin_ptr = std::unique_ptr<
spSkeletonBinary,

View File

@@ -31,9 +31,6 @@ namespace e2d
texture_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("texture_asset.create_texture", {
{"address", address}
});
const texture_ptr content = the<render>().create_texture(
texture_data->content());
if ( !content ) {

View File

@@ -31,9 +31,6 @@ namespace e2d
xml_data,
address = std::move(address)
](){
E2D_PROFILER_SCOPE_EX("xml_asset.parsing", {
{"address", address}
});
auto xml = std::make_shared<pugi::xml_document>();
if ( !xml->load_string(xml_data->content().c_str()) ) {
throw xml_asset_loading_exception();

View File

@@ -92,19 +92,16 @@ namespace
}
bool frame_tick() final {
E2D_PROFILER_SCOPE("application.frame_tick");
the<world>().registry().process_event(systems::frame_update_event{});
return !the<window>().should_close()
|| (application_ && !application_->on_should_close());
}
void frame_render() final {
E2D_PROFILER_SCOPE("application.frame_render");
the<world>().registry().process_event(systems::frame_render_event{});
}
void frame_finalize() final {
E2D_PROFILER_SCOPE("application.frame_finalize");
the<world>().registry().process_event(systems::frame_finalize_event{});
}
private:

View File

@@ -120,7 +120,6 @@ namespace e2d
const ecs::after<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("camera_system.process_update");
state_->process_update(owner);
}
}

View File

@@ -100,7 +100,6 @@ namespace e2d
ecs::registry& owner,
const ecs::after<systems::update_event>& trigger)
{
E2D_PROFILER_SCOPE("flipbook_system.process_update");
state_->process_update(trigger.event.dt, owner);
}
}

View File

@@ -61,39 +61,17 @@ namespace e2d
const f32 dt = engine_.delta_time();
const f32 time = engine_.time();
{
E2D_PROFILER_SCOPE("ecs.pre_update");
owner.process_event(systems::pre_update_event{dt,time});
}
{
E2D_PROFILER_SCOPE("ecs.update");
owner.process_event(systems::update_event{dt,time});
}
{
E2D_PROFILER_SCOPE("ecs.post_update");
owner.process_event(systems::post_update_event{dt,time});
}
owner.process_event(systems::pre_update_event{dt,time});
owner.process_event(systems::update_event{dt,time});
owner.process_event(systems::post_update_event{dt,time});
}
void process_frame_render(ecs::registry& owner) {
clear_framebuffer(render_, window_);
{
E2D_PROFILER_SCOPE("ecs.pre_render");
for_all_cameras<systems::pre_render_event>(owner);
}
{
E2D_PROFILER_SCOPE("ecs.render");
for_all_cameras<systems::render_event>(owner);
}
{
E2D_PROFILER_SCOPE("ecs.post_render");
for_all_cameras<systems::post_render_event>(owner);
}
for_all_cameras<systems::pre_render_event>(owner);
for_all_cameras<systems::render_event>(owner);
for_all_cameras<systems::post_render_event>(owner);
}
private:
engine& engine_;
@@ -114,7 +92,6 @@ namespace e2d
const ecs::after<systems::frame_update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("frame_system.process_frame_update");
state_->process_frame_update(owner);
}
@@ -123,7 +100,6 @@ namespace e2d
const ecs::after<systems::frame_render_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("frame_system.process_frame_render");
state_->process_frame_render(owner);
}
}

View File

@@ -271,7 +271,6 @@ namespace e2d
ecs::registry& owner,
const ecs::after<systems::render_event>& trigger)
{
E2D_PROFILER_SCOPE("gizmos_system.process_render");
state_->process_render(trigger.event.cam_e, owner);
}
}

View File

@@ -396,7 +396,6 @@ namespace e2d
const ecs::after<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("label_system.process_update");
state_->process_update(owner);
}
}

View File

@@ -259,7 +259,6 @@ namespace e2d
const ecs::after<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("layout_system.process_update");
state_->process_update(owner);
}
}

View File

@@ -92,7 +92,6 @@ namespace e2d
ecs::registry& owner,
const ecs::after<systems::render_event>& trigger)
{
E2D_PROFILER_SCOPE("render_system.process_render");
state_->process_render(trigger.event.cam_e, owner);
}
}

View File

@@ -258,7 +258,6 @@ namespace e2d
ecs::registry& owner,
const ecs::after<systems::update_event>& trigger)
{
E2D_PROFILER_SCOPE("spine_system.process_update");
state_->process_update(trigger.event.dt, owner);
}
}

View File

@@ -57,7 +57,6 @@ namespace e2d
const ecs::before<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("touch_system.process_update");
state_->process_update(owner);
}
}

View File

@@ -65,7 +65,6 @@ namespace e2d
const ecs::after<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("widget_system.process_update");
state_->process_update(owner);
}
}

View File

@@ -41,7 +41,6 @@ namespace e2d
const ecs::after<systems::frame_finalize_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("world_system.process_frame_finalize");
state_->process_frame_finalize(owner);
}
}

View File

@@ -157,8 +157,6 @@ namespace e2d
}
gobject world::instantiate(const prefab& prefab, const node_iptr& parent) {
E2D_PROFILER_SCOPE("world.instantiate");
gobject inst = new_instance(*this, prefab);
E2D_ERROR_DEFER([inst](){
delete_instance(inst);
@@ -174,8 +172,6 @@ namespace e2d
}
gobject world::instantiate(const prefab& prefab, const node_iptr& parent, const t2f& transform) {
E2D_PROFILER_SCOPE("world.instantiate");
gobject inst = new_instance(*this, prefab);
E2D_ERROR_DEFER([inst](){
delete_instance(inst);
@@ -203,7 +199,6 @@ namespace e2d
}
void world::finalize_instances() noexcept {
E2D_PROFILER_SCOPE("world.finalize_instances");
while ( !destroying_states_.empty() ) {
gobject inst{&destroying_states_.front()};
destroying_states_.pop_front();