KiCad PCB EDA Suite
|
A simple RAII class to measure the time of an operation. More...
#include <profile.h>
Public Member Functions | |
SCOPED_PROF_TIMER (DURATION &aDuration) | |
~SCOPED_PROF_TIMER () | |
void | Start () |
Start or restart the counter. | |
void | Stop () |
Save the time when this function was called, and set the counter stane to stop. | |
void | Show (std::ostream &aStream=std::cerr) |
Print the elapsed time (in a suitable unit) to a stream. | |
template<typename DURATION > | |
DURATION | SinceStart (bool aSinceLast=false) |
double | msecs (bool aSinceLast=false) |
std::string | to_string () |
Private Types | |
using | CLOCK = std::chrono::high_resolution_clock |
using | TIME_POINT = std::chrono::time_point< CLOCK > |
Private Attributes | |
PROF_TIMER | m_counter |
< The counter to use to do the profiling | |
DURATION & | m_duration |
std::string | m_name |
bool | m_running |
TIME_POINT | m_starttime |
TIME_POINT | m_lasttime |
TIME_POINT | m_stoptime |
A simple RAII class to measure the time of an operation.
On construction, a timer is started, and on destruction, the timer is ended, and the time difference is written into the given duration.
For example:
DURATION duration; // select a duration type as needed { SCOPED_PROF_TIMER<DURATION> timer( duration ); timed_activity(); } // duration is now the time timed activity took
From C++17, with class template argument deduction, you should be able to omit the <DURATION>.
|
privateinherited |
|
privateinherited |
|
inline |
|
inline |
Definition at line 219 of file profile.h.
References SCOPED_PROF_TIMER< DURATION >::m_counter, SCOPED_PROF_TIMER< DURATION >::m_duration, and PROF_TIMER::SinceStart().
|
inlineinherited |
aSinceLast | only get the time since the last time the time was read. |
Definition at line 149 of file profile.h.
Referenced by KIGFX::OPENGL_GAL::BeginDrawing(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), GetNodeCount(), SCH_EDIT_FRAME::RecalculateConnections(), KIGFX::VIEW::Redraw(), DRC_ENGINE::RunTests(), DATABASE_CONNECTION::selectAllAndCache(), PCB_SELECTION_TOOL::selectAllConnectedTracks(), and DATABASE_CONNECTION::SelectOne().
|
inlineinherited |
Print the elapsed time (in a suitable unit) to a stream.
The unit is automatically chosen from ns, us, ms and s, depending on the size of the current count.
the | stream to print to. |
Definition at line 105 of file profile.h.
References PROF_TIMER::m_name.
Referenced by CONNECTION_GRAPH::buildConnectionGraph(), RES_EQUIV_CALC::Calculate(), RN_NET::compute(), SCH_EDIT_FRAME::OpenProjectFiles(), CN_CONNECTIVITY_ALGO::searchConnections(), PCB_TEST_FRAME_BASE::SetBoard(), SCH_SCREEN::TestDanglingEnds(), and CONNECTIVITY_DATA::updateRatsnest().
|
inlineinherited |
Definition at line 135 of file profile.h.
References PROF_TIMER::m_lasttime, PROF_TIMER::m_running, PROF_TIMER::m_starttime, and PROF_TIMER::m_stoptime.
Referenced by parse(), and SCOPED_PROF_TIMER< DURATION >::~SCOPED_PROF_TIMER().
|
inlineinherited |
Start or restart the counter.
Definition at line 77 of file profile.h.
References PROF_TIMER::m_lasttime, PROF_TIMER::m_running, and PROF_TIMER::m_starttime.
Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::OPENGL_GAL::EndDrawing(), PROF_TIMER::PROF_TIMER(), and PCB_SELECTION_TOOL::selectAllConnectedTracks().
|
inlineinherited |
Save the time when this function was called, and set the counter stane to stop.
Definition at line 88 of file profile.h.
References PROF_TIMER::m_running, and PROF_TIMER::m_stoptime.
Referenced by KIGFX::OPENGL_GAL::BeginDrawing(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), KIGFX::OPENGL_GAL::EndDrawing(), GetNodeCount(), SCH_EDIT_FRAME::RecalculateConnections(), KIGFX::VIEW::Redraw(), SCH_EDIT_FRAME::RefreshNetNavigator(), DRC_ENGINE::RunTests(), DATABASE_CONNECTION::selectAllAndCache(), DATABASE_CONNECTION::SelectOne(), and SCH_SCREEN::TestDanglingEnds().
|
inlineinherited |
Definition at line 155 of file profile.h.
References PROF_TIMER::m_name.
Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::OPENGL_GAL::EndDrawing(), SCH_EDIT_FRAME::RefreshNetNavigator(), and PCB_TEST_FRAME_BASE::SetBoard().
|
private |
< The counter to use to do the profiling
The duration to update at the end of the scope
Definition at line 227 of file profile.h.
Referenced by SCOPED_PROF_TIMER< DURATION >::~SCOPED_PROF_TIMER().
|
private |
Definition at line 230 of file profile.h.
Referenced by SCOPED_PROF_TIMER< DURATION >::~SCOPED_PROF_TIMER().
|
privateinherited |
Definition at line 189 of file profile.h.
Referenced by PROF_TIMER::SinceStart(), and PROF_TIMER::Start().
|
privateinherited |
Definition at line 183 of file profile.h.
Referenced by PROF_TIMER::Show(), and PROF_TIMER::to_string().
|
privateinherited |
Definition at line 184 of file profile.h.
Referenced by PROF_TIMER::SinceStart(), PROF_TIMER::Start(), and PROF_TIMER::Stop().
|
privateinherited |
Definition at line 189 of file profile.h.
Referenced by PROF_TIMER::SinceStart(), and PROF_TIMER::Start().
|
privateinherited |
Definition at line 189 of file profile.h.
Referenced by PROF_TIMER::SinceStart(), and PROF_TIMER::Stop().