ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
persistent-indexer
pthread-emulation
qualifiedEnum
Last change
on this file since 874ffa4 was 1cb7fab2, checked in by tdelisle <tdelisle@…>, 7 years ago |
Added better support for enabling/disabling/compiling-out statistics
|
-
Property mode
set to
100644
|
File size:
780 bytes
|
Rev | Line | |
---|
[1cb7fab2] | 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 | namespace 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.