Make profiler::dump a free function

This commit is contained in:
Nikita Lisitsa 2022-06-09 11:26:03 +03:00
parent 36123f0a7d
commit e4f212c44f
3 changed files with 8 additions and 7 deletions

View file

@ -198,7 +198,7 @@ struct physics_2d_app
~physics_2d_app() ~physics_2d_app()
{ {
prof::profiler::dump(); prof::dump();
} }
void on_resize(int width, int height) override void on_resize(int width, int height) override

View file

@ -7,13 +7,14 @@
namespace psemek::prof namespace psemek::prof
{ {
void dump();
struct profiler struct profiler
{ {
profiler(std::string const & name); profiler(std::string const & name);
~ profiler(); ~ profiler();
static void dump();
static void push(std::string const & name, std::chrono::duration<double> duration); static void push(std::string const & name, std::chrono::duration<double> duration);
template <typename Duration> template <typename Duration>

View file

@ -151,6 +151,11 @@ namespace psemek::prof
} }
void dump()
{
dump_impl(merged_tree(), 0);
}
profiler::profiler(std::string const & name) profiler::profiler(std::string const & name)
{ {
auto const id = std::this_thread::get_id(); auto const id = std::this_thread::get_id();
@ -198,9 +203,4 @@ namespace psemek::prof
child->execution_time.push(duration.count()); child->execution_time.push(duration.count());
} }
void profiler::dump()
{
dump_impl(merged_tree(), 0);
}
} }