0.9.8.10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
home
doug
src
hypertable
src
cc
Hypertable
Lib
bmz
test-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2007-2015 Hypertable, Inc.
3
*
4
* This file is part of Hypertable.
5
*
6
* Hypertable is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 3
9
* of the License, or any later version.
10
*
11
* Hypertable is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with Hypertable. If not, see <http://www.gnu.org/licenses/>
18
*/
19
20
#ifndef HT_SIMPLE_TEST_HELPER_H
21
#define HT_SIMPLE_TEST_HELPER_H
22
23
#include <sys/time.h>
24
25
#pragma GCC diagnostic ignored "-Wpedantic"
26
27
#define HT_MEASURE(_t_, _code_) do { \
28
double t0 = ht_time_d(); _code_; _t_ = ht_time_d() - t0; \
29
} while (0)
30
31
static
inline
double
32
ht_time_d
() {
33
struct
timeval tv;
34
if
(gettimeofday(&tv, NULL)) {
35
perror(__FUNCTION__);
36
}
37
return
(
double
)(tv.tv_sec) + (
double
)(tv.tv_usec) / 1e6;
38
}
39
40
#define HT_CHECK(e) \
41
((void)((e) ? 0 : HT_CHECK_FAIL(#e)))
42
43
#define HT_CHECK_FAIL(e) \
44
((void)printf("%s:%u: %s: bad assertion: `%s'\n", \
45
__FILE__, __LINE__, __FUNCTION__, e), abort(), 0)
46
47
#endif
/* HT_SIMPLE_TEST_HELPER_H */
ht_time_d
static double ht_time_d()
Definition:
test-helper.h:32
Generated on Tue Dec 22 2015 18:43:10 for Hypertable by
1.8.8