source: src/Common/Stats/Time.h @ 1bb9a9a

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

Added better support for enabling/disabling/compiling-out statistics

  • Property mode set to 100644
File size: 780 bytes
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
20namespace Stats {
21        namespace Time {
22                void StartBlock(const char * const name);
23                void StopBlock();
24
25                void print();
26
27                struct BlockGuard {
28                        BlockGuard(const char * const name ) { StartBlock(name); }
29                        ~BlockGuard() { StopBlock(); }
30                };
31
32                template<typename func_t>
33                void TimeBLock(const char * name, func_t func) {
34                        BlockGuard guard(name);
35                        func();
36                }
37        }
38}
Note: See TracBrowser for help on using the repository browser.