From 9868a2005820a4291f97b3080168af39b429a03c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 4 Nov 2006 00:07:51 +0000 Subject: Getting closer to the percents making some damn sense. --- src/targetfile.cpp | 14 +++++++++++++- src/viewer.cpp | 8 ++++++++ src/viewer.h | 2 ++ src/viewerplainpct.cpp | 26 +++++++++++++++++++++----- src/viewerplainpct.h | 5 ++++- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/targetfile.cpp b/src/targetfile.cpp index dacf521..1a73cc6 100644 --- a/src/targetfile.cpp +++ b/src/targetfile.cpp @@ -38,16 +38,19 @@ void TargetFile::check( Build &bld ) { time_t tTarget = getTime( bld, (*i)->getTarget() ); StringList &reqs = bld.getRequires( (*i)->getTarget() ); - bool bExtras = false; + bool bExtras = false, bBuilt = false, bUpdate = false; for( StringList::iterator j = reqs.begin(); j != reqs.end(); j++ ) { //bld.chainTarget( *j ); if( getTime( bld, *j ) > tTarget ) { + if( bUpdate == false ) + bld.getView()->skipRequiresCheck( false, (*i)->getTarget() ) ; bld.getView()->beginPerform( *i ); (*i)->execute( bld ); bld.getView()->endPerform(); updateTime( (*i)->getTarget() ); + bBuilt = true; break; } if( bExtras == false ) @@ -59,11 +62,20 @@ void TargetFile::check( Build &bld ) if( !bld.getCached( (*i)->getTarget(), tTarget, reqs ) ) { bld.updateCache( (*i)->getTarget(), (*i)->getReqFuncs(), reqs ); + bUpdate = true; } bExtras = true; } } } + if( bBuilt == false ) + { + if( bUpdate == false ) + { + bld.getView()->skipRequiresCheck( false, (*i)->getTarget() ); + } + bld.getView()->skipPerform( *i ); + } } bld.getView()->endPerforms(); diff --git a/src/viewer.cpp b/src/viewer.cpp index 5998316..1f3b26f 100644 --- a/src/viewer.cpp +++ b/src/viewer.cpp @@ -40,6 +40,10 @@ void Viewer::endRequiresCheck() { } +void Viewer::skipRequiresCheck( bool bCached, const std::string &sName ) +{ +} + void Viewer::beginPerform( Perform *pPerform ) { } @@ -48,6 +52,10 @@ void Viewer::endPerform() { } +void Viewer::skipPerform( Perform *pPerform ) +{ +} + void Viewer::beginExecute() { } diff --git a/src/viewer.h b/src/viewer.h index 86410f0..7ee6b21 100644 --- a/src/viewer.h +++ b/src/viewer.h @@ -23,8 +23,10 @@ public: virtual void beginRequiresCheck( bool bCached, const std::string &sName ); virtual void endRequiresCheck(); + virtual void skipRequiresCheck( bool bCached, const std::string &sName ); virtual void beginPerform( Perform *pPerform ); virtual void endPerform(); + virtual void skipPerform( Perform *pPerform ); virtual void beginExecute(); virtual void endExecute(); virtual void executeCmd( const std::string &sCmd ); diff --git a/src/viewerplainpct.cpp b/src/viewerplainpct.cpp index a7baff1..dcf90ec 100644 --- a/src/viewerplainpct.cpp +++ b/src/viewerplainpct.cpp @@ -67,7 +67,15 @@ void ViewerPlainPct::beginRequiresCheck( bool bCached, const std::string &sName void ViewerPlainPct::endRequiresCheck() { iCP++; - bDidReq = true; + //bDidReq = true; +} + +void ViewerPlainPct::skipRequiresCheck( bool bCached, const std::string &sName ) +{ + iCP++; +/* printHead(); + indent(); + printf("[%3d%%] ! deps: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), sName.c_str() );*/ } void ViewerPlainPct::beginPerform( Perform *pPerform ) @@ -79,16 +87,24 @@ void ViewerPlainPct::beginPerform( Perform *pPerform ) void ViewerPlainPct::endPerform() { - if(!bDidReq) + //if(!bDidReq) iCP++; - bDidReq = false; + //bDidReq = false; +} + +void ViewerPlainPct::skipPerform( Perform *pPerform ) +{ + iCP++; +/* printHead(); + indent(); + printf("[%3d%%] ! %8s: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), pPerform->getRule().c_str(), pPerform->getTarget().c_str() );*/ } void ViewerPlainPct::beginPerforms( int nCount ) { - iTP = nCount; + iTP = nCount*2; iCP = 1; - bDidReq = false; + //bDidReq = false; } void ViewerPlainPct::beginAction( const std::string &sName, int nCommands ) diff --git a/src/viewerplainpct.h b/src/viewerplainpct.h index 5a57ef0..aa9a228 100644 --- a/src/viewerplainpct.h +++ b/src/viewerplainpct.h @@ -20,6 +20,9 @@ public: virtual void endPerform(); virtual void beginPerforms( int nCount ); + virtual void skipRequiresCheck( bool bCached, const std::string &sName ); + virtual void skipPerform( Perform *pPerform ); + virtual void beginAction( const std::string &sName, int nCommands ); virtual void endAction(); @@ -28,7 +31,7 @@ public: void indent(); private: - bool bDidReq; + //bool bDidReq; int iTP, iCP, iTC, iCC; bool bRunClean; -- cgit v1.2.3