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
64ba2729
Commit
64ba2729
authored
Mar 12, 2015
by
Eric Fiselier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable zero as NULL warnings and fix all occurences
parent
19464f7d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
6 deletions
+22
-6
CMakeLists.txt
CMakeLists.txt
+1
-2
benchmark.h
include/benchmark/benchmark.h
+16
-2
benchmark.cc
src/benchmark.cc
+3
-0
sysinfo.cc
src/sysinfo.cc
+1
-1
walltime.cc
src/walltime.cc
+1
-1
No files found.
CMakeLists.txt
View file @
64ba2729
...
...
@@ -38,8 +38,7 @@ add_cxx_compiler_flag(-Wextra)
add_cxx_compiler_flag
(
-Wshadow
)
add_cxx_compiler_flag
(
-Werror
)
add_cxx_compiler_flag
(
-pedantic-errors
)
# TODO(ericwf): enable this for g++
#add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
add_cxx_compiler_flag
(
-Wzero-as-null-pointer-constant
)
# Release flags
add_cxx_compiler_flag
(
-fno-strict-aliasing RELEASE
)
...
...
include/benchmark/benchmark.h
View file @
64ba2729
...
...
@@ -152,7 +152,8 @@ void Initialize(int* argc, const char** argv);
// Otherwise, run all benchmarks specified by the --benchmark_filter flag,
// and exit after running the benchmarks.
void
RunSpecifiedBenchmarks
(
const
BenchmarkReporter
*
reporter
=
NULL
);
void
RunSpecifiedBenchmarks
();
void
RunSpecifiedBenchmarks
(
const
BenchmarkReporter
*
reporter
);
// If this routine is called, peak memory allocation past this point in the
// benchmark is reported at the end of the benchmark report line. (It is
...
...
@@ -164,6 +165,19 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter = NULL);
namespace
internal
{
class
Benchmark
;
class
BenchmarkFamilies
;
template
<
class
T
>
struct
Voider
{
typedef
void
type
;
};
template
<
class
T
,
class
=
void
>
struct
EnableIfString
{};
template
<
class
T
>
struct
EnableIfString
<
T
,
typename
Voider
<
typename
T
::
basic_string
>::
type
>
{
typedef
int
type
;
};
}
// State is passed to a running Benchmark and contains state for the
...
...
@@ -279,7 +293,7 @@ public:
// as an injected class name in the case of std::string.
template
<
class
StringType
>
void
SetLabel
(
StringType
const
&
str
,
typename
StringType
::
basic_string
*
=
0
)
{
typename
internal
::
EnableIfString
<
StringType
>::
type
=
1
)
{
this
->
SetLabel
(
str
.
c_str
());
}
...
...
src/benchmark.cc
View file @
64ba2729
...
...
@@ -898,6 +898,9 @@ void RunMatchingBenchmarks(const std::string& spec,
}
// end namespace internal
void
RunSpecifiedBenchmarks
()
{
RunSpecifiedBenchmarks
(
nullptr
);
}
void
RunSpecifiedBenchmarks
(
const
BenchmarkReporter
*
reporter
)
{
std
::
string
spec
=
FLAGS_benchmark_filter
;
...
...
src/sysinfo.cc
View file @
64ba2729
...
...
@@ -303,7 +303,7 @@ static bool MyCPUUsageCPUTimeNsLocked(double* cputime) {
cputime_fd
=
-
1
;
return
false
;
}
unsigned
long
long
result
=
strtoull
(
buff
,
NULL
,
0
);
unsigned
long
long
result
=
strtoull
(
buff
,
nullptr
,
0
);
if
(
result
==
(
std
::
numeric_limits
<
unsigned
long
long
>::
max
)())
{
close
(
cputime_fd
);
cputime_fd
=
-
1
;
...
...
src/walltime.cc
View file @
64ba2729
...
...
@@ -89,7 +89,7 @@ private:
WallTime
Slow
()
const
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
tv
,
nullptr
);
return
tv
.
tv_sec
+
tv
.
tv_usec
*
1e-6
;
}
...
...
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