FAUST compiler
0.9.9.6b8
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
errors
timing.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <cassert>
3
#ifndef WIN32
4
#include <sys/time.h>
5
#endif
6
#include "
compatibility.hh
"
7
#include "
timing.hh
"
8
9
using namespace
std;
10
11
extern
bool
gTimingSwitch
;
12
13
#if 1
14
double
mysecond
()
15
{
16
struct
timeval tp;
17
struct
timezone tzp;
18
int
i;
19
20
i = gettimeofday(&tp,&tzp);
21
return
( (
double
) tp.tv_sec + (
double
) tp.tv_usec * 1.e-6 );
22
}
23
24
int
lIndex
=0;
25
double
lStartTime
[1024];
26
double
lEndTime
[1024];
27
28
static
void
tab
(
int
n, ostream& fout)
29
{
30
fout <<
'\n'
;
31
while
(n--) fout <<
'\t'
;
32
}
33
34
void
startTiming
(
const
char
* msg)
35
{
36
if
(
gTimingSwitch
) {
37
assert(
lIndex
< 1023);
38
tab
(
lIndex
, cerr); cerr <<
"start "
<< msg << endl;
39
lStartTime
[
lIndex
++] =
mysecond
();
40
}
41
}
42
43
void
endTiming
(
const
char
* msg)
44
{
45
if
(
gTimingSwitch
) {
46
assert(
lIndex
>0);
47
lEndTime
[--
lIndex
] =
mysecond
();
48
tab
(
lIndex
, cerr); cerr <<
"end "
<< msg <<
" (duration : "
<<
lEndTime
[
lIndex
] -
lStartTime
[
lIndex
] <<
")"
<< endl;
49
}
50
}
51
52
#else
53
54
void
startTiming
(
const
char
* msg)
55
{}
56
57
void
endTiming
(
const
char
* msg)
58
{}
59
60
#endif
61
endTiming
void endTiming(const char *msg)
Definition:
timing.cpp:43
compatibility.hh
timing.hh
tab
static void tab(int n, ostream &fout)
Definition:
timing.cpp:28
startTiming
void startTiming(const char *msg)
Definition:
timing.cpp:34
lEndTime
double lEndTime[1024]
Definition:
timing.cpp:26
lStartTime
double lStartTime[1024]
Definition:
timing.cpp:25
gTimingSwitch
bool gTimingSwitch
Definition:
main.cpp:115
mysecond
double mysecond()
Definition:
timing.cpp:14
lIndex
int lIndex
Definition:
timing.cpp:24
Generated on Fri Sep 5 2014 18:06:37 for FAUST compiler by
1.8.7