.github
CMakeModules
LICENSES
dist
externals
FidelityFX-FSR
SDL
Vulkan-Headers
cmake-modules
cpp-httplib
cpp-jwt
cubeb
demangle
discord-rpc
dynarmic
enet
ffmpeg
find-modules
getopt
glad
inih
libressl
libusb
mbedtls
microprofile
opus
sirit
vcpkg
buildtrees
downloads
packages
boost-algorithm_x64-windows
boost-align_x64-windows
boost-array_x64-windows
boost-asio_x64-windows
boost-assert_x64-windows
boost-atomic_x64-windows
boost-bind_x64-windows
boost-build_x64-windows
boost-chrono_x64-windows
boost-concept-check_x64-windows
boost-config_x64-windows
boost-container-hash_x64-windows
boost-container_x64-windows
boost-context_x64-windows
boost-conversion_x64-windows
boost-core_x64-windows
boost-coroutine_x64-windows
boost-crc_x64-windows
boost-date-time_x64-windows
boost-detail_x64-windows
boost-endian_x64-windows
boost-exception_x64-windows
boost-filesystem_x64-windows
boost-function-types_x64-windows
boost-function_x64-windows
boost-functional_x64-windows
boost-fusion_x64-windows
boost-icl_x64-windows
boost-integer_x64-windows
boost-intrusive_x64-windows
boost-io_x64-windows
boost-iterator_x64-windows
boost-lexical-cast_x64-windows
boost-modular-build-helper_x64-windows
boost-move_x64-windows
boost-mp11_x64-windows
boost-mpl_x64-windows
boost-numeric-conversion_x64-windows
boost-optional_x64-windows
boost-phoenix_x64-windows
boost-pool_x64-windows
boost-predef_x64-windows
boost-preprocessor_x64-windows
boost-process_x64-windows
boost-proto_x64-windows
boost-range_x64-windows
boost-ratio_x64-windows
boost-rational_x64-windows
boost-regex_x64-windows
boost-smart-ptr_x64-windows
boost-spirit_x64-windows
boost-static-assert_x64-windows
boost-system_x64-windows
boost-test_x64-windows
boost-thread_x64-windows
boost-throw-exception_x64-windows
boost-timer_x64-windows
bin
debug
include
boost
timer
progress.hpp
timer.hpp
lib
share
BUILD_INFO
CONTROL
boost-tokenizer_x64-windows
boost-tuple_x64-windows
boost-type-index_x64-windows
boost-type-traits_x64-windows
boost-typeof_x64-windows
boost-uninstall_x64-windows
boost-unordered_x64-windows
boost-utility_x64-windows
boost-variant2_x64-windows
boost-variant_x64-windows
boost-vcpkg-helpers_x64-windows
boost-winapi_x64-windows
fmt_x64-windows
lz4_x64-windows
nlohmann-json_x64-windows
vcpkg-cmake-config_x64-windows
vcpkg-cmake-get-vars_x64-windows
vcpkg-cmake_x64-windows
zlib_x64-windows
zstd_x64-windows
scripts
.gitkeep
vcpkg.exe
xbyak
CMakeLists.txt
hooks
patches
src
CMakeLists.txt
CONTRIBUTING.md
Doxyfile
LICENSE.txt
README.md
license.txt
vcpkg.json
76 lines
2.7 KiB
C++
Executable File
76 lines
2.7 KiB
C++
Executable File
// boost timer.hpp header file ---------------------------------------------//
|
|
|
|
// Copyright Beman Dawes 1994-99. Distributed under the Boost
|
|
// Software License, Version 1.0. (See accompanying file
|
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// See http://www.boost.org/libs/timer for documentation.
|
|
|
|
// Revision History
|
|
// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (JMaddock)
|
|
// 12 Jan 01 Change to inline implementation to allow use without library
|
|
// builds. See docs for more rationale. (Beman Dawes)
|
|
// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock)
|
|
// 16 Jul 99 Second beta
|
|
// 6 Jul 99 Initial boost version
|
|
|
|
#ifndef BOOST_TIMER_HPP
|
|
#define BOOST_TIMER_HPP
|
|
|
|
#include <boost/config/header_deprecated.hpp>
|
|
BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )
|
|
|
|
#include <boost/config.hpp>
|
|
#include <ctime>
|
|
#include <boost/limits.hpp>
|
|
|
|
# ifdef BOOST_NO_STDC_NAMESPACE
|
|
namespace std { using ::clock_t; using ::clock; }
|
|
# endif
|
|
|
|
|
|
namespace boost {
|
|
|
|
// timer -------------------------------------------------------------------//
|
|
|
|
// A timer object measures elapsed time.
|
|
|
|
// It is recommended that implementations measure wall clock rather than CPU
|
|
// time since the intended use is performance measurement on systems where
|
|
// total elapsed time is more important than just process or CPU time.
|
|
|
|
// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours
|
|
// due to implementation limitations. The accuracy of timings depends on the
|
|
// accuracy of timing information provided by the underlying platform, and
|
|
// this varies a great deal from platform to platform.
|
|
|
|
class timer
|
|
{
|
|
public:
|
|
timer() { _start_time = std::clock(); } // postcondition: elapsed()==0
|
|
// timer( const timer& src ); // post: elapsed()==src.elapsed()
|
|
// ~timer(){}
|
|
// timer& operator=( const timer& src ); // post: elapsed()==src.elapsed()
|
|
void restart() { _start_time = std::clock(); } // post: elapsed()==0
|
|
double elapsed() const // return elapsed time in seconds
|
|
{ return double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
|
|
|
|
double elapsed_max() const // return estimated maximum value for elapsed()
|
|
// Portability warning: elapsed_max() may return too high a value on systems
|
|
// where std::clock_t overflows or resets at surprising values.
|
|
{
|
|
return (double((std::numeric_limits<std::clock_t>::max)())
|
|
- double(_start_time)) / double(CLOCKS_PER_SEC);
|
|
}
|
|
|
|
double elapsed_min() const // return minimum value for elapsed()
|
|
{ return double(1)/double(CLOCKS_PER_SEC); }
|
|
|
|
private:
|
|
std::clock_t _start_time;
|
|
}; // timer
|
|
|
|
} // namespace boost
|
|
|
|
#endif // BOOST_TIMER_HPP
|