Salome HOME
projects
/
modules
/
yacs.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git]
/
src
/
bases
/
chrono.hxx
1
#ifndef _CHRONO_HXX_
2
#define _CHRONO_HXX_
3
4
#include <vector>
5
#include <string>
6
#include <iostream>
7
#include <ctime>
8
9
typedef struct acnt
10
{
11
char* _ctrNames;
12
int _ctrLines;
13
int _ctrOccur;
14
double _ctrCumul;
15
} cntStruct;
16
17
class counters
18
{
19
public:
20
static cntStruct *_ctrs;
21
counters(int nb);
22
~counters();
23
void stats();
24
protected:
25
int _nbChrono;
26
};
27
28
class chrono
29
{
30
public:
31
chrono(int i);
32
~chrono();
33
void stop();
34
protected:
35
bool _run;
36
int _ctr;
37
clock_t _start, _end;
38
};
39
40
#ifdef CHRONODEF
41
#define CHRONO(i) counters::_ctrs[i]._ctrNames = __FILE__; \
42
counters::_ctrs[i]._ctrLines = __LINE__; \
43
chrono aChrono##i(i);
44
45
#define CHRONOSTOP(i) aChrono##i.stop();
46
47
#else // CHRONODEF
48
49
#define CHRONO(i)
50
#define CHRONOSTOP(i)
51
52
#endif // CHRONODEF
53
54
#endif // _CHRONO_HXX_