Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
66f0b5d0
Commit
66f0b5d0
authored
Nov 13, 2014
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from google/62.CHECK
Remove CHECK_* from public API.
parents
4932b72b
a3b5e44c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
20 deletions
+26
-20
macros.h
include/benchmark/macros.h
+0
-11
benchmark.cc
src/benchmark.cc
+1
-1
check.h
src/check.h
+17
-0
re_posix.cc
src/re_posix.cc
+1
-1
sysinfo.cc
src/sysinfo.cc
+1
-1
walltime.cc
src/walltime.cc
+1
-1
CMakeLists.txt
test/CMakeLists.txt
+0
-1
benchmark_test.cc
test/benchmark_test.cc
+5
-4
No files found.
include/benchmark/macros.h
View file @
66f0b5d0
...
...
@@ -35,17 +35,6 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
#define CHECK(b) \
do { \
if (!(b)) assert(false); \
} while (0)
#define CHECK_EQ(a, b) CHECK((a) == (b))
#define CHECK_NE(a, b) CHECK((a) != (b))
#define CHECK_GE(a, b) CHECK((a) >= (b))
#define CHECK_LE(a, b) CHECK((a) <= (b))
#define CHECK_GT(a, b) CHECK((a) > (b))
#define CHECK_LT(a, b) CHECK((a) < (b))
//
// Prevent the compiler from complaining about or optimizing away variables
// that appear unused.
...
...
src/benchmark.cc
View file @
66f0b5d0
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "benchmark/benchmark.h"
#include "
benchmark/macros
.h"
#include "
check
.h"
#include "colorprint.h"
#include "commandlineflags.h"
#include "re.h"
...
...
src/check.h
0 → 100644
View file @
66f0b5d0
#ifndef CHECK_H_
#define CHECK_H_
#include <cassert>
#define CHECK(b) \
do { \
if (!(b)) assert(false); \
} while (0)
#define CHECK_EQ(a, b) CHECK((a) == (b))
#define CHECK_NE(a, b) CHECK((a) != (b))
#define CHECK_GE(a, b) CHECK((a) >= (b))
#define CHECK_LE(a, b) CHECK((a) <= (b))
#define CHECK_GT(a, b) CHECK((a) > (b))
#define CHECK_LT(a, b) CHECK((a) < (b))
#endif // CHECK_H_
src/re_posix.cc
View file @
66f0b5d0
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include
<benchmark/macros.h>
#include
"check.h"
#include "re.h"
namespace
benchmark
{
...
...
src/sysinfo.cc
View file @
66f0b5d0
...
...
@@ -29,7 +29,7 @@
#include <limits>
#include <mutex>
#include "
benchmark/macros
.h"
#include "
check
.h"
#include "cycleclock.h"
#include "sleep.h"
...
...
src/walltime.cc
View file @
66f0b5d0
...
...
@@ -22,7 +22,7 @@
#include <atomic>
#include <limits>
#include "
benchmark/macros
.h"
#include "
check
.h"
#include "cycleclock.h"
#include "sysinfo.h"
...
...
test/CMakeLists.txt
View file @
66f0b5d0
...
...
@@ -3,7 +3,6 @@ find_package(Threads REQUIRED)
# Demonstration executable
add_executable
(
benchmark_test benchmark_test.cc
)
target_link_libraries
(
benchmark_test benchmark
${
CMAKE_THREAD_LIBS_INIT
}
)
add_dependencies
(
benchmark_test googletest
)
add_test
(
benchmark benchmark_test 50
)
add_test
(
benchmark_filter_simple benchmark_test --benchmark_filter=Calculate 16
)
add_test
(
benchmark_filter_prefix benchmark_test --benchmark_filter=*Calculate 0
)
...
...
test/benchmark_test.cc
View file @
66f0b5d0
#include "benchmark/benchmark.h"
#include <assert.h>
#include <math.h>
#include <stdint.h>
...
...
@@ -109,7 +110,7 @@ static void BM_StringCompare(benchmark::State& state) {
while
(
state
.
KeepRunning
())
r
|=
s1
.
compare
(
s2
);
// Prevent compiler optimizations
CHECK
(
r
!=
std
::
numeric_limits
<
int
>::
max
());
assert
(
r
!=
std
::
numeric_limits
<
int
>::
max
());
}
BENCHMARK
(
BM_StringCompare
)
->
Range
(
1
,
1
<<
20
);
...
...
@@ -138,7 +139,7 @@ static void BM_LongTest(benchmark::State& state) {
while
(
state
.
KeepRunning
())
for
(
int
i
=
0
;
i
<
state
.
range_x
();
++
i
)
tracker
+=
i
;
CHECK
(
tracker
!=
0.0
);
assert
(
tracker
!=
0.0
);
}
BENCHMARK
(
BM_LongTest
)
->
Range
(
1
<<
16
,
1
<<
28
);
...
...
@@ -168,8 +169,8 @@ class TestReporter : public benchmark::internal::ConsoleReporter {
int
main
(
int
argc
,
const
char
*
argv
[])
{
benchmark
::
Initialize
(
&
argc
,
argv
);
CHECK
(
Factorial
(
8
)
==
40320
);
CHECK
(
CalculatePi
(
1
)
==
0.0
);
assert
(
Factorial
(
8
)
==
40320
);
assert
(
CalculatePi
(
1
)
==
0.0
);
TestReporter
test_reporter
;
benchmark
::
RunSpecifiedBenchmarks
(
&
test_reporter
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment