|
KiCad PCB EDA Suite
|
A small class to help profiling. More...
#include <profile.h>
Public Member Functions | |
| PROF_TIMER (const std::string &aName, bool aAutostart=true) | |
| Create a PROF_COUNTER for measuring an elapsed time in milliseconds. | |
| PROF_TIMER () | |
| Create a PROF_COUNTER for measuring an elapsed time in milliseconds. | |
| 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 () |
| const std::string & | GetName () const |
Private Types | |
| using | CLOCK = std::chrono::high_resolution_clock |
| using | TIME_POINT = std::chrono::time_point<CLOCK> |
Private Attributes | |
| std::string | m_name |
| bool | m_running |
| bool | m_started |
| TIME_POINT | m_starttime |
| TIME_POINT | m_lasttime |
| TIME_POINT | m_stoptime |
A small class to help profiling.
It allows the calculation of the elapsed time (in milliseconds) between its creation (or the last call to Start() ) and the last call to Stop()
|
private |
|
private |
|
inline |
Create a PROF_COUNTER for measuring an elapsed time in milliseconds.
| aName | a string that will be printed in message. |
| aAutostart | true (default) to immediately start the timer |
Definition at line 58 of file profile.h.
References m_name, m_running, and Start().
Referenced by SCOPED_PROF_TIMER< DURATION >::SCOPED_PROF_TIMER().
|
inline |
Create a PROF_COUNTER for measuring an elapsed time in milliseconds.
The counter is started and the string to print in message is left empty.
Definition at line 70 of file profile.h.
References Start().
|
inline |
Definition at line 190 of file profile.h.
References m_name.
Referenced by LATENCY_PROBE::AddTimer().
|
inline |
| aSinceLast | only get the time since the last time the time was read. |
Definition at line 151 of file profile.h.
References SinceStart().
Referenced by LATENCY_PROBE::AddTimer(), ALLEGRO::BOARD_BUILDER::applyZoneFills(), KIGFX::OPENGL_GAL::BeginDrawing(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ALLEGRO::BOARD_BUILDER::BuildBoard(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_RAM::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), TMATCH::CONNECTION_GRAPH::findMatchingComponents(), GetNodeCount(), PCB_IO_ALLEGRO::LoadBoardFromData(), PCB_EDIT_FRAME::OpenProjectFiles(), ALLEGRO::PARSER::Parse(), ALLEGRO::BOARD_BUILDER::ZONE_FILL_HANDLER::ProcessPolygons(), SCHEMATIC::RecalculateConnections(), KIGFX::VIEW::Redraw(), PNS_LOG_PLAYER::ReplayLog(), ITEM_EVAL_EXPECTATION::RunTest(), DRC_ENGINE::RunTests(), DATABASE_CONNECTION::selectAllAndCache(), PCB_SELECTION_TOOL::selectAllConnectedTracks(), and DATABASE_CONNECTION::SelectOne().
|
inline |
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 107 of file profile.h.
References m_name, and SinceStart().
Referenced by CONNECTION_GRAPH::buildConnectionGraph(), RES_EQUIV_CALC::Calculate(), RN_NET::compute(), SCH_EDIT_FRAME::OpenProjectFiles(), polygon_triangulation_main(), CONNECTION_GRAPH::Recalculate(), CN_CONNECTIVITY_ALGO::searchConnections(), PCB_TEST_FRAME_BASE::SetBoard(), SCH_SCREEN::TestDanglingEnds(), and CONNECTIVITY_DATA::updateRatsnest().
|
inline |
Definition at line 137 of file profile.h.
References m_lasttime, m_running, m_starttime, and m_stoptime.
Referenced by PCB_PARSE_RUNNER::doParse(), msecs(), Show(), and to_string().
|
inline |
Start or restart the counter.
Definition at line 78 of file profile.h.
References m_lasttime, m_running, m_started, and m_starttime.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::OPENGL_GAL::EndDrawing(), PCB_IO_ALLEGRO::LoadBoardFromData(), PROF_TIMER(), PROF_TIMER(), and PCB_SELECTION_TOOL::selectAllConnectedTracks().
|
inline |
Save the time when this function was called, and set the counter stane to stop.
Definition at line 90 of file profile.h.
References m_running, and m_stoptime.
Referenced by KIGFX::OPENGL_GAL::BeginDrawing(), BOOST_FIXTURE_TEST_CASE(), 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(), TMATCH::CONNECTION_GRAPH::findMatchingComponents(), GetNodeCount(), PCB_IO_ALLEGRO::LoadBoardFromData(), CONNECTION_GRAPH::Recalculate(), SCHEMATIC::RecalculateConnections(), KIGFX::VIEW::Redraw(), SCH_EDIT_FRAME::RefreshNetNavigator(), PNS_LOG_PLAYER::ReplayLog(), MULTICHANNEL_TOOL::resolveConnectionTopology(), DRC_ENGINE::RunTests(), DATABASE_CONNECTION::selectAllAndCache(), DATABASE_CONNECTION::SelectOne(), and SCH_SCREEN::TestDanglingEnds().
|
inline |
Definition at line 157 of file profile.h.
References m_name, m_started, and SinceStart().
Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::OPENGL_GAL::EndDrawing(), TMATCH::CONNECTION_GRAPH::findMatchingComponents(), SCH_EDIT_FRAME::RefreshNetNavigator(), MULTICHANNEL_TOOL::resolveConnectionTopology(), and PCB_TEST_FRAME_BASE::SetBoard().
|
private |
Definition at line 200 of file profile.h.
Referenced by SinceStart(), and Start().
|
private |
Definition at line 193 of file profile.h.
Referenced by GetName(), PROF_TIMER(), Show(), and to_string().
|
private |
Definition at line 194 of file profile.h.
Referenced by PROF_TIMER(), SinceStart(), Start(), and Stop().
|
private |
Definition at line 195 of file profile.h.
Referenced by Start(), and to_string().
|
private |
Definition at line 200 of file profile.h.
Referenced by SinceStart(), and Start().
|
private |
Definition at line 200 of file profile.h.
Referenced by SinceStart(), and Stop().