source: src/Common/Stats/Time.h @ 4f97937

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 4f97937 was 4f97937, checked in by tdelisle <tdelisle@…>, 5 years ago

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

  • Property mode set to 100644
File size: 1.2 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Time.h --
8//
9// Author           : Thierry Delisle
10// Created On       : Fri Mar 01 15:14:11 2019
11// Last Modified By :
12// Last Modified On :
13// Update Count     :
14//
15
16#pragma once
17
18#include "Common/Stats/Base.h"
19
20#if defined( NO_STATISTICS )
21        #define NO_TIME_STATISTICS
22#endif
23
24namespace Stats {
25        namespace Time {
26#               if defined(NO_TIME_STATISTICS)
27                        inline void StartBlock(const char * const) {}
28                        inline void StopBlock() {}
29
30                        inline void print() {}
31
32                        struct BlockGuard {
33                                BlockGuard(const char * const) {}
34                                ~BlockGuard() {}
35                        };
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
56        }
57}
Note: See TracBrowser for help on using the repository browser.