Skip to content

Update Benchmark #83488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions third-party/benchmark/.ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

import ycm_core

# These are the compilation flags that will be used in case there's no
Expand Down Expand Up @@ -91,7 +92,9 @@ def GetCompilationInfoForFile(filename):
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists(replacement_file):
compilation_info = database.GetCompilationInfoForFile(replacement_file)
compilation_info = database.GetCompilationInfoForFile(
replacement_file
)
if compilation_info.compiler_flags_:
return compilation_info
return None
Expand All @@ -107,7 +110,8 @@ def FlagsForFile(filename, **kwargs):
return None

final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_, compilation_info.compiler_working_dir_
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_,
)
else:
relative_to = DirectoryOfThisScript()
Expand Down
12 changes: 11 additions & 1 deletion third-party/benchmark/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Alex Steele <[email protected]>
Andriy Berestovskyy <[email protected]>
Arne Beer <[email protected]>
Carto
Cezary Skrzyński <[email protected]>
Christian Wassermann <[email protected]>
Christopher Seymour <[email protected]>
Colin Braley <[email protected]>
Expand All @@ -27,10 +28,13 @@ Eric Backus <[email protected]>
Eric Fiselier <[email protected]>
Eugene Zhuk <[email protected]>
Evgeny Safronov <[email protected]>
Fabien Pichot <[email protected]>
Federico Ficarelli <[email protected]>
Felix Homann <[email protected]>
Gergely Meszaros <[email protected]>
Gergő Szitár <[email protected]>
Google Inc.
Henrique Bucher <[email protected]>
International Business Machines Corporation
Ismael Jimenez Martinez <[email protected]>
Jern-Kuan Leong <[email protected]>
Expand All @@ -41,22 +45,28 @@ Jussi Knuuttila <[email protected]>
Kaito Udagawa <[email protected]>
Kishan Kumar <[email protected]>
Lei Xu <[email protected]>
Marcel Jacobse <[email protected]>
Matt Clarkson <[email protected]>
Maxim Vafin <[email protected]>
Mike Apodaca <[email protected]>
Min-Yih Hsu <[email protected]>
MongoDB Inc.
Nick Hutchinson <[email protected]>
Norman Heino <[email protected]>
Oleksandr Sochka <[email protected]>
Ori Livneh <[email protected]>
Paul Redmond <[email protected]>
Radoslav Yovchev <[email protected]>
Raghu Raja <[email protected]>
Rainer Orth <[email protected]>
Roman Lebedev <[email protected]>
Sayan Bhattacharjee <[email protected]>
Shapr3D <[email protected]>
Shuo Chen <[email protected]>
Staffan Tjernstrom <[email protected]>
Steinar H. Gunderson <[email protected]>
Stripe, Inc.
Tobias Schmidt <[email protected]>
Yixuan Qiu <[email protected]>
Yusuke Suzuki <[email protected]>
Zbigniew Skowron <[email protected]>
Min-Yih Hsu <[email protected]>
100 changes: 56 additions & 44 deletions third-party/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
cmake_minimum_required (VERSION 3.5.1)

foreach(p
CMP0048 # OK to clear PROJECT_VERSION on project()
CMP0054 # CMake 3.1
CMP0056 # export EXE_LINKER_FLAGS to try_run
CMP0057 # Support no if() IN_LIST operator
CMP0063 # Honor visibility properties for all targets
CMP0077 # Allow option() overrides in importing projects
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
# Require CMake 3.10. If available, use the policies up to CMake 3.22.
cmake_minimum_required (VERSION 3.10...3.22)

project (benchmark VERSION 1.6.0 LANGUAGES CXX)
project (benchmark VERSION 1.8.3 LANGUAGES CXX)

option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
option(BENCHMARK_ENABLE_EXCEPTIONS "Enable the use of exceptions in the benchmark library." ON)
Expand All @@ -26,11 +14,14 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
# PGC++ maybe reporting false positives.
set(BENCHMARK_ENABLE_WERROR OFF)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "NVHPC")
set(BENCHMARK_ENABLE_WERROR OFF)
endif()
if(BENCHMARK_FORCE_WERROR)
set(BENCHMARK_ENABLE_WERROR ON)
endif(BENCHMARK_FORCE_WERROR)

