Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	README.md
	docs/README.md
	src/lib/util/corestr.h
  • Loading branch information...
2 parents 87751b4 + e159558 commit 9788df208f473b7b79ce997d5fd20194aa907e40 @Robbbert committed Mar 14, 2016
Showing 1,693 changed files with 110,288 additions and 99,445 deletions.
View
@@ -26,6 +26,7 @@
!/makefile
!/mame.doxygen
!/*.md
+!/LICENSE
/.idea
regtests/chdman/temp
regtests/jedutil/output
View
@@ -0,0 +1,55 @@
+# **3rdparty** #
+
+benchmark - [Apache License, Version 2.0](http://opensource.org/licenses/Apache-2.0) (used only for testing, not part of distribution)
+
+bgfx - [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause)
+
+bx - [The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause)
+
+compat - Wine headers missing in MinGW [The GNU Lesser General Public License, version 2.1 (LGPL-2.1)](http://opensource.org/licenses/LGPL-2.1)
+
+**note that this one contain headers only and that real library/dll is dynamically loaded so use in commercial project is allowed, will be removed when becomes part of MinGW distribution**
+
+dxsdk - [DirectX SDK EULA](https://github.com/mamedev/mame/blob/master/3rdparty/dxsdk/Documentation/License%20Agreements/DirectX%20SDK%20EULA.txt)
+
+expat - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+genie - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+
+googletest - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+
+http-parser - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+libflac - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+
+libjpeg - [Custom BSD-like](https://github.com/numenta/nupic/blob/master/external/licenses/LICENSE.libjpeg-6b.txt)
+
+libuv - [Node License (BSD-like)](https://github.com/mamedev/mame/blob/master/3rdparty/libuv/LICENSE)
+
+lsqlite3 - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+lua - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+lua-zlib - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+luabridge - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+luafilesystem - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+lzma - [The GNU Lesser General Public License](http://opensource.org/licenses/LGPL-2.1)
+
+portaudio - [The MIT License (MIT)](http://opensource.org/licenses/MIT) explanation at [their site](http://www.portaudio.com/license.html)
+
+portmidi - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
+
+rapidjson - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+
+sdl2 - [zlib license](http://opensource.org/licenses/Zlib)
+
+softfloat - [U.C. Berkeley open-source license](https://github.com/mamedev/mame/blob/master/3rdparty/softfloat/README.txt) MIT compatible
+
+sqlite3 - Public Domain
+
+winpcap - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
+
+zlib - [zlib license](http://opensource.org/licenses/Zlib)
@@ -1,6 +1,14 @@
cmake_minimum_required (VERSION 2.8.11)
project (benchmark)
+foreach(p
+ CMP0054 # CMake 3.1
+ )
+ if(POLICY ${p})
+ cmake_policy(SET ${p} NEW)
+ endif()
+endforeach()
+
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark library." OFF)
# Make sure we can import out CMake functions
@@ -23,73 +31,83 @@ include(CheckCXXCompilerFlag)
include(AddCXXCompilerFlag)
include(CXXFeatureCheck)
-# Try and enable C++11. Don't use C++14 because it doesn't work in some
-# configurations.
-add_cxx_compiler_flag(-std=c++11)
-if (NOT HAVE_CXX_FLAG_STD_CXX11)
- add_cxx_compiler_flag(-std=c++0x)
-endif()
-
-# Turn compiler warnings up to 11
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ # Turn compiler warnings up to 11
add_cxx_compiler_flag(-W4)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
+ # Link time optimisation
+ if (BENCHMARK_ENABLE_LTO)
+ set(CMAKE_CXX_FLAGS_RELEASE "/GL")
+ set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
+ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/LTCG")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG")
+ endif()
else()
+ # Try and enable C++11. Don't use C++14 because it doesn't work in some
+ # configurations.
+ add_cxx_compiler_flag(-std=c++11)
+ if (NOT HAVE_CXX_FLAG_STD_CXX11)
+ add_cxx_compiler_flag(-std=c++0x)
+ endif()
+
+ # Turn compiler warnings up to 11
add_cxx_compiler_flag(-Wall)
-endif()
-add_cxx_compiler_flag(-Wextra)
-add_cxx_compiler_flag(-Wshadow)
-add_cxx_compiler_flag(-Werror RELEASE)
-add_cxx_compiler_flag(-pedantic)
-add_cxx_compiler_flag(-pedantic-errors)
-add_cxx_compiler_flag(-Wshorten-64-to-32)
-add_cxx_compiler_flag(-Wfloat-equal)
-add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
-add_cxx_compiler_flag(-fstrict-aliasing)
-if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
- add_cxx_compiler_flag(-Wstrict-aliasing)
-endif()
-add_cxx_compiler_flag(-Wthread-safety)
-if (HAVE_WTHREAD_SAFETY)
- add_definitions(-DHAVE_WTHREAD_SAFETY)
- cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
-endif()
-# Link time optimisation
-if (BENCHMARK_ENABLE_LTO)
- add_cxx_compiler_flag(-flto)
- if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
- find_program(GCC_AR gcc-ar)
- if (GCC_AR)
- set(CMAKE_AR ${GCC_AR})
- endif()
- find_program(GCC_RANLIB gcc-ranlib)
- if (GCC_RANLIB)
- set(CMAKE_RANLIB ${GCC_RANLIB})
+ add_cxx_compiler_flag(-Wextra)
+ add_cxx_compiler_flag(-Wshadow)
+ add_cxx_compiler_flag(-Werror RELEASE)
+ add_cxx_compiler_flag(-pedantic)
+ add_cxx_compiler_flag(-pedantic-errors)
+ add_cxx_compiler_flag(-Wshorten-64-to-32)
+ add_cxx_compiler_flag(-Wfloat-equal)
+ add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
+ add_cxx_compiler_flag(-fstrict-aliasing)
+ if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
+ add_cxx_compiler_flag(-Wstrict-aliasing)
+ endif()
+ add_cxx_compiler_flag(-Wthread-safety)
+ if (HAVE_WTHREAD_SAFETY)
+ add_definitions(-DHAVE_WTHREAD_SAFETY)
+ cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
+ endif()
+
+ # Link time optimisation
+ if (BENCHMARK_ENABLE_LTO)
+ add_cxx_compiler_flag(-flto)
+ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+ find_program(GCC_AR gcc-ar)
+ if (GCC_AR)
+ set(CMAKE_AR ${GCC_AR})
+ endif()
+ find_program(GCC_RANLIB gcc-ranlib)
+ if (GCC_RANLIB)
+ set(CMAKE_RANLIB ${GCC_RANLIB})
+ endif()
endif()
endif()
-endif()
-# Coverage build type
-set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
- "Flags used by the C++ compiler during coverage builds."
- FORCE)
-set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
- "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
- "Flags used for linking binaries during coverage builds."
- FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
- "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
- "Flags used by the shared libraries linker during coverage builds."
- FORCE)
-mark_as_advanced(
- CMAKE_CXX_FLAGS_COVERAGE
- CMAKE_EXE_LINKER_FLAGS_COVERAGE
- CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
-set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
- "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
- FORCE)
-add_cxx_compiler_flag(--coverage COVERAGE)
+ # Coverage build type
+ set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
+ "Flags used by the C++ compiler during coverage builds."
+ FORCE)
+ set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
+ "Flags used for linking binaries during coverage builds."
+ FORCE)
+ set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
+ "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
+ "Flags used by the shared libraries linker during coverage builds."
+ FORCE)
+ mark_as_advanced(
+ CMAKE_CXX_FLAGS_COVERAGE
+ CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
+ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
+ FORCE)
+ add_cxx_compiler_flag(--coverage COVERAGE)
+endif()
# C++ feature checks
cxx_feature_check(STD_REGEX)
@@ -243,7 +243,7 @@ The `context` attribute contains information about the run in general, including
information about the CPU and the date.
The `benchmarks` attribute contains a list of ever benchmark run. Example json
output looks like:
-```
+``` json
{
"context": {
"date": "2015/03/17-18:40:25",
@@ -290,6 +290,20 @@ name,iterations,real_time,cpu_time,bytes_per_second,items_per_second,label
"BM_SetInsert/1024/10",106365,17238.4,8421.53,4.74973e+06,1.18743e+06,
```
+Debug vs Release
+----------------
+By default, benchmark builds as a debug library. You will see a warning in the output when this is the case. To build it as a release library instead, use:
+
+```
+cmake -DCMAKE_BUILD_TYPE=Release
+```
+
+To enable link-time optimisation, use
+
+```
+cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_LTO=true
+```
+
Linking against the library
---------------------------
When using gcc, it is necessary to link against pthread to avoid runtime exceptions. This is due to how gcc implements std::thread. See [issue #67](https://github.com/google/benchmark/issues/67) for more details.
@@ -12,9 +12,16 @@ platform:
environment:
matrix:
+ - compiler: msvc-12-seh
+ - compiler: msvc-14-seh
- compiler: gcc-4.9.2-posix
# - compiler: gcc-4.8.4-posix
-# - compiler: msvc-12-seh
+
+artifacts:
+ - path: '_build/CMakeFiles/*.log'
+ name: logs
+ - path: '_build/Testing/**/*.xml'
+ name: test_results
install:
# derive some extra information
@@ -35,18 +42,83 @@ before_build:
- if "%compiler_name%"=="gcc" (set "build=mingw32-make -j4")
- if "%compiler_name%"=="gcc" (set "test=mingw32-make CTEST_OUTPUT_ON_FAILURE=1 test")
# msvc specific commands
- # TODO :)
+ - if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x86" (set "generator=Visual Studio 12 2013")
+ - if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x64" (set "generator=Visual Studio 12 2013 Win64")
+ - if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x86" (set "generator=Visual Studio 14 2015")
+ - if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x64" (set "generator=Visual Studio 14 2015 Win64")
+ - if "%compiler_name%"=="msvc" (set "build=cmake --build . --config %variant%")
+ - if "%compiler_name%"=="msvc" (set "test=ctest -c Release -D CTEST_OUTPUT_ON_FAILURE:STRING=1")
# add the compiler path if needed
- if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%")
# git bash conflicts with MinGW makefiles
- - if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%")
+ - if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files\Git\usr\bin;=%")
build_script:
- - cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%variant%" "-DBUILD_SHARED_LIBS=%shared%"
- - cmd /c "%build%"
+- ps: |
+ md _build -Force
+ cd _build
+ & cmake -G "$env:generator" "-DCMAKE_BUILD_TYPE=$env:variant" "-DBUILD_SHARED_LIBS=$env:shared" ..
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
+ iex "& $env:build"
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
test_script:
- - cmd /c "%test%"
+- ps: |
+ iex "& $env:test"
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
+
+ function Add-CTest-Result($testResult)
+ {
+ $tests = ([xml](get-content $testResult)).Site.Testing
+ $testsCount = 0
+ $anyFailures = $FALSE
+
+ foreach ($test in $tests.test) {
+ $testsCount++
+ $testName = $test.Name
+ $testpath = $test.Path
+ $timeNode = $test.SelectSingleNode('Results/NamedMeasurement[@name="Execution Time"]/Value')
+ if ($test.status -eq "failure") {
+ $time = ([double]$timeNode.InnerText * 1000)
+ Add-AppveyorTest $testName -Outcome Failed -FileName $testpath -Duration $time -ErrorMessage $($test.results.measurement.value)
+ Add-AppveyorMessage `"$testName failed`" -Category Error
+ $anyFailures = $TRUE
+ }
+ elseif ($test.status -eq "skipped") {
+ Add-AppveyorTest $testName -Outcome Ignored -Filename $testpath
+ }
+ else {
+ $time = ([double]$timeNode.InnerText * 1000)
+ Add-AppveyorTest $testName -Outcome Passed -FileName $testpath -Duration $time -StdOut $($test.results.measurement.value)
+ }
+ }
+ return $testsCount, $anyFailures
+ }
+
+ $testsCount = 0
+ $anyFailures = $FALSE
+
+ # Run tests and upload results to AppVeyor one by one
+ Get-ChildItem ".\Testing\*.xml" -Recurse | foreach {
+ $testfile = $_.fullname
+ $count, $testsResult = Add-CTest-Result $testfile
+ Write-Host "Found $testfile with $count tests"
+ $testsCount = $testsCount + $count
+ $anyFailures = $anyFailures -or $testsResult
+ }
+
+ Write-Host "There are $testsCount tests found"
+
+ if ($anyFailures -eq $TRUE){
+ Write-Host "Failing build as there are broken tests"
+ $host.SetShouldExit(1)
+ }
matrix:
fast_finish: true
@@ -221,7 +221,7 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
// benchmark to use.
class State {
public:
- State(size_t max_iters, bool has_x, int x, bool has_y, int y, int thread_i);
+ State(size_t max_iters, bool has_x, int x, bool has_y, int y, int thread_i, int n_threads);
// Returns true iff the benchmark should continue through another iteration.
// NOTE: A benchmark may not return from the test until KeepRunning() has
@@ -358,7 +358,10 @@ class State {
size_t items_processed_;
public:
+ // Index of the executing thread. Values from [0, threads).
const int thread_index;
+ // Number of threads concurrently executing the benchmark.
+ const int threads;
const size_t max_iterations;
private:
@@ -486,13 +489,13 @@ class Fixture: public internal::Benchmark {
Fixture() : internal::Benchmark("") {}
virtual void Run(State& st) {
- this->SetUp();
+ this->SetUp(st);
this->BenchmarkCase(st);
- this->TearDown();
+ this->TearDown(st);
}
- virtual void SetUp() {}
- virtual void TearDown() {}
+ virtual void SetUp(const State&) {}
+ virtual void TearDown(const State&) {}
protected:
virtual void BenchmarkCase(State&) = 0;
Oops, something went wrong.

0 comments on commit 9788df2

Please sign in to comment.