PROF_COUNTER -> PROF_TIMER

I want to add an event counter, and this one is a timer
This commit is contained in:
Jon Evans 2021-12-05 14:16:18 -05:00
parent 91359c047d
commit a205595404
11 changed files with 35 additions and 33 deletions

View File

@ -196,11 +196,11 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
KIGFX::RENDER_SETTINGS* settings =
static_cast<KIGFX::RENDER_SETTINGS*>( 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;

View File

@ -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;

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -437,12 +437,12 @@ void CONNECTION_GRAPH::Reset()
void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnconditional,
std::function<void( SCH_ITEM* )>* 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();

View File

@ -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<DURATION> timer( duration );
* SCOPED_PROF_TIMER<DURATION> timer( duration );
* timed_activity();
* }
* // duration is now the time timed activity took
@ -186,14 +186,14 @@ private:
* omit the <DURATION>.
*/
template <typename DURATION>
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<DURATION>();
@ -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.

View File

@ -54,7 +54,7 @@ public:
// biggest files will fit in)
const std::string sexpr_str( std::istreambuf_iterator<char>( aStream ), {} );
PROF_COUNTER timer;
PROF_TIMER timer;
// Perform the parse
std::unique_ptr<SEXPR::SEXPR> 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,
} );
} );

View File

@ -67,7 +67,7 @@ bool parse( std::istream& aStream, bool aVerbose )
try
{
PROF_COUNTER timer;
PROF_TIMER timer;
board = parser.Parse();
duration = timer.SinceStart<PARSE_DURATION>();

View File

@ -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<size_t> zonesToTriangulate( 0 );

View File

@ -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<BOARD> brd ( loadBoard( argv[1] ) );
cnt.Stop();

View File

@ -77,11 +77,11 @@ void PCB_TEST_FRAME_BASE::SetBoard( std::shared_ptr<BOARD> 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();