Browse Source

Add simple timer profiling to DRC engine.

Remove the PROFILE definitions from the incremental connectivity
profiling so a special build isn't required.  If the starting and
stopping the profile timer is excessive, we can add this back.

(cherry picked from commit 8a09e5f3c3)
pcb_db
Wayne Stambaugh 1 year ago
parent
commit
425958d754
  1. 4
      eeschema/sch_edit_frame.cpp
  2. 17
      pcbnew/drc/drc_engine.cpp

4
eeschema/sch_edit_frame.cpp

@ -1773,9 +1773,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
if( !aCommit )
aCommit = &localCommit;
#ifdef PROFILE
PROF_TIMER timer;
#endif
// Ensure schematic graph is accurate
if( aCleanupFlags == LOCAL_CLEANUP )
@ -1788,10 +1786,8 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
SchematicCleanUp( aCommit, sheet.LastScreen() );
}
#ifdef PROFILE
timer.Stop();
wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() );
#endif
if( settings.m_IntersheetRefsShow )
RecomputeIntersheetRefs();

17
pcbnew/drc/drc_engine.cpp

@ -24,6 +24,7 @@
*/
#include <atomic>
#include <wx/log.h>
#include <reporter.h>
#include <progress_reporter.h>
#include <string_utils.h>
@ -39,6 +40,7 @@
#include <footprint.h>
#include <pad.h>
#include <pcb_track.h>
#include <core/profile.h>
#include <core/thread_pool.h>
#include <zone.h>
@ -49,6 +51,16 @@
#define EXTENDED_ERROR_LIMIT 499
/**
* Flag to enable DRC profile timing logging.
*
* Use "KICAD_DRC_PROFILE" to enable.
*
* @ingroup trace_env_vars
*/
static const wxChar* traceDrcProfile = wxT( "KICAD_DRC_PROFILE" );
void drcPrintDebugMessage( int level, const wxString& msg, const char *function, int line )
{
wxString valueStr;
@ -598,6 +610,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints,
BOARD_COMMIT* aCommit )
{
PROF_TIMER timer;
SetUserUnits( aUnits );
m_reportAllTrackErrors = aReportAllTrackErrors;
@ -634,6 +648,9 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
break;
}
timer.Stop();
wxLogTrace( traceDrcProfile, "DRC took %0.3f ms", timer.msecs() );
// DRC tests are multi-threaded; anything that causes us to attempt to re-generate the
// caches while DRC is running is problematic.
wxASSERT( timestamp == m_board->GetTimeStamp() );

Loading…
Cancel
Save