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
15bf6675
Commit
15bf6675
authored
Dec 20, 2013
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Really drop multithreading support
parent
06c1fdbd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
benchmark.h
include/benchmark/benchmark.h
+3
-4
benchmark.cc
src/benchmark.cc
+2
-2
benchmark_test.cc
test/benchmark_test.cc
+2
-2
No files found.
include/benchmark/benchmark.h
View file @
15bf6675
...
@@ -345,7 +345,7 @@ class Benchmark {
...
@@ -345,7 +345,7 @@ class Benchmark {
// of some piece of code.
// of some piece of code.
// Run one instance of this benchmark concurrently in t threads.
// Run one instance of this benchmark concurrently in t threads.
// TODO(dominic)
// TODO(dominic)
: Allow multithreaded benchmarks
//Benchmark* Threads(int t);
//Benchmark* Threads(int t);
// Pick a set of values T from [min_threads,max_threads].
// Pick a set of values T from [min_threads,max_threads].
...
@@ -360,13 +360,12 @@ class Benchmark {
...
@@ -360,13 +360,12 @@ class Benchmark {
// Foo in 4 threads
// Foo in 4 threads
// Foo in 8 threads
// Foo in 8 threads
// Foo in 16 threads
// Foo in 16 threads
Benchmark
*
ThreadRange
(
int
min_threads
,
int
max_threads
);
//
Benchmark* ThreadRange(int min_threads, int max_threads);
// Equivalent to ThreadRange(NumCPUs(), NumCPUs())
// Equivalent to ThreadRange(NumCPUs(), NumCPUs())
Benchmark
*
ThreadPerCpu
();
//
Benchmark* ThreadPerCpu();
// TODO(dominic): Control whether or not real-time is used for this benchmark
// TODO(dominic): Control whether or not real-time is used for this benchmark
// TODO(dominic): Control the default number of iterations
// -------------------------------
// -------------------------------
// Following methods are not useful for clients
// Following methods are not useful for clients
...
...
src/benchmark.cc
View file @
15bf6675
...
@@ -647,7 +647,7 @@ Benchmark* Benchmark::Apply(void (*custom_arguments)(Benchmark* benchmark)) {
...
@@ -647,7 +647,7 @@ Benchmark* Benchmark::Apply(void (*custom_arguments)(Benchmark* benchmark)) {
custom_arguments
(
this
);
custom_arguments
(
this
);
return
this
;
return
this
;
}
}
/*
Benchmark* Benchmark::Threads(int t) {
Benchmark* Benchmark::Threads(int t) {
CHECK_GT(t, 0);
CHECK_GT(t, 0);
mutex_lock l(&benchmark_mutex);
mutex_lock l(&benchmark_mutex);
...
@@ -669,7 +669,7 @@ Benchmark* Benchmark::ThreadPerCpu() {
...
@@ -669,7 +669,7 @@ Benchmark* Benchmark::ThreadPerCpu() {
thread_counts_.push_back(kNumCpuMarker);
thread_counts_.push_back(kNumCpuMarker);
return this;
return this;
}
}
*/
void
Benchmark
::
AddRange
(
std
::
vector
<
int
>*
dst
,
int
lo
,
int
hi
,
int
mult
)
{
void
Benchmark
::
AddRange
(
std
::
vector
<
int
>*
dst
,
int
lo
,
int
hi
,
int
mult
)
{
CHECK_GE
(
lo
,
0
);
CHECK_GE
(
lo
,
0
);
CHECK_GE
(
hi
,
lo
);
CHECK_GE
(
hi
,
lo
);
...
...
test/benchmark_test.cc
View file @
15bf6675
...
@@ -57,7 +57,7 @@ static void BM_CalculatePiRange(benchmark::State& state) {
...
@@ -57,7 +57,7 @@ static void BM_CalculatePiRange(benchmark::State& state) {
state
.
SetLabel
(
ss
.
str
());
state
.
SetLabel
(
ss
.
str
());
}
}
BENCHMARK_RANGE
(
BM_CalculatePiRange
,
1
,
1024
*
1024
);
BENCHMARK_RANGE
(
BM_CalculatePiRange
,
1
,
1024
*
1024
);
/*
static void BM_CalculatePi(benchmark::State& state) {
static void BM_CalculatePi(benchmark::State& state) {
static const int depth = 1024;
static const int depth = 1024;
double pi ATTRIBUTE_UNUSED = 0.0;
double pi ATTRIBUTE_UNUSED = 0.0;
...
@@ -68,7 +68,7 @@ static void BM_CalculatePi(benchmark::State& state) {
...
@@ -68,7 +68,7 @@ static void BM_CalculatePi(benchmark::State& state) {
BENCHMARK(BM_CalculatePi)->Threads(8);
BENCHMARK(BM_CalculatePi)->Threads(8);
BENCHMARK(BM_CalculatePi)->ThreadRange(1, 32);
BENCHMARK(BM_CalculatePi)->ThreadRange(1, 32);
BENCHMARK(BM_CalculatePi)->ThreadPerCpu();
BENCHMARK(BM_CalculatePi)->ThreadPerCpu();
*/
static
void
BM_SetInsert
(
benchmark
::
State
&
state
)
{
static
void
BM_SetInsert
(
benchmark
::
State
&
state
)
{
while
(
state
.
KeepRunning
())
{
while
(
state
.
KeepRunning
())
{
state
.
PauseTiming
();
state
.
PauseTiming
();
...
...
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