Changeset 095b99a for src


Ignore:
Timestamp:
Jan 17, 2020, 10:49:22 AM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9e63a2b
Parents:
d62806c
Message:

Added TimeCall? as a more flexible alternative to TimeBlock?. TimeBlock? remains for when you create a block like lambda.

Location:
src
Files:
2 edited

Legend:

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

    rd62806c r095b99a  
    99// Author           : Thierry Delisle
    1010// Created On       : Fri Mar 01 15:14:11 2019
    11 // Last Modified By :
     11// Last Modified By : Andrew Beach
    1212// Last Modified On :
    1313// Update Count     :
     
    4141                                f();
    4242                        }
     43
     44                        template<typename ret_t = void, typename func_t, typename... arg_t>
     45                        inline ret_t TimeCall(
     46                                        const char *, func_t func, arg_t&&... arg) {
     47                                return func(std::forward<arg_t>(arg)...);
     48                        }
    4349#               else
    4450                        void StartGlobal();
     
    5965                                func();
    6066                        }
     67
     68                        template<typename ret_t = void, typename func_t, typename... arg_t>
     69                        inline ret_t TimeCall(
     70                                        const char * name, func_t func, arg_t&&... arg) {
     71                                BlockGuard guard(name);
     72                                return func(std::forward<arg_t>(arg)...);
     73                        }
    6174#               endif
    6275        }
  • src/SymTab/Validate.cc

    rd62806c r095b99a  
    375375                        Stats::Heap::newPass("validate-F");
    376376                        Stats::Time::BlockGuard guard("validate-F");
    377                         Stats::Time::TimeBlock("Fix Object Type", [&]() {
    378                                 FixObjectType::fix( translationUnit );
    379                         });
    380                         Stats::Time::TimeBlock("Array Length", [&]() {
    381                                 ArrayLength::computeLength( translationUnit );
    382                         });
    383                         Stats::Time::TimeBlock("Find Special Declarations", [&]() {
    384                                 Validate::findSpecialDecls( translationUnit );
    385                         });
    386                         Stats::Time::TimeBlock("Fix Label Address", [&]() {
    387                                 mutateAll( translationUnit, labelAddrFixer );
    388                         });
    389                         Stats::Time::TimeBlock("Handle Attributes", [&]() {
    390                                 Validate::handleAttributes( translationUnit );
    391                         });
     377                        Stats::Time::TimeCall("Fix Object Type",
     378                                FixObjectType::fix, translationUnit);
     379                        Stats::Time::TimeCall("Array Length",
     380                                ArrayLength::computeLength, translationUnit);
     381                        Stats::Time::TimeCall("Find Special Declarations",
     382                                Validate::findSpecialDecls, translationUnit);
     383                        Stats::Time::TimeCall("Fix Label Address",
     384                                mutateAll<LabelAddressFixer>, translationUnit, labelAddrFixer);
     385                        Stats::Time::TimeCall("Handle Attributes",
     386                                Validate::handleAttributes, translationUnit);
    392387                }
    393388        }
Note: See TracChangeset for help on using the changeset viewer.