if(NOT MSVC)
if(NOT (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))
option(BENCHMARK_BUILD_32_BITS "Build a 32 bit version of the library." OFF)
else()
set(BENCHMARK_BUILD_32_BITS OFF CACHE BOOL "Build a 32 bit version of the library - unsupported when using MSVC)" FORCE)
Expand All @@ -50,8 +41,11 @@ option(BENCHMARK_USE_BUNDLED_GTEST "Use bundled GoogleTest. If disabled, the fin

option(BENCHMARK_ENABLE_LIBPFM "Enable performance counters provided by libpfm" OFF)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
# Export only public symbols
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# As of CMake 3.18, CMAKE_SYSTEM_PROCESSOR is not set properly for MSVC and
# cross-compilation (e.g. Host=x86_64, target=aarch64) requires using the
# undocumented, but working variable.
Expand All @@ -72,7 +66,7 @@ function(should_enable_assembly_tests)
return()
endif()
endif()
if (MSVC)
if (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
return()
elseif(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
return()
Expand Down Expand Up @@ -111,29 +105,49 @@ get_git_version(GIT_VERSION)
# If no git version can be determined, use the version
# from the project() command
if ("${GIT_VERSION}" STREQUAL "0.0.0")
set(VERSION "${benchmark_VERSION}")
set(VERSION "v${benchmark_VERSION}")
else()
set(VERSION "${GIT_VERSION}")
endif()

# Normalize version: drop "v" prefix, replace first "-" with ".",
# drop everything after second "-" (including said "-").
string(STRIP ${VERSION} VERSION)
if(VERSION MATCHES v[^-]*-)
string(REGEX REPLACE "v([^-]*)-([0-9]+)-.*" "\\1.\\2" NORMALIZED_VERSION ${VERSION})
else()
string(REGEX REPLACE "v(.*)" "\\1" NORMALIZED_VERSION ${VERSION})
endif()

# Tell the user what versions we are using
message(STATUS "Version: ${VERSION}")
message(STATUS "Google Benchmark version: ${VERSION}, normalized to ${NORMALIZED_VERSION}")

# The version of the libraries
set(GENERIC_LIB_VERSION ${VERSION})
string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION)
set(GENERIC_LIB_VERSION ${NORMALIZED_VERSION})
string(SUBSTRING ${NORMALIZED_VERSION} 0 1 GENERIC_LIB_SOVERSION)

# Import our CMake modules
include(CheckCXXCompilerFlag)
include(AddCXXCompilerFlag)
include(CXXFeatureCheck)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include(CXXFeatureCheck)

check_library_exists(rt shm_open "" HAVE_LIB_RT)

if (BENCHMARK_BUILD_32_BITS)
add_required_cxx_compiler_flag(-m32)
endif()

if (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
set(BENCHMARK_CXX_STANDARD 14)
else()
set(BENCHMARK_CXX_STANDARD 11)
endif()

set(CMAKE_CXX_STANDARD ${BENCHMARK_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS OFF)

if (MSVC)
# Turn compiler warnings up to 11
string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Expand Down Expand Up @@ -166,21 +180,18 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /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 on Large-file Support
add_definitions(-D_FILE_OFFSET_BITS=64)
add_definitions(-D_LARGEFILE64_SOURCE)
add_definitions(-D_LARGEFILE_SOURCE)
# Turn compiler warnings up to 11
add_cxx_compiler_flag(-Wall)
add_cxx_compiler_flag(-Wextra)
add_cxx_compiler_flag(-Wshadow)
add_cxx_compiler_flag(-Wfloat-equal)
add_cxx_compiler_flag(-Wold-style-cast)
if(BENCHMARK_ENABLE_WERROR)
add_cxx_compiler_flag(-Werror RELEASE)
add_cxx_compiler_flag(-Werror RELWITHDEBINFO)
add_cxx_compiler_flag(-Werror MINSIZEREL)
add_cxx_compiler_flag(-Werror)
endif()
if (NOT BENCHMARK_ENABLE_TESTING)
# Disable warning when compiling tests as gtest does not use 'override'.
Expand All @@ -193,24 +204,23 @@ else()
# Disable warnings regarding deprecated parts of the library while building
# and testing those parts of the library.
add_cxx_compiler_flag(-Wno-deprecated-declarations)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
# Intel silently ignores '-Wno-deprecated-declarations',
# warning no. 1786 must be explicitly disabled.
# See #631 for rationale.
add_cxx_compiler_flag(-wd1786)
add_cxx_compiler_flag(-fno-finite-math-only)
endif()
# Disable deprecation warnings for release builds (when -Werror is enabled).
if(BENCHMARK_ENABLE_WERROR)
add_cxx_compiler_flag(-Wno-deprecated RELEASE)
add_cxx_compiler_flag(-Wno-deprecated RELWITHDEBINFO)
add_cxx_compiler_flag(-Wno-deprecated MINSIZEREL)
add_cxx_compiler_flag(-Wno-deprecated)
endif()
if (NOT BENCHMARK_ENABLE_EXCEPTIONS)
add_cxx_compiler_flag(-fno-exceptions)
endif()

if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #ICC17u2: Many false positives for Wstrict-aliasing
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") #ICC17u2: Many false positives for Wstrict-aliasing
add_cxx_compiler_flag(-Wstrict-aliasing)
endif()
endif()
Expand All @@ -219,12 +229,12 @@ else()
add_cxx_compiler_flag(-wd654)
add_cxx_compiler_flag(-Wthread-safety)
if (HAVE_CXX_FLAG_WTHREAD_SAFETY)
cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
cxx_feature_check(THREAD_SAFETY_ATTRIBUTES "-DINCLUDE_DIRECTORIES=${PROJECT_SOURCE_DIR}/include")
endif()

# On most UNIX like platforms g++ and clang++ define _GNU_SOURCE as a
# predefined macro, which turns on all of the wonderful libc extensions.
# However g++ doesn't do this in Cygwin so we have to define it ourselfs
# However g++ doesn't do this in Cygwin so we have to define it ourselves
# since we depend on GNU/POSIX/BSD extensions.
if (CYGWIN)
add_definitions(-D_GNU_SOURCE=1)
Expand Down Expand Up @@ -275,7 +285,8 @@ if (BENCHMARK_USE_LIBCXX)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_cxx_compiler_flag(-stdlib=libc++)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
add_cxx_compiler_flag(-nostdinc++)
message(WARNING "libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
# Adding -nodefaultlibs directly to CMAKE_<TYPE>_LINKER_FLAGS will break
Expand Down Expand Up @@ -312,9 +323,10 @@ cxx_feature_check(STEADY_CLOCK)
# Ensure we have pthreads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
cxx_feature_check(PTHREAD_AFFINITY)

if (BENCHMARK_ENABLE_LIBPFM)
find_package(PFM)
find_package(PFM REQUIRED)
endif()

# Set up directories
Expand Down
14 changes: 12 additions & 2 deletions third-party/benchmark/CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Albert Pretorius <[email protected]>
Alex Steele <[email protected]>
Andriy Berestovskyy <[email protected]>
Arne Beer <[email protected]>
Bátor Tallér <[email protected]>
Billy Robert O'Neal III <[email protected]> <[email protected]>
Cezary Skrzyński <[email protected]>
Chris Kennelly <[email protected]> <[email protected]>
Christian Wassermann <[email protected]>
Christopher Seymour <[email protected]>
Expand All @@ -44,25 +46,32 @@ Eric Backus <[email protected]>
Eric Fiselier <[email protected]>
Eugene Zhuk <[email protected]>
Evgeny Safronov <[email protected]>
Fabien Pichot <[email protected]>
Fanbo Meng <[email protected]>
Federico Ficarelli <[email protected]>
Felix Homann <[email protected]>
Geoffrey Martin-Noble <[email protected]> <[email protected]>
Gergely Meszaros <[email protected]>
Gergő Szitár <[email protected]>
Hannes Hauswedell <[email protected]>
Henrique Bucher <[email protected]>
Ismael Jimenez Martinez <[email protected]>
Iakov Sergeev <[email protected]>
Jern-Kuan Leong <[email protected]>
JianXiong Zhou <[email protected]>
Joao Paulo Magalhaes <[email protected]>
John Millikin <[email protected]>
Jordan Williams <[email protected]>
Jussi Knuuttila <[email protected]>
Kai Wolf <[email protected]>
Kaito Udagawa <[email protected]>
Kai Wolf <[email protected]>
Kishan Kumar <[email protected]>
Lei Xu <[email protected]>
Marcel Jacobse <[email protected]>
Matt Clarkson <[email protected]>
Maxim Vafin <[email protected]>
Mike Apodaca <[email protected]>
Min-Yih Hsu <[email protected]>
Nick Hutchinson <[email protected]>
Norman Heino <[email protected]>
Oleksandr Sochka <[email protected]>
Expand All @@ -71,6 +80,8 @@ Pascal Leroy <[email protected]>
Paul Redmond <[email protected]>
Pierre Phaneuf <[email protected]>
Radoslav Yovchev <[email protected]>
Raghu Raja <[email protected]>
Rainer Orth <[email protected]>
Raul Marin <[email protected]>
Ray Glover <[email protected]>
Robert Guo <[email protected]>
Expand All @@ -84,4 +95,3 @@ Tom Madams <[email protected]> <[email protected]>
Yixuan Qiu <[email protected]>
Yusuke Suzuki <[email protected]>
Zbigniew Skowron <[email protected]>
Min-Yih Hsu <[email protected]>
13 changes: 10 additions & 3 deletions third-party/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
[![bazel](https://github.com/google/benchmark/actions/workflows/bazel.yml/badge.svg)](https://github.com/google/benchmark/actions/workflows/bazel.yml)
[![pylint](https://github.com/google/benchmark/workflows/pylint/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Apylint)
[![test-bindings](https://github.com/google/benchmark/workflows/test-bindings/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Atest-bindings)

[![Build Status](https://travis-ci.org/google/benchmark.svg?branch=master)](https://travis-ci.org/google/benchmark)
[![Coverage Status](https://coveralls.io/repos/google/benchmark/badge.svg)](https://coveralls.io/r/google/benchmark)

[![Discord](https://discordapp.com/api/guilds/1125694995928719494/widget.png?style=shield)](https://discord.gg/cz7UX7wKC2)

A library to benchmark code snippets, similar to unit tests. Example:

Expand All @@ -33,7 +32,7 @@ To get started, see [Requirements](#requirements) and
[Installation](#installation). See [Usage](#usage) for a full example and the
[User Guide](docs/user_guide.md) for a more comprehensive feature overview.

It may also help to read the [Google Test documentation](https://github.com/google/googletest/blob/master/docs/primer.md)
It may also help to read the [Google Test documentation](https://github.com/google/googletest/blob/main/docs/primer.md)
as some of the structural aspects of the APIs are similar.

## Resources
Expand All @@ -47,6 +46,8 @@ IRC channels:

[Assembly Testing Documentation](docs/AssemblyTests.md)

[Building and installing Python bindings](docs/python_bindings.md)

## Requirements

The library can be used with C++03. However, it requires C++11 to build,
Expand Down Expand Up @@ -137,6 +138,12 @@ cache variables, if autodetection fails.
If you are using clang, you may need to set `LLVMAR_EXECUTABLE`,
`LLVMNM_EXECUTABLE` and `LLVMRANLIB_EXECUTABLE` cmake cache variables.

To enable sanitizer checks (eg., `asan` and `tsan`), add:
```
-DCMAKE_C_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all"
-DCMAKE_CXX_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all "
```

### Stable and Experimental Library Versions

The main branch contains the latest stable version of the benchmarking library;
Expand Down
Loading