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
5a71bd6e
Commit
5a71bd6e
authored
Jan 09, 2014
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More formatting tweaks
parent
78fa0b93
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
57 deletions
+55
-57
benchmark.h
include/benchmark/benchmark.h
+10
-11
benchmark.cc
src/benchmark.cc
+10
-10
colorprint.cc
src/colorprint.cc
+3
-4
commandlineflags.cc
src/commandlineflags.cc
+3
-3
commandlineflags.h
src/commandlineflags.h
+0
-1
sleep.cc
src/sleep.cc
+3
-4
stat.h
src/stat.h
+21
-19
sysinfo.cc
src/sysinfo.cc
+2
-2
walltime.cc
src/walltime.cc
+3
-3
No files found.
include/benchmark/benchmark.h
View file @
5a71bd6e
...
@@ -165,7 +165,7 @@ void SetLabel(const std::string& label);
...
@@ -165,7 +165,7 @@ void SetLabel(const std::string& label);
// computed by running the benchmark once with a single iteration and a memory
// computed by running the benchmark once with a single iteration and a memory
// tracer.)
// tracer.)
// TODO(dominic)
// TODO(dominic)
//void MemoryUsage();
//
void MemoryUsage();
// If a particular benchmark is I/O bound, or if for some reason CPU
// If a particular benchmark is I/O bound, or if for some reason CPU
// timings are not representative, call this method from within the
// timings are not representative, call this method from within the
...
@@ -303,7 +303,7 @@ class BenchmarkReporter {
...
@@ -303,7 +303,7 @@ class BenchmarkReporter {
struct
Context
{
struct
Context
{
int
num_cpus
;
int
num_cpus
;
double
mhz_per_cpu
;
double
mhz_per_cpu
;
//std::string cpu_info;
//
std::string cpu_info;
bool
cpu_scaling_enabled
;
bool
cpu_scaling_enabled
;
// The number of chars in the longest benchmark name.
// The number of chars in the longest benchmark name.
...
@@ -311,14 +311,14 @@ class BenchmarkReporter {
...
@@ -311,14 +311,14 @@ class BenchmarkReporter {
};
};
struct
Run
{
struct
Run
{
Run
()
:
Run
()
thread_index
(
-
1
),
:
thread_index
(
-
1
),
iterations
(
1
),
iterations
(
1
),
real_accumulated_time
(
0
),
real_accumulated_time
(
0
),
cpu_accumulated_time
(
0
),
cpu_accumulated_time
(
0
),
bytes_per_second
(
0
),
bytes_per_second
(
0
),
items_per_second
(
0
),
items_per_second
(
0
),
max_heapbytes_used
(
0
)
{}
max_heapbytes_used
(
0
)
{}
std
::
string
benchmark_name
;
std
::
string
benchmark_name
;
std
::
string
report_label
;
std
::
string
report_label
;
...
@@ -535,4 +535,3 @@ class ConsoleReporter : public BenchmarkReporter {
...
@@ -535,4 +535,3 @@ class ConsoleReporter : public BenchmarkReporter {
(new ::benchmark::internal::Benchmark(#n "<" #a "," #b ">", n<a, b>))
(new ::benchmark::internal::Benchmark(#n "<" #a "," #b ">", n<a, b>))
#endif // BENCHMARK_BENCHMARK_H_
#endif // BENCHMARK_BENCHMARK_H_
src/benchmark.cc
View file @
5a71bd6e
...
@@ -298,16 +298,15 @@ void ComputeStats(const std::vector<BenchmarkReporter::Run>& reports,
...
@@ -298,16 +298,15 @@ void ComputeStats(const std::vector<BenchmarkReporter::Run>& reports,
namespace
internal
{
namespace
internal
{
std
::
string
ConsoleReporter
::
PrintMemoryUsage
(
double
bytes
)
const
{
std
::
string
ConsoleReporter
::
PrintMemoryUsage
(
double
bytes
)
const
{
if
(
!
get_memory_usage
||
bytes
<
0.0
)
if
(
!
get_memory_usage
||
bytes
<
0.0
)
return
""
;
return
""
;
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
" "
<<
HumanReadableNumber
(
bytes
)
<<
"B peak-mem"
;
ss
<<
" "
<<
HumanReadableNumber
(
bytes
)
<<
"B peak-mem"
;
return
ss
.
str
();
return
ss
.
str
();
}
}
bool
ConsoleReporter
::
ReportContext
(
bool
ConsoleReporter
::
ReportContext
(
const
BenchmarkReporter
::
Context
&
context
)
const
BenchmarkReporter
::
Context
&
context
)
const
{
const
{
name_field_width_
=
context
.
name_field_width
;
name_field_width_
=
context
.
name_field_width
;
std
::
cout
<<
"Benchmarking on "
<<
context
.
num_cpus
<<
" X "
std
::
cout
<<
"Benchmarking on "
<<
context
.
num_cpus
<<
" X "
...
@@ -404,7 +403,7 @@ void PrintUsageAndExit() {
...
@@ -404,7 +403,7 @@ void PrintUsageAndExit() {
"benchmark [--benchmark_filter=<regex>]
\n
"
"benchmark [--benchmark_filter=<regex>]
\n
"
" [--benchmark_iterations=<iterations>]
\n
"
" [--benchmark_iterations=<iterations>]
\n
"
" [--benchmark_min_time=<min_time>]
\n
"
" [--benchmark_min_time=<min_time>]
\n
"
//" [--benchmark_memory_usage]\n"
//" [--benchmark_memory_usage]\n"
" [--benchmark_repetitions=<num_repetitions>]
\n
"
" [--benchmark_repetitions=<num_repetitions>]
\n
"
" [--color_print={true|false}]
\n
"
" [--color_print={true|false}]
\n
"
" [--v=<verbosity>]
\n
"
);
" [--v=<verbosity>]
\n
"
);
...
@@ -757,15 +756,15 @@ void Benchmark::FindBenchmarks(const std::string& spec,
...
@@ -757,15 +756,15 @@ void Benchmark::FindBenchmarks(const std::string& spec,
}
else
if
(
family
->
rangeY_
.
empty
())
{
}
else
if
(
family
->
rangeY_
.
empty
())
{
for
(
size_t
x
=
0
;
x
<
family
->
rangeX_
.
size
();
++
x
)
{
for
(
size_t
x
=
0
;
x
<
family
->
rangeX_
.
size
();
++
x
)
{
instances
=
family
->
CreateBenchmarkInstances
(
x
,
kNoRange
);
instances
=
family
->
CreateBenchmarkInstances
(
x
,
kNoRange
);
benchmarks
->
insert
(
benchmarks
->
end
(),
benchmarks
->
insert
(
benchmarks
->
end
(),
instances
.
begin
(),
instances
.
begin
(),
instances
.
end
());
instances
.
end
());
}
}
}
else
{
}
else
{
for
(
size_t
x
=
0
;
x
<
family
->
rangeX_
.
size
();
++
x
)
{
for
(
size_t
x
=
0
;
x
<
family
->
rangeX_
.
size
();
++
x
)
{
for
(
size_t
y
=
0
;
y
<
family
->
rangeY_
.
size
();
++
y
)
{
for
(
size_t
y
=
0
;
y
<
family
->
rangeY_
.
size
();
++
y
)
{
instances
=
family
->
CreateBenchmarkInstances
(
x
,
y
);
instances
=
family
->
CreateBenchmarkInstances
(
x
,
y
);
benchmarks
->
insert
(
benchmarks
->
end
(),
benchmarks
->
insert
(
benchmarks
->
end
(),
instances
.
begin
(),
instances
.
begin
(),
instances
.
end
());
instances
.
end
());
}
}
}
}
}
}
...
@@ -1167,7 +1166,8 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter /*= nullptr*/) {
...
@@ -1167,7 +1166,8 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter /*= nullptr*/) {
if
(
spec
.
empty
()
||
spec
==
"all"
)
if
(
spec
.
empty
()
||
spec
==
"all"
)
spec
=
"."
;
// Regexp that matches all benchmarks
spec
=
"."
;
// Regexp that matches all benchmarks
internal
::
ConsoleReporter
default_reporter
;
internal
::
ConsoleReporter
default_reporter
;
internal
::
RunMatchingBenchmarks
(
spec
,
reporter
==
nullptr
?
&
default_reporter
:
reporter
);
internal
::
RunMatchingBenchmarks
(
spec
,
reporter
==
nullptr
?
&
default_reporter
:
reporter
);
pthread_cond_destroy
(
&
starting_cv
);
pthread_cond_destroy
(
&
starting_cv
);
pthread_mutex_destroy
(
&
starting_mutex
);
pthread_mutex_destroy
(
&
starting_mutex
);
pthread_mutex_destroy
(
&
benchmark_mutex
);
pthread_mutex_destroy
(
&
benchmark_mutex
);
...
...
src/colorprint.cc
View file @
5a71bd6e
// Copyright 2014 Google Inc. All rights reserved.
// Copyright 2014 Google Inc. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -108,4 +108,3 @@ void ColorPrintf(LogColor color, const char* fmt, ...) {
...
@@ -108,4 +108,3 @@ void ColorPrintf(LogColor color, const char* fmt, ...) {
va_end
(
args
);
va_end
(
args
);
}
}
}
// end namespace benchmark
}
// end namespace benchmark
src/commandlineflags.cc
View file @
5a71bd6e
// Copyright 2014 Google Inc. All rights reserved.
// Copyright 2014 Google Inc. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
src/commandlineflags.h
View file @
5a71bd6e
...
@@ -75,4 +75,3 @@ bool IsFlag(const char* str, const char* flag);
...
@@ -75,4 +75,3 @@ bool IsFlag(const char* str, const char* flag);
}
// end namespace gbenchmark
}
// end namespace gbenchmark
#endif // BENCHMARK_COMMANDLINEFLAGS_H_
#endif // BENCHMARK_COMMANDLINEFLAGS_H_
src/sleep.cc
View file @
5a71bd6e
// Copyright 2014 Google Inc. All rights reserved.
// Copyright 2014 Google Inc. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -42,4 +42,3 @@ void SleepForSeconds(double seconds) {
...
@@ -42,4 +42,3 @@ void SleepForSeconds(double seconds) {
}
}
#endif // OS_WINDOWS
#endif // OS_WINDOWS
}
// end namespace benchmark
}
// end namespace benchmark
src/stat.h
View file @
5a71bd6e
...
@@ -62,28 +62,28 @@ class Stat1 {
...
@@ -62,28 +62,28 @@ class Stat1 {
sum_squares_
=
sum_
=
VType
();
sum_squares_
=
sum_
=
VType
();
}
}
Self
&
operator
=
(
const
Self
&
stat
)
{
Self
&
operator
=
(
const
Self
&
stat
)
{
sum_
=
stat
.
sum_
;
sum_
=
stat
.
sum_
;
sum_squares_
=
stat
.
sum_squares_
;
sum_squares_
=
stat
.
sum_squares_
;
numsamples_
=
stat
.
numsamples_
;
numsamples_
=
stat
.
numsamples_
;
return
(
*
this
);
return
(
*
this
);
}
}
// Merge statistics from two sample sets.
// Merge statistics from two sample sets.
Self
&
operator
+=
(
const
Self
&
stat
)
{
Self
&
operator
+=
(
const
Self
&
stat
)
{
sum_
+=
stat
.
sum_
;
sum_
+=
stat
.
sum_
;
sum_squares_
+=
stat
.
sum_squares_
;
sum_squares_
+=
stat
.
sum_squares_
;
numsamples_
+=
stat
.
numsamples_
;
numsamples_
+=
stat
.
numsamples_
;
return
(
*
this
);
return
(
*
this
);
}
}
// The operation opposite to +=
// The operation opposite to +=
Self
&
operator
-=
(
const
Self
&
stat
)
{
Self
&
operator
-=
(
const
Self
&
stat
)
{
sum_
-=
stat
.
sum_
;
sum_
-=
stat
.
sum_
;
sum_squares_
-=
stat
.
sum_squares_
;
sum_squares_
-=
stat
.
sum_squares_
;
numsamples_
-=
stat
.
numsamples_
;
numsamples_
-=
stat
.
numsamples_
;
return
(
*
this
);
return
(
*
this
);
}
}
// Multiply the weight of the set of samples by a factor k
// Multiply the weight of the set of samples by a factor k
Self
&
operator
*=
(
const
VType
&
k
)
{
Self
&
operator
*=
(
const
VType
&
k
)
{
sum_
*=
k
;
sum_
*=
k
;
sum_squares_
*=
k
;
sum_squares_
*=
k
;
numsamples_
*=
k
;
numsamples_
*=
k
;
...
@@ -91,13 +91,13 @@ class Stat1 {
...
@@ -91,13 +91,13 @@ class Stat1 {
}
}
// Merge statistics from two sample sets.
// Merge statistics from two sample sets.
Self
operator
+
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
+=
stat
;
}
Self
operator
+
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
+=
stat
;
}
// The operation opposite to +
// The operation opposite to +
Self
operator
-
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
-=
stat
;
}
Self
operator
-
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
-=
stat
;
}
// Multiply the weight of the set of samples by a factor k
// Multiply the weight of the set of samples by a factor k
Self
operator
*
(
const
VType
&
k
)
const
{
return
Self
(
*
this
)
*=
k
;
}
Self
operator
*
(
const
VType
&
k
)
const
{
return
Self
(
*
this
)
*=
k
;
}
// Return the total weight of this sample set
// Return the total weight of this sample set
NumType
numSamples
()
const
{
return
numsamples_
;
}
NumType
numSamples
()
const
{
return
numsamples_
;
}
...
@@ -142,7 +142,9 @@ class Stat1 {
...
@@ -142,7 +142,9 @@ class Stat1 {
// Template function used to square a number.
// Template function used to square a number.
// For a vector we square all components
// For a vector we square all components
template
<
typename
SType
>
template
<
typename
SType
>
static
inline
SType
Sqr
(
const
SType
&
dat
)
{
return
dat
*
dat
;
}
static
inline
SType
Sqr
(
const
SType
&
dat
)
{
return
dat
*
dat
;
}
template
<
typename
SType
>
template
<
typename
SType
>
static
inline
Vector2
<
SType
>
Sqr
(
const
Vector2
<
SType
>
&
dat
)
{
static
inline
Vector2
<
SType
>
Sqr
(
const
Vector2
<
SType
>
&
dat
)
{
...
@@ -189,7 +191,7 @@ class Stat1 {
...
@@ -189,7 +191,7 @@ class Stat1 {
// Useful printing function
// Useful printing function
template
<
typename
VType
,
typename
NumType
>
template
<
typename
VType
,
typename
NumType
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Stat1
<
VType
,
NumType
>&
s
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Stat1
<
VType
,
NumType
>
&
s
)
{
out
<<
"{ avg = "
<<
s
.
Mean
()
<<
" std = "
<<
s
.
StdDev
()
out
<<
"{ avg = "
<<
s
.
Mean
()
<<
" std = "
<<
s
.
StdDev
()
<<
" nsamples = "
<<
s
.
NumSamples
()
<<
"}"
;
<<
" nsamples = "
<<
s
.
NumSamples
()
<<
"}"
;
return
out
;
return
out
;
...
@@ -214,7 +216,7 @@ class Stat1MinMax : public Stat1<VType, NumType> {
...
@@ -214,7 +216,7 @@ class Stat1MinMax : public Stat1<VType, NumType> {
// and end(excluded)
// and end(excluded)
explicit
Stat1MinMax
(
const
VType
*
begin
,
const
VType
*
end
)
{
explicit
Stat1MinMax
(
const
VType
*
begin
,
const
VType
*
end
)
{
Clear
();
Clear
();
for
(
const
VType
*
item
=
begin
;
item
<
end
;
++
item
)
{
for
(
const
VType
*
item
=
begin
;
item
<
end
;
++
item
)
{
(
*
this
)
+=
Stat1MinMax
(
*
item
);
(
*
this
)
+=
Stat1MinMax
(
*
item
);
}
}
}
}
...
@@ -241,28 +243,28 @@ class Stat1MinMax : public Stat1<VType, NumType> {
...
@@ -241,28 +243,28 @@ class Stat1MinMax : public Stat1<VType, NumType> {
}
}
}
}
Self
&
operator
=
(
const
Self
&
stat
)
{
Self
&
operator
=
(
const
Self
&
stat
)
{
this
->
Stat1
<
VType
,
NumType
>::
operator
=
(
stat
);
this
->
Stat1
<
VType
,
NumType
>::
operator
=
(
stat
);
max_
=
stat
.
max_
;
max_
=
stat
.
max_
;
min_
=
stat
.
min_
;
min_
=
stat
.
min_
;
return
(
*
this
);
return
(
*
this
);
}
}
// Merge statistics from two sample sets.
// Merge statistics from two sample sets.
Self
&
operator
+=
(
const
Self
&
stat
)
{
Self
&
operator
+=
(
const
Self
&
stat
)
{
this
->
Stat1
<
VType
,
NumType
>::
operator
+=
(
stat
);
this
->
Stat1
<
VType
,
NumType
>::
operator
+=
(
stat
);
if
(
stat
.
max_
>
max_
)
max_
=
stat
.
max_
;
if
(
stat
.
max_
>
max_
)
max_
=
stat
.
max_
;
if
(
stat
.
min_
<
min_
)
min_
=
stat
.
min_
;
if
(
stat
.
min_
<
min_
)
min_
=
stat
.
min_
;
return
(
*
this
);
return
(
*
this
);
}
}
// Multiply the weight of the set of samples by a factor k
// Multiply the weight of the set of samples by a factor k
Self
&
operator
*=
(
const
VType
&
stat
)
{
Self
&
operator
*=
(
const
VType
&
stat
)
{
this
->
Stat1
<
VType
,
NumType
>::
operator
*=
(
stat
);
this
->
Stat1
<
VType
,
NumType
>::
operator
*=
(
stat
);
return
(
*
this
);
return
(
*
this
);
}
}
// Merge statistics from two sample sets.
// Merge statistics from two sample sets.
Self
operator
+
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
+=
stat
;
}
Self
operator
+
(
const
Self
&
stat
)
const
{
return
Self
(
*
this
)
+=
stat
;
}
// Multiply the weight of the set of samples by a factor k
// Multiply the weight of the set of samples by a factor k
Self
operator
*
(
const
VType
&
k
)
const
{
return
Self
(
*
this
)
*=
k
;
}
Self
operator
*
(
const
VType
&
k
)
const
{
return
Self
(
*
this
)
*=
k
;
}
// Return the maximal value in this sample set
// Return the maximal value in this sample set
VType
max
()
const
{
return
max_
;
}
VType
max
()
const
{
return
max_
;
}
...
@@ -273,10 +275,10 @@ class Stat1MinMax : public Stat1<VType, NumType> {
...
@@ -273,10 +275,10 @@ class Stat1MinMax : public Stat1<VType, NumType> {
// The - operation makes no sense with Min/Max
// The - operation makes no sense with Min/Max
// unless we keep the full list of values (but we don't)
// unless we keep the full list of values (but we don't)
// make it private, and let it undefined so nobody can call it
// make it private, and let it undefined so nobody can call it
Self
&
operator
-=
(
const
Self
&
stat
);
// senseless. let it undefined.
Self
&
operator
-=
(
const
Self
&
stat
);
// senseless. let it undefined.
// The operation opposite to -
// The operation opposite to -
Self
operator
-
(
const
Self
&
stat
)
const
;
// senseless. let it undefined.
Self
operator
-
(
const
Self
&
stat
)
const
;
// senseless. let it undefined.
// Let i be the index of the samples provided (using +=)
// Let i be the index of the samples provided (using +=)
// and weight[i],value[i] be the data of sample #i
// and weight[i],value[i] be the data of sample #i
...
@@ -287,8 +289,8 @@ class Stat1MinMax : public Stat1<VType, NumType> {
...
@@ -287,8 +289,8 @@ class Stat1MinMax : public Stat1<VType, NumType> {
// Useful printing function
// Useful printing function
template
<
typename
VType
,
typename
NumType
>
template
<
typename
VType
,
typename
NumType
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Stat1MinMax
<
VType
,
NumType
>
&
s
)
{
const
Stat1MinMax
<
VType
,
NumType
>
&
s
)
{
out
<<
"{ avg = "
<<
s
.
Mean
()
<<
" std = "
<<
s
.
StdDev
()
out
<<
"{ avg = "
<<
s
.
Mean
()
<<
" std = "
<<
s
.
StdDev
()
<<
" nsamples = "
<<
s
.
NumSamples
()
<<
" min = "
<<
s
.
Min
()
<<
" nsamples = "
<<
s
.
NumSamples
()
<<
" min = "
<<
s
.
Min
()
<<
" max = "
<<
s
.
Max
()
<<
"}"
;
<<
" max = "
<<
s
.
Max
()
<<
"}"
;
...
...
src/sysinfo.cc
View file @
5a71bd6e
...
@@ -208,7 +208,7 @@ void InitializeSystemInfo() {
...
@@ -208,7 +208,7 @@ void InitializeSystemInfo() {
unsigned
int
hz
=
0
;
unsigned
int
hz
=
0
;
#endif
#endif
size_t
sz
=
sizeof
(
hz
);
size_t
sz
=
sizeof
(
hz
);
const
char
*
sysctl_path
=
"machdep.tsc_freq"
;
const
char
*
sysctl_path
=
"machdep.tsc_freq"
;
if
(
sysctlbyname
(
sysctl_path
,
&
hz
,
&
sz
,
NULL
,
0
)
!=
0
)
{
if
(
sysctlbyname
(
sysctl_path
,
&
hz
,
&
sz
,
NULL
,
0
)
!=
0
)
{
fprintf
(
stderr
,
"Unable to determine clock rate from sysctl: %s: %s
\n
"
,
fprintf
(
stderr
,
"Unable to determine clock rate from sysctl: %s: %s
\n
"
,
sysctl_path
,
strerror
(
errno
));
sysctl_path
,
strerror
(
errno
));
...
@@ -233,7 +233,7 @@ void InitializeSystemInfo() {
...
@@ -233,7 +233,7 @@ void InitializeSystemInfo() {
cpuinfo_cycles_per_second
=
(
int64
)
data
*
(
int64
)(
1000
*
1000
);
// was mhz
cpuinfo_cycles_per_second
=
(
int64
)
data
*
(
int64
)(
1000
*
1000
);
// was mhz
else
else
cpuinfo_cycles_per_second
=
EstimateCyclesPerSecond
();
cpuinfo_cycles_per_second
=
EstimateCyclesPerSecond
();
// TODO: also figure out cpuinfo_num_cpus
// TODO: also figure out cpuinfo_num_cpus
#elif defined OS_MACOSX
#elif defined OS_MACOSX
// returning "mach time units" per second. the current number of elapsed
// returning "mach time units" per second. the current number of elapsed
...
...
src/walltime.cc
View file @
5a71bd6e
// Copyright 2014 Google Inc. All rights reserved.
// Copyright 2014 Google Inc. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
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