Changeset 3c0d4cd


Ignore:
Timestamp:
Mar 5, 2019, 2:17:45 PM (5 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
c884f2d
Parents:
79eaeb7
Message:

Fixed/implemented % of parent printing in timing sections

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Stats/Time.cc

    r79eaeb7 r3c0d4cd  
    3333                        typedef  std::chrono::time_point<std::chrono::high_resolution_clock> point_t;
    3434                        std::chrono::duration<double> total;
    35                         std::chrono::duration<double> parent;
    3635
    3736                        point_t global_begin;
     37
     38                        size_t prevl = 0;
     39                        size_t currl = 0;
    3840
    3941                        template<typename T>
     
    8587
    8688                                virtual void print(std::ostream & os) override {
     89                                        if(currl > prevl) {
     90                                                parents.push(last);
     91                                        } else if(currl < prevl) {
     92                                                parents.pop();
     93                                        } else {
     94                                                last = end - begin;
     95                                        }
     96
    8797                                        assert(finished);
    8898                                        std::chrono::duration<double> diff = end - begin;
    8999                                        os << diff << " | ";
    90                                         os << std::setw(7) << std::setprecision(0);
    91                                         os << size_t(100.0 * diff.count() / total.count()) << "% | ";
     100                                        if(parents.empty()) {
     101                                                os << "     N/A | ";
     102                                        } else {
     103                                                os << std::setw(7) << std::setprecision(0);
     104                                                os << size_t(100.0 * diff.count() / parents.top().count()) << "% | ";
     105                                        }
    92106                                        os << std::setw(5) << std::setprecision(0);
    93107                                        os << size_t(100.0 * diff.count() / total.count()) << "% ";
     
    111125                                point_t begin;
    112126                                point_t end;
     127
     128                                static std::chrono::duration<double> last;
     129                                static std::stack<std::chrono::duration<double>> parents;
    113130                        };
    114131
    115132                        std::stack<TimerNode *> nodes;
     133
     134                        std::chrono::duration<double> TimerNode::last = {};
     135                        std::stack<std::chrono::duration<double>> TimerNode::parents = {};
    116136
    117137                        void StartGlobal() {
     
    139159                                auto global_end = std::chrono::high_resolution_clock::now();
    140160                                total = global_end - global_begin;
    141                                 parent = total;
    142161
    143162                                size_t nc = 0;
     
    161180
    162181                                Base::ForAll(top, 0, [&](Base::TreeImpl * node, size_t level) {
     182                                        currl = level;
    163183                                        std::cerr << std::string(level * 4, ' ');
    164184                                        std::cerr << node->name;
     
    168188                                        std::cerr << " |";
    169189                                        std::cerr << '\n';
     190                                        prevl = level;
    170191                                }, true);
    171192
  • src/SymTab/Validate.cc

    r79eaeb7 r3c0d4cd  
    304304                PassVisitor<FixQualifiedTypes> fixQual;
    305305
    306                 Stats::Heap::newPass("validate-A");
    307                 acceptAll( translationUnit, hoistDecls );
    308                 ReplaceTypedef::replaceTypedef( translationUnit );
    309                 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    310                 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    311                 Stats::Heap::newPass("validate-B");
    312                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    313                 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    314                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    315                 EliminateTypedef::eliminateTypedef( translationUnit ); //
    316                 Stats::Heap::newPass("validate-C");
    317                 acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    318                 VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    319                 ReturnChecker::checkFunctionReturns( translationUnit );
    320                 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    321                 Stats::Heap::newPass("validate-D");
    322                 Concurrency::applyKeywords( translationUnit );
    323                 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    324                 ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    325                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    326                 Stats::Heap::newPass("validate-E");
    327                 Concurrency::implementMutexFuncs( translationUnit );
    328                 Concurrency::implementThreadStarter( translationUnit );
    329                 mutateAll( translationUnit, compoundliteral );
    330                 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    331                 Stats::Heap::newPass("validate-F");
    332                 FixObjectType::fix( translationUnit );
    333                 ArrayLength::computeLength( translationUnit );
    334                 acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    335                 mutateAll( translationUnit, labelAddrFixer );
    336                 Validate::handleAttributes( translationUnit );
     306                {
     307                        Stats::Heap::newPass("validate-A");
     308                        Stats::Time::BlockGuard guard("validate-A");
     309                        acceptAll( translationUnit, hoistDecls );
     310                        ReplaceTypedef::replaceTypedef( translationUnit );
     311                        ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     312                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
     313                }
     314                {
     315                        Stats::Heap::newPass("validate-B");
     316                        Stats::Time::BlockGuard guard("validate-B");
     317                        acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     318                        mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     319                        HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     320                        EliminateTypedef::eliminateTypedef( translationUnit ); //
     321                }
     322                {
     323                        Stats::Heap::newPass("validate-C");
     324                        Stats::Time::BlockGuard guard("validate-C");
     325                        acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
     326                        VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     327                        ReturnChecker::checkFunctionReturns( translationUnit );
     328                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     329                }
     330                {
     331                        Stats::Heap::newPass("validate-D");
     332                        Stats::Time::BlockGuard guard("validate-D");
     333                        Concurrency::applyKeywords( translationUnit );
     334                        acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     335                        ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
     336                        autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     337                }
     338                {
     339                        Stats::Heap::newPass("validate-E");
     340                        Stats::Time::BlockGuard guard("validate-E");
     341                        Concurrency::implementMutexFuncs( translationUnit );
     342                        Concurrency::implementThreadStarter( translationUnit );
     343                        mutateAll( translationUnit, compoundliteral );
     344                        ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     345                }
     346                {
     347                        Stats::Heap::newPass("validate-F");
     348                        Stats::Time::BlockGuard guard("validate-F");
     349                        FixObjectType::fix( translationUnit );
     350                        ArrayLength::computeLength( translationUnit );
     351                        acceptAll( translationUnit, finder ); // xxx - remove this pass soon
     352                        mutateAll( translationUnit, labelAddrFixer );
     353                        Validate::handleAttributes( translationUnit );
     354                }
    337355        }
    338356
  • src/main.cc

    r79eaeb7 r3c0d4cd  
    194194                } // if
    195195
     196                Stats::Time::StartGlobal();
    196197                NewPass("Parse");
    197                 Stats::Time::StartGlobal();
     198                Stats::Time::StartBlock("Parse");
    198199
    199200                // read in the builtins, extras, and the prelude
     
    247248                // works okay for now.
    248249                CodeTools::fillLocations( translationUnit );
     250                Stats::Time::StopBlock();
    249251
    250252                // add the assignment statement after the initialization of a type parameter
Note: See TracChangeset for help on using the changeset viewer.