Support pushing > 1 measurement at a time in profiler
This commit is contained in:
parent
9b3f2df2a0
commit
95b6651fc3
2 changed files with 5 additions and 5 deletions
|
|
@ -17,13 +17,13 @@ namespace psemek::prof
|
||||||
~ profiler();
|
~ profiler();
|
||||||
|
|
||||||
static void start_frame(std::string const & name);
|
static void start_frame(std::string const & name);
|
||||||
static void push(std::string const & name, std::chrono::duration<double> duration);
|
static void push(std::string const & name, std::chrono::duration<double> duration, std::size_t count = 1);
|
||||||
static void end_frame(std::chrono::duration<double> duration);
|
static void end_frame(std::chrono::duration<double> duration);
|
||||||
|
|
||||||
template <typename Duration>
|
template <typename Duration>
|
||||||
static void push(std::string const & name, Duration duration)
|
static void push(std::string const & name, Duration duration, std::size_t count = 1)
|
||||||
{
|
{
|
||||||
push(name, std::chrono::duration_cast<std::chrono::duration<double>>(duration));
|
push(name, std::chrono::duration_cast<std::chrono::duration<double>>(duration), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
double duration() const
|
double duration() const
|
||||||
|
|
|
||||||
|
|
@ -199,12 +199,12 @@ namespace psemek::prof
|
||||||
current = current->child(name);
|
current = current->child(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void profiler::push(std::string const & name, std::chrono::duration<double> duration)
|
void profiler::push(std::string const & name, std::chrono::duration<double> duration, std::size_t count)
|
||||||
{
|
{
|
||||||
get_current();
|
get_current();
|
||||||
|
|
||||||
std::lock_guard lock{*(current->mutex)};
|
std::lock_guard lock{*(current->mutex)};
|
||||||
current->child(name)->execution_time.push(duration.count());
|
current->child(name)->execution_time.push(duration.count(), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void profiler::end_frame(std::chrono::duration<double> duration)
|
void profiler::end_frame(std::chrono::duration<double> duration)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue