diff options
| -rw-r--r-- | src/main.cpp | 7 | ||||
| -rw-r--r-- | src/viewerfactory.cpp | 2 | ||||
| -rw-r--r-- | src/viewerplainpct.cpp | 45 | ||||
| -rw-r--r-- | src/viewerplainpct.h | 9 | 
4 files changed, 39 insertions, 24 deletions
| diff --git a/src/main.cpp b/src/main.cpp index b7cf6e7..ebde3aa 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -33,6 +33,8 @@ public: | |||
| 33 | "Switch to percent view."); | 33 | "Switch to percent view."); | 
| 34 | addParam('P', mkproc(Param::procViewPlain), | 34 | addParam('P', mkproc(Param::procViewPlain), | 
| 35 | "Switch to plain view."); | 35 | "Switch to plain view."); | 
| 36 | addParam("color", mkproc(Param::procColorPercent), | ||
| 37 | "Switch to colored percent view."); | ||
| 36 | addParam('m', mkproc(Param::procViewMake), | 38 | addParam('m', mkproc(Param::procViewMake), | 
| 37 | "Switch to 'make' style view."); | 39 | "Switch to 'make' style view."); | 
| 38 | addParam("cache", &sCache, | 40 | addParam("cache", &sCache, | 
| @@ -77,6 +79,11 @@ public: | |||
| 77 | sView = "make"; | 79 | sView = "make"; | 
| 78 | } | 80 | } | 
| 79 | 81 | ||
| 82 | int procColorPercent( int argc, char *argv[] ) | ||
| 83 | { | ||
| 84 | sView = "colorpct"; | ||
| 85 | } | ||
| 86 | |||
| 80 | std::string sCache; | 87 | std::string sCache; | 
| 81 | std::string sFile; | 88 | std::string sFile; | 
| 82 | std::string sView; | 89 | std::string sView; | 
| diff --git a/src/viewerfactory.cpp b/src/viewerfactory.cpp index 52ec5d4..7826a6a 100644 --- a/src/viewerfactory.cpp +++ b/src/viewerfactory.cpp | |||
| @@ -4,6 +4,7 @@ extern struct PluginInfo plain; | |||
| 4 | extern struct PluginInfo percent; | 4 | extern struct PluginInfo percent; | 
| 5 | extern struct PluginInfo make; | 5 | extern struct PluginInfo make; | 
| 6 | extern struct PluginInfo plainpct; | 6 | extern struct PluginInfo plainpct; | 
| 7 | extern struct PluginInfo colorpct; | ||
| 7 | 8 | ||
| 8 | ViewerFactory::ViewerFactory() | 9 | ViewerFactory::ViewerFactory() | 
| 9 | { | 10 | { | 
| @@ -11,6 +12,7 @@ ViewerFactory::ViewerFactory() | |||
| 11 | registerBuiltinPlugin( &percent ); | 12 | registerBuiltinPlugin( &percent ); | 
| 12 | registerBuiltinPlugin( &make ); | 13 | registerBuiltinPlugin( &make ); | 
| 13 | registerBuiltinPlugin( &plainpct ); | 14 | registerBuiltinPlugin( &plainpct ); | 
| 15 | registerBuiltinPlugin( &colorpct ); | ||
| 14 | } | 16 | } | 
| 15 | 17 | ||
| 16 | ViewerFactory::~ViewerFactory() | 18 | ViewerFactory::~ViewerFactory() | 
| diff --git a/src/viewerplainpct.cpp b/src/viewerplainpct.cpp index dcf90ec..9988ca7 100644 --- a/src/viewerplainpct.cpp +++ b/src/viewerplainpct.cpp | |||
| @@ -33,7 +33,8 @@ void ViewerPlainPct::endCommand() | |||
| 33 | if( sCmd.front().bCmdClean == false ) | 33 | if( sCmd.front().bCmdClean == false ) | 
| 34 | printf("\n"); | 34 | printf("\n"); | 
| 35 | sCmd.pop_front(); | 35 | sCmd.pop_front(); | 
| 36 | iCC++; | 36 | if(sCmd.empty()) | 
| 37 | iCC++; | ||
| 37 | } | 38 | } | 
| 38 | 39 | ||
| 39 | void ViewerPlainPct::indent() | 40 | void ViewerPlainPct::indent() | 
| @@ -53,58 +54,62 @@ void ViewerPlainPct::printHead() | |||
| 53 | bRunClean = false; | 54 | bRunClean = false; | 
| 54 | sCmd.front().bCmdClean = false; | 55 | sCmd.front().bCmdClean = false; | 
| 55 | indent(); | 56 | indent(); | 
| 56 | printf("--- [%d/%d] %s ---\n", iCC, iTC, sCmd.front().sTarget.c_str() ); | 57 | if(sCmd.size() > 1) | 
| 58 | printf("--- %s ---\n", sCmd.front().sTarget.c_str() ); | ||
| 59 | else | ||
| 60 | printf("--- [%d/%d] %s ---\n", iCC, iTC, sCmd.front().sTarget.c_str() ); | ||
| 57 | } | 61 | } | 
| 58 | } | 62 | } | 
| 59 | 63 | ||
| 64 | void ViewerPlainPct::printPerform(const char *sRule, const char *sTarget) | ||
| 65 | { | ||
| 66 | int iPct = (int)round( | ||
| 67 | ((double)sCmd.front().iCP/(double)sCmd.front().iTP)*100.0 | ||
| 68 | ); | ||
| 69 | if(sCmd.size() > 1) | ||
| 70 | printf( "[%3d%%] %8s: %s\n", iPct, sRule, sTarget ); | ||
| 71 | else | ||
| 72 | printf( "[%3d%%] %8s: %s\n", iPct, sRule, sTarget ); | ||
| 73 | } | ||
| 74 | |||
| 60 | void ViewerPlainPct::beginRequiresCheck( bool bCached, const std::string &sName ) | 75 | void ViewerPlainPct::beginRequiresCheck( bool bCached, const std::string &sName ) | 
| 61 | { | 76 | { | 
| 62 | printHead(); | 77 | printHead(); | 
| 63 | indent(); | 78 | indent(); | 
| 64 | printf("[%3d%%] deps: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), sName.c_str() ); | 79 | printPerform("deps", sName.c_str()); | 
| 65 | } | 80 | } | 
| 66 | 81 | ||
| 67 | void ViewerPlainPct::endRequiresCheck() | 82 | void ViewerPlainPct::endRequiresCheck() | 
| 68 | { | 83 | { | 
| 69 | iCP++; | 84 | sCmd.front().iCP++; | 
| 70 | //bDidReq = true; | ||
| 71 | } | 85 | } | 
| 72 | 86 | ||
| 73 | void ViewerPlainPct::skipRequiresCheck( bool bCached, const std::string &sName ) | 87 | void ViewerPlainPct::skipRequiresCheck( bool bCached, const std::string &sName ) | 
| 74 | { | 88 | { | 
| 75 | iCP++; | 89 | sCmd.front().iCP++; | 
| 76 | /* printHead(); | ||
| 77 | indent(); | ||
| 78 | printf("[%3d%%] ! deps: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), sName.c_str() );*/ | ||
| 79 | } | 90 | } | 
| 80 | 91 | ||
| 81 | void ViewerPlainPct::beginPerform( Perform *pPerform ) | 92 | void ViewerPlainPct::beginPerform( Perform *pPerform ) | 
| 82 | { | 93 | { | 
| 83 | printHead(); | 94 | printHead(); | 
| 84 | indent(); | 95 | indent(); | 
| 85 | printf("[%3d%%] %8s: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), pPerform->getRule().c_str(), pPerform->getTarget().c_str() ); | 96 | printPerform(pPerform->getRule().c_str(), pPerform->getTarget().c_str()); | 
| 86 | } | 97 | } | 
| 87 | 98 | ||
| 88 | void ViewerPlainPct::endPerform() | 99 | void ViewerPlainPct::endPerform() | 
| 89 | { | 100 | { | 
| 90 | //if(!bDidReq) | 101 | sCmd.front().iCP++; | 
| 91 | iCP++; | ||
| 92 | //bDidReq = false; | ||
| 93 | } | 102 | } | 
| 94 | 103 | ||
| 95 | void ViewerPlainPct::skipPerform( Perform *pPerform ) | 104 | void ViewerPlainPct::skipPerform( Perform *pPerform ) | 
| 96 | { | 105 | { | 
| 97 | iCP++; | 106 | sCmd.front().iCP++; | 
| 98 | /* printHead(); | ||
| 99 | indent(); | ||
| 100 | printf("[%3d%%] ! %8s: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), pPerform->getRule().c_str(), pPerform->getTarget().c_str() );*/ | ||
| 101 | } | 107 | } | 
| 102 | 108 | ||
| 103 | void ViewerPlainPct::beginPerforms( int nCount ) | 109 | void ViewerPlainPct::beginPerforms( int nCount ) | 
| 104 | { | 110 | { | 
| 105 | iTP = nCount*2; | 111 | sCmd.front().iTP = nCount*2; | 
| 106 | iCP = 1; | 112 | sCmd.front().iCP = 1; | 
| 107 | //bDidReq = false; | ||
| 108 | } | 113 | } | 
| 109 | 114 | ||
| 110 | void ViewerPlainPct::beginAction( const std::string &sName, int nCommands ) | 115 | void ViewerPlainPct::beginAction( const std::string &sName, int nCommands ) | 
| diff --git a/src/viewerplainpct.h b/src/viewerplainpct.h index aa9a228..63bc00d 100644 --- a/src/viewerplainpct.h +++ b/src/viewerplainpct.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef VIEWER_PLAIN_H | 1 | #ifndef VIEWER_PLAIN_PCT_H | 
| 2 | #define VIEWER_PLAIN_H | 2 | #define VIEWER_PLAIN_PCT_H | 
| 3 | 3 | ||
| 4 | #include <stdint.h> | 4 | #include <stdint.h> | 
| 5 | #include <list> | 5 | #include <list> | 
| @@ -27,12 +27,12 @@ public: | |||
| 27 | 27 | ||
| 28 | virtual void endAction(); | 28 | virtual void endAction(); | 
| 29 | 29 | ||
| 30 | void printPerform(const char *sRule, const char *sTarget); | ||
| 30 | void printHead(); | 31 | void printHead(); | 
| 31 | void indent(); | 32 | void indent(); | 
| 32 | 33 | ||
| 33 | private: | 34 | private: | 
| 34 | //bool bDidReq; | 35 | int iTC, iCC; | 
| 35 | int iTP, iCP, iTC, iCC; | ||
| 36 | 36 | ||
| 37 | bool bRunClean; | 37 | bool bRunClean; | 
| 38 | typedef struct | 38 | typedef struct | 
| @@ -40,6 +40,7 @@ private: | |||
| 40 | int nLevel; | 40 | int nLevel; | 
| 41 | bool bCmdClean; | 41 | bool bCmdClean; | 
| 42 | std::string sTarget; | 42 | std::string sTarget; | 
| 43 | int iTP, iCP; | ||
| 43 | } Cmd; | 44 | } Cmd; | 
| 44 | typedef std::list<Cmd> CmdStack; | 45 | typedef std::list<Cmd> CmdStack; | 
| 45 | CmdStack sCmd; | 46 | CmdStack sCmd; | 
