From a2055954040a857012d0401c0e49525128b99401 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 5 Dec 2021 14:16:18 -0500 Subject: [PATCH] PROF_COUNTER -> PROF_TIMER I want to add an event counter, and this one is a timer --- common/draw_panel_gal.cpp | 10 +++++----- common/gal/opengl/gpu_manager.cpp | 2 +- common/gal/opengl/opengl_gal.cpp | 12 ++++++------ common/trace_helpers.cpp | 6 ++++-- eeschema/connection_graph.cpp | 6 +++--- include/profile.h | 18 +++++++++--------- .../tools/sexpr_parser/sexpr_parse.cpp | 4 ++-- .../tools/pcb_parser/pcb_parser_tool.cpp | 2 +- .../polygon_triangulation.cpp | 2 +- qa/pns/pns_log_viewer.cpp | 2 +- qa/qa_utils/pcb_test_frame.cpp | 4 ++-- 11 files changed, 35 insertions(+), 33 deletions(-) diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 1f3852f3e5..a3495b517c 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -196,11 +196,11 @@ void EDA_DRAW_PANEL_GAL::DoRePaint() KIGFX::RENDER_SETTINGS* settings = static_cast( m_painter->GetSettings() ); - PROF_COUNTER cntUpd("view-upd-items"); - PROF_COUNTER cntTotal("view-total"); - PROF_COUNTER cntCtx("view-context-create"); - PROF_COUNTER cntCtxDestroy("view-context-destroy"); - PROF_COUNTER cntRedraw("view-redraw-rects"); + PROF_TIMER cntUpd("view-upd-items"); + PROF_TIMER cntTotal("view-total"); + PROF_TIMER cntCtx("view-context-create"); + PROF_TIMER cntCtxDestroy("view-context-destroy"); + PROF_TIMER cntRedraw("view-redraw-rects"); bool isDirty = false; diff --git a/common/gal/opengl/gpu_manager.cpp b/common/gal/opengl/gpu_manager.cpp index eddbb6ca81..1d141ed5c6 100644 --- a/common/gal/opengl/gpu_manager.cpp +++ b/common/gal/opengl/gpu_manager.cpp @@ -172,7 +172,7 @@ void GPU_CACHED_MANAGER::EndDrawing() (GLvoid*) SHADER_OFFSET ); } - PROF_COUNTER cntDraw( "gl-draw-elements" ); + PROF_TIMER cntDraw( "gl-draw-elements" ); int n_ranges = m_vranges.size(); int n = 0; diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index e88a17145a..55208d6bab 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -575,12 +575,12 @@ void OPENGL_GAL::EndDrawing() { wxASSERT_MSG( m_isContextLocked, "What happened to the context lock?" ); - PROF_COUNTER cntTotal("gl-end-total"); - PROF_COUNTER cntEndCached("gl-end-cached"); - PROF_COUNTER cntEndNoncached("gl-end-noncached"); - PROF_COUNTER cntEndOverlay("gl-end-overlay"); - PROF_COUNTER cntComposite("gl-composite"); - PROF_COUNTER cntSwap("gl-swap"); + PROF_TIMER cntTotal("gl-end-total"); + PROF_TIMER cntEndCached("gl-end-cached"); + PROF_TIMER cntEndNoncached("gl-end-noncached"); + PROF_TIMER cntEndOverlay("gl-end-overlay"); + PROF_TIMER cntComposite("gl-composite"); + PROF_TIMER cntSwap("gl-swap"); cntTotal.Start(); // Cached & non-cached containers are rendered to the same buffer diff --git a/common/trace_helpers.cpp b/common/trace_helpers.cpp index 54c1b84a3e..bc57acad56 100644 --- a/common/trace_helpers.cpp +++ b/common/trace_helpers.cpp @@ -320,11 +320,13 @@ void TRACE_MANAGER::init() return; wxStringTokenizer tokenizer( traceVars, wxT( "," ) ); + while( tokenizer.HasMoreTokens() ) { wxString token = tokenizer.GetNextToken(); m_enabledTraces[token] = true; - if( token == wxT( "all" ) ) + + if( token.Lower() == wxT( "all" ) ) m_printAllTraces = true; } -} \ No newline at end of file +} diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 59228d7d52..6e25ddb25f 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -437,12 +437,12 @@ void CONNECTION_GRAPH::Reset() void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnconditional, std::function* aChangedItemHandler ) { - PROF_COUNTER recalc_time( "CONNECTION_GRAPH::Recalculate" ); + PROF_TIMER recalc_time( "CONNECTION_GRAPH::Recalculate" ); if( aUnconditional ) Reset(); - PROF_COUNTER update_items( "updateItemConnectivity" ); + PROF_TIMER update_items( "updateItemConnectivity" ); m_sheetList = aSheetList; @@ -467,7 +467,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco if( wxLog::IsAllowedTraceMask( ConnProfileMask ) ) update_items.Show(); - PROF_COUNTER build_graph( "buildConnectionGraph" ); + PROF_TIMER build_graph( "buildConnectionGraph" ); buildConnectionGraph(); diff --git a/include/profile.h b/include/profile.h index afcea9502f..378fb69080 100644 --- a/include/profile.h +++ b/include/profile.h @@ -42,7 +42,7 @@ * 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() */ -class PROF_COUNTER +class PROF_TIMER { public: /** @@ -51,7 +51,7 @@ public: * @param aName a string that will be printed in message. * @param aAutostart true (default) to immediately start the timer */ - PROF_COUNTER( const std::string& aName, bool aAutostart = true ) : + PROF_TIMER( const std::string& aName, bool aAutostart = true ) : m_name( aName ), m_running( false ) { if( aAutostart ) @@ -63,7 +63,7 @@ public: * * The counter is started and the string to print in message is left empty. */ - PROF_COUNTER() + PROF_TIMER() { Start(); } @@ -177,7 +177,7 @@ private: * * DURATION duration; // select a duration type as needed * { - * SCOPED_PROF_COUNTER timer( duration ); + * SCOPED_PROF_TIMER timer( duration ); * timed_activity(); * } * // duration is now the time timed activity took @@ -186,14 +186,14 @@ private: * omit the . */ template -class SCOPED_PROF_COUNTER +class SCOPED_PROF_TIMER : public PROF_TIMER { public: - SCOPED_PROF_COUNTER( DURATION& aDuration ) : m_counter(), m_duration( aDuration ) + SCOPED_PROF_TIMER( DURATION& aDuration ) : PROF_TIMER(), m_duration( aDuration ) { } - ~SCOPED_PROF_COUNTER() + ~SCOPED_PROF_TIMER() { // update the output m_duration = m_counter.SinceStart(); @@ -201,7 +201,7 @@ public: private: ///< The counter to use to do the profiling - PROF_COUNTER m_counter; + PROF_TIMER m_counter; ///< The duration to update at the end of the scope DURATION& m_duration; @@ -209,7 +209,7 @@ private: /** - * An alternate way to calculate an elapset time (in microsecondes) to class PROF_COUNTER + * An alternate way to calculate an elapsed time (in microsecondes) to class PROF_COUNTER * * @return an ever increasing indication of elapsed microseconds. Use this by computing * differences between two calls. diff --git a/qa/common_tools/tools/sexpr_parser/sexpr_parse.cpp b/qa/common_tools/tools/sexpr_parser/sexpr_parse.cpp index 75e82a8936..3b1682a6a7 100644 --- a/qa/common_tools/tools/sexpr_parser/sexpr_parse.cpp +++ b/qa/common_tools/tools/sexpr_parser/sexpr_parse.cpp @@ -54,7 +54,7 @@ public: // biggest files will fit in) const std::string sexpr_str( std::istreambuf_iterator( aStream ), {} ); - PROF_COUNTER timer; + PROF_TIMER timer; // Perform the parse std::unique_ptr sexpr( m_parser.Parse( sexpr_str ) ); @@ -158,4 +158,4 @@ static bool registered = UTILITY_REGISTRY::Register( { "sexpr_parser", "Benchmark s-expression parsing", sexpr_parser_func, -} ); \ No newline at end of file +} ); diff --git a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp index 5227f3b5c9..f9cf0e8d66 100644 --- a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp +++ b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp @@ -67,7 +67,7 @@ bool parse( std::istream& aStream, bool aVerbose ) try { - PROF_COUNTER timer; + PROF_TIMER timer; board = parser.Parse(); duration = timer.SinceStart(); diff --git a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp index a2cbcd5fc8..4472680c33 100644 --- a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp +++ b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp @@ -218,7 +218,7 @@ int polygon_triangulation_main( int argc, char *argv[] ) return POLY_TRI_RET_CODES::LOAD_FAILED; - PROF_COUNTER cnt( "allBoard" ); + PROF_TIMER cnt( "allBoard" ); std::atomic zonesToTriangulate( 0 ); diff --git a/qa/pns/pns_log_viewer.cpp b/qa/pns/pns_log_viewer.cpp index 84dd89ec23..3c1b30de2f 100644 --- a/qa/pns/pns_log_viewer.cpp +++ b/qa/pns/pns_log_viewer.cpp @@ -814,7 +814,7 @@ int render_perftest_main_func( int argc, char* argv[] ) return 0; } - PROF_COUNTER cnt("load-board"); + PROF_TIMER cnt("load-board"); std::shared_ptr brd ( loadBoard( argv[1] ) ); cnt.Stop(); diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp index 02f9af80cb..cd7d9eec6f 100644 --- a/qa/qa_utils/pcb_test_frame.cpp +++ b/qa/qa_utils/pcb_test_frame.cpp @@ -77,11 +77,11 @@ void PCB_TEST_FRAME_BASE::SetBoard( std::shared_ptr b ) { m_board = b; - PROF_COUNTER cntConnectivity( "connectivity-build" ); + PROF_TIMER cntConnectivity( "connectivity-build" ); m_board->GetConnectivity()->Build( m_board.get() ); cntConnectivity.Stop(); - PROF_COUNTER cntView("view-build"); + PROF_TIMER cntView("view-build"); m_galPanel->DisplayBoard( m_board.get() ); cntView.Stop();