GUIDOLib
1.7.7
Guido Engine Internal Documentation
src
engine
tools
benchtools.h
1
/*
2
GUIDO Library
3
Copyright (C) 2010 Grame
4
5
This Source Code Form is subject to the terms of the Mozilla Public
6
License, v. 2.0. If a copy of the MPL was not distributed with this
7
file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10
research@grame.fr
11
12
*/
13
14
#ifndef __benchtools__
15
#define __benchtools__
16
17
#include <iostream>
18
//#include <vector>
19
//#include <map>
20
21
#ifdef __x86_64__
22
#define __uint32 unsigned int
23
#define __uint64 unsigned long int
24
25
#define __int32 int
26
#define __int64 long int
27
28
#else
29
30
#ifndef __uint32
31
#define __uint32 unsigned int
32
#endif
33
34
#ifndef __uint64
35
#define __uint64 unsigned long long int
36
#endif
37
38
#ifndef __int32
39
#define __int32 int
40
#endif
41
42
#ifndef __int64
43
#define __int64 long long int
44
#endif
45
#endif
46
47
#ifndef WIN32
48
__uint64 rdtsc(
void
);
49
#else
50
__uint64 __cdecl rdtsc(
void
);
51
#endif
52
__uint64
getTime
(
void
);
53
54
//_________________________________________________________________________________
55
/*
56
class bench
57
{
58
public:
59
static float usec2ticks(void);
60
static void init(const char* sigs[], unsigned short size = 3000);
61
static void start();
62
static void stop();
63
static bool running();
64
static void put(const std::string& sig, float val);
65
static void write(const std::string& toFile);
66
};
67
*/
68
69
//#define RUNBENCH
70
71
#ifdef RUNBENCH
72
#define timebench(name,f) \
73
{ \
74
__uint64 start = getTime(); \
75
f; \
76
__uint64 elapsed = getTime() - start; \
77
std::cout << name << "\t" << elapsed << std::endl; \
78
}
79
#else
80
#define timebench(name,f) f
81
#endif
82
83
#endif
getTime
bool getTime(const GuidoDate &date, const Time2GraphicMap map, TimeSegment &t, FloatRect &r)
Retrieves a time segment and the associated graphic segment in a mapping.
Guido Project
Copyright © 2019
Grame-CNCM