Skip to content

Commit

Permalink
doc: update doc
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Reyreaud <loic.reyreaud@epita.fr>
  • Loading branch information
Loic Reyreaud committed Nov 20, 2018
1 parent f249772 commit cde312e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,6 +3,7 @@ doxyxml
_build
build
env
cmake/uninstall.cmake

# Prerequisites
*.d
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Expand Up @@ -20,7 +20,6 @@ find_package(Threads REQUIRED)
find_program(ClangTidy NAMES "clang-tidy" DOC "Path to clang-tidy executable")

# Compilation settings (for tests mainly)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 -fsanitize=address")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
Expand Down
16 changes: 7 additions & 9 deletions bench/main.cpp
@@ -1,35 +1,33 @@
#include "benchmark/benchmark.h"
#include "threadpool.hpp"

#include <chrono>
#include <set>
#include <vector>

#include "benchmark/benchmark.h"
#include "threadpool.hpp"
#include "utils.hpp"

static void bm_work_tasks(benchmark::State& state)
{
while (state.KeepRunning())
{
ThreadPool::ThreadPool pool;
std::vector<std::future<int>> results;
std::vector<std::future<std::size_t>> results;
std::set<std::thread::id> threads_id;

auto i_end = state.range(0);
for (int i = 0; i < i_end; i++)
results.push_back(pool.run([&state, i]() {
/*std::string value =
bench::expensive(static_cast<std::size_t>(state.range(0)));
std::string value = bench::expensive(static_cast<std::size_t>(state.range(0)));
benchmark::DoNotOptimize(value.data());
benchmark::ClobberMemory();*/
return i * i;
benchmark::ClobberMemory();
return value.size();
}));
for (int i = 0; i < i_end; i++)
results[i].get();
}
}

BENCHMARK(bm_work_tasks)->Range(8, 8 << 18)->Unit(benchmark::kMillisecond);
BENCHMARK(bm_work_tasks)->Range(8, 8 << 10)->Unit(benchmark::kMillisecond);

static void bm_blocking_tasks(benchmark::State& state)
{
Expand Down
6 changes: 1 addition & 5 deletions bench/utils.cpp
Expand Up @@ -18,11 +18,7 @@ std::string expensive(std::size_t work_to_do)
std::string const& item = container[i];
if (item != std::to_string(i))
{
// Marked NOLINT to avoid clang-tidy cert-err60-cpp error which we cannot
// avoid on some linux distros where std::runtime_error is not properly
// marked noexcept. Details at
// https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible
throw std::runtime_error("Uh oh, this should never happen"); // NOLINT
throw std::runtime_error("Uh oh, this should never happen");
}
}

Expand Down
21 changes: 0 additions & 21 deletions cmake/uninstall.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion doc/src/performance.rst
@@ -1,7 +1,7 @@
Pool Performance
================

The pool performance can be measured using benchmarks, here are some benchmark values as of 3.0.0.
The pool performance can be measured using benchmarks.

Benchmark with neighbors work stealing enabled::

Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Expand Up @@ -10,7 +10,7 @@ add_executable(tests
threadpool_test.cpp
hooks_test.cpp
)

target_compile_options(tests PRIVATE -std=c++11)
target_link_libraries(tests PRIVATE
GTest::GTest
Threads::Threads
Expand Down

0 comments on commit cde312e

Please sign in to comment.