Ignore:
Timestamp:
Mar 4, 2019, 3:52:46 PM (6 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:
79eaeb7
Parents:
1bb9a9a
Message:

First draft at timing results, left is better printing and more data

File:
1 edited

Legend:

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

    r1bb9a9a r4f97937  
    1818#include "Common/Stats/Base.h"
    1919
     20#if defined( NO_STATISTICS )
     21        #define NO_TIME_STATISTICS
     22#endif
     23
    2024namespace Stats {
    2125        namespace Time {
    22                 void StartBlock(const char * const name);
    23                 void StopBlock();
     26#               if defined(NO_TIME_STATISTICS)
     27                        inline void StartBlock(const char * const) {}
     28                        inline void StopBlock() {}
    2429
    25                 void print();
     30                        inline void print() {}
    2631
    27                 struct BlockGuard {
    28                         BlockGuard(const char * const name ) { StartBlock(name); }
    29                         ~BlockGuard() { StopBlock(); }
    30                 };
     32                        struct BlockGuard {
     33                                BlockGuard(const char * const) {}
     34                                ~BlockGuard() {}
     35                        };
    3136
    32                 template<typename func_t>
    33                 void TimeBLock(const char * name, func_t func) {
    34                         BlockGuard guard(name);
    35                         func();
    36                 }
     37                        template<typename func_t>
     38                        inline void TimeBLock(const char *, func_t) {}
     39#               else
     40                        void StartBlock(const char * const name);
     41                        void StopBlock();
     42
     43                        void print();
     44
     45                        struct BlockGuard {
     46                                BlockGuard(const char * const name ) { StartBlock(name); }
     47                                ~BlockGuard() { StopBlock(); }
     48                        };
     49
     50                        template<typename func_t>
     51                        inline void TimeBLock(const char * name, func_t func) {
     52                                BlockGuard guard(name);
     53                                func();
     54                        }
     55#               endif
    3756        }
    3857}
Note: See TracChangeset for help on using the changeset viewer.