early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -0,0 +1,11 @@
# Copyright 2018, 2019 Peter Dimov
# 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
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::timer Boost::core Boost::detail)
endif()

View File

@@ -0,0 +1,36 @@
# Boost Timer Library test Jamfile
# Copyright Beman Dawes 2003, 2006, 2011
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
# See library home page at http://www.boost.org/libs/timer
import testing ;
path-constant parent : .. ; # so that inspect will start in boost-root/libs/timer
# when run from another directory, such as boost-root/status
project
: requirements
<library>/boost/timer//boost_timer
;
run ../example/auto_cpu_timer_example.cpp : : : <test-info>always_show_run_output ;
run cpu_timer_info.cpp : : : <test-info>always_show_run_output ;
run cpu_timer_test.cpp
: : : <test-info>always_show_run_output ;
run ../example/timex.cpp : echo "Hello, world" : : <test-info>always_show_run_output ;
compile original_timer_test.cpp ;
run chrono_conflict_test.cpp /boost/chrono//boost_chrono : : : <link>static ;
run progress_display_test.cpp ;
run /boost/tools/inspect//inspect/<variant>release : $(parent) -text -brief : : <test-info>always_show_run_output : inspect ;
explicit inspect ;

View File

@@ -0,0 +1,16 @@
// Copyright 2017 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// Check that using Chrono and Timer in the same program does
// not cause link errors.
#include <boost/chrono.hpp>
#include <boost/timer/timer.hpp>
int main()
{
boost::chrono::steady_clock::now();
boost::timer::cpu_timer cpt;
}

View File

@@ -0,0 +1,15 @@
# Copyright 2018-2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.20)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_timer REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Boost::timer)
enable_testing()
add_test(main main)

View File

@@ -0,0 +1,11 @@
// Copyright 2019 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/timer/timer.hpp>
int main()
{
boost::timer::cpu_timer timer;
timer.stop();
}

View File

@@ -0,0 +1,49 @@
# Copyright 2018-2021 Peter Dimov
# 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
cmake_minimum_required(VERSION 3.5...3.20)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../.. boostorg/timer)
set(deps
# Primary dependencies
chrono
config
core
io
predef
system
throw_exception
# Secondary dependencies
assert
integer
move
mpl
ratio
static_assert
type_traits
typeof
utility
winapi
variant2
preprocessor
rational
mp11
)
foreach(dep IN LISTS deps)
add_subdirectory(../../../${dep} boostorg/${dep})
endforeach()
add_executable(main main.cpp)
target_link_libraries(main Boost::timer Boost::core)
enable_testing()
add_test(main main)

View File

@@ -0,0 +1,11 @@
// Copyright 2019 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/timer/timer.hpp>
int main()
{
boost::timer::cpu_timer timer;
timer.stop();
}

View File

@@ -0,0 +1,75 @@
// boost cpu_timer_info.cpp ----------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/timer for documentation.
#include <boost/timer/timer.hpp>
#include <boost/chrono/chrono.hpp>
#include <boost/detail/lightweight_main.hpp>
#include <cstdlib> // for atol()
#include <iostream>
#include <locale>
using boost::timer::nanosecond_type;
using boost::timer::cpu_times;
using boost::timer::cpu_timer;
using boost::timer::auto_cpu_timer;
using std::cout; using std::endl;
int cpp_main( int argc, char * argv[] )
{
cout << '\n';
cout << "For cpu_times.wall, the underlying clock "
<< (boost::chrono::high_resolution_clock::is_steady
? "is steady. "
: "is not steady. "
)
<< "Steady clocks are defined by C++11 as clocks for which values "
"of time_point never decrease as physical time advances and for "
"which values of time_point advance at a steady rate relative to "
"real time. That is, the clock may not be adjusted.\n\n";
cpu_times start_time;
start_time.clear();
cpu_times current_time;
{
cpu_timer cpu;
cout << "measure boost::timer::cpu_timer resolution for user time..."
<< endl;
for (int i = 0; i < 3; ++i)
{
cpu.start();
start_time = cpu.elapsed();
current_time.user = start_time.user;
while (current_time.user == start_time.user)
{
current_time = cpu.elapsed();
}
cout << current_time.user - start_time.user << "ns\n";
}
}
{
cpu_timer cpu;
cout << "measure boost::timer::cpu_timer resolution for wall-clock time..."
<< endl;
for (int i = 0; i < 100; ++i)
{
cpu.start();
start_time.wall = cpu.elapsed().wall;
current_time.wall = start_time.wall;
while (current_time.wall == start_time.wall)
{
current_time.wall = cpu.elapsed().wall;
}
cout << current_time.wall - start_time.wall << "ns ";
}
}
return 0;
}

View File

@@ -0,0 +1,227 @@
// boost timer_test.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2006, 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/timer for documentation.
#include <boost/timer/timer.hpp>
#include <boost/detail/lightweight_main.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <cstdlib> // for atol()
#include <iostream>
#include <string>
#include <ctime>
using std::string;
using std::cout;
using std::endl;
using boost::timer::default_places;
using boost::timer::nanosecond_type;
using boost::timer::cpu_times;
using boost::timer::format;
using boost::timer::cpu_timer;
using boost::timer::auto_cpu_timer;
namespace
{
void unit_test()
{
cout << "unit test..." << endl;
string default_format(" %ws wall, %us user + %ss system = %ts CPU (%p%)\n");
// each constructor
auto_cpu_timer t1;
BOOST_TEST(!t1.is_stopped());
// the following, and similar below, are giving false failures on MinGW/gcc
// so comment them out for now
//BOOST_TEST(&t1.ostream() == &cout);
BOOST_TEST_EQ(t1.places(), default_places);
BOOST_TEST_EQ(t1.format_string(), default_format);
t1.stop();
BOOST_TEST(t1.is_stopped());
auto_cpu_timer t1a(t1);
BOOST_TEST(t1a.is_stopped());
BOOST_TEST_EQ(t1a.elapsed().wall, t1.elapsed().wall);
BOOST_TEST_EQ(t1a.elapsed().user, t1.elapsed().user);
BOOST_TEST_EQ(t1a.elapsed().system, t1.elapsed().system);
//BOOST_TEST(&t1a.ostream() == &cout);
BOOST_TEST_EQ(t1a.places(), default_places);
BOOST_TEST_EQ(t1a.format_string(), default_format);
auto_cpu_timer t1b;
BOOST_TEST(!t1b.is_stopped());
t1b = t1;
BOOST_TEST(t1b.is_stopped());
BOOST_TEST_EQ(t1b.elapsed().wall, t1.elapsed().wall);
BOOST_TEST_EQ(t1b.elapsed().user, t1.elapsed().user);
BOOST_TEST_EQ(t1b.elapsed().system, t1.elapsed().system);
//BOOST_TEST(&t1b.ostream() == &cout);
BOOST_TEST_EQ(t1b.places(), default_places);
BOOST_TEST_EQ(t1b.format_string(), default_format);
auto_cpu_timer t2(1);
BOOST_TEST(!t2.is_stopped());
//BOOST_TEST(&t2.ostream() == &cout);
BOOST_TEST_EQ(t2.places(), 1);
BOOST_TEST_EQ(t2.format_string(), default_format);
auto_cpu_timer t3("foo");
BOOST_TEST(!t3.is_stopped());
//BOOST_TEST(&t3.ostream() == &cout);
BOOST_TEST_EQ(t3.places(), default_places);
BOOST_TEST_EQ(t3.format_string(), string("foo"));
auto_cpu_timer t4(1, "foo");
BOOST_TEST(!t4.is_stopped());
//BOOST_TEST(&t4.ostream() == &cout);
BOOST_TEST_EQ(t4.places(), 1);
BOOST_TEST_EQ(t4.format_string(), string("foo"));
auto_cpu_timer t5(std::cerr);
BOOST_TEST(!t5.is_stopped());
BOOST_TEST(&t5.ostream() == &std::cerr);
BOOST_TEST_EQ(t5.places(), default_places);
BOOST_TEST_EQ(t5.format_string(), default_format);
auto_cpu_timer t6(std::cerr, 1);
BOOST_TEST(!t6.is_stopped());
BOOST_TEST(&t6.ostream() == &std::cerr);
BOOST_TEST_EQ(t6.places(), 1);
BOOST_TEST_EQ(t6.format_string(), default_format);
auto_cpu_timer t7(std::cerr, "foo");
BOOST_TEST(!t7.is_stopped());
BOOST_TEST(&t7.ostream() == &std::cerr);
BOOST_TEST_EQ(t7.places(), default_places);
BOOST_TEST_EQ(t7.format_string(), string("foo"));
auto_cpu_timer t8(std::cerr, 1, "foo");
BOOST_TEST(!t8.is_stopped());
BOOST_TEST(&t8.ostream() == &std::cerr);
BOOST_TEST_EQ(t8.places(), 1);
BOOST_TEST_EQ(t8.format_string(), string("foo"));
t1.stop();
t1a.stop();
t1b.stop();
t2.stop();
t3.stop();
t4.stop();
t5.stop();
t6.stop();
t7.stop();
t8.stop();
cout << " unit test complete" << endl;
}
void format_test()
{
cout << "format test..." << endl;
cpu_times times;
times.wall = 5123456789LL;
times.user = 2123456789LL;
times.system = 1234567890LL;
cout << " times.wall is " << times.wall << '\n';
cout << " times.user is " << times.user << '\n';
cout << " times.system is " << times.system << '\n';
cout << " user+system is " << times.user + times.system << '\n';
cout << " format(times, 9) output: " << format(times, 9);
BOOST_TEST_EQ(format(times, 9),
string(" 5.123456789s wall, 2.123456789s user + 1.234567890s system = 3.358024679s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 8),
string(" 5.12345679s wall, 2.12345679s user + 1.23456789s system = 3.35802468s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 7),
string(" 5.1234568s wall, 2.1234568s user + 1.2345679s system = 3.3580247s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 6),
string(" 5.123457s wall, 2.123457s user + 1.234568s system = 3.358025s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 5),
string(" 5.12346s wall, 2.12346s user + 1.23457s system = 3.35802s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 4),
string(" 5.1235s wall, 2.1235s user + 1.2346s system = 3.3580s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 3),
string(" 5.123s wall, 2.123s user + 1.235s system = 3.358s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 2),
string(" 5.12s wall, 2.12s user + 1.23s system = 3.36s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 1),
string(" 5.1s wall, 2.1s user + 1.2s system = 3.4s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 0),
string(" 5s wall, 2s user + 1s system = 3s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 10),
string(" 5.123456789s wall, 2.123456789s user + 1.234567890s system = 3.358024679s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, -1),
string(" 5.123457s wall, 2.123457s user + 1.234568s system = 3.358025s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times),
string(" 5.123457s wall, 2.123457s user + 1.234568s system = 3.358025s CPU (65.5%)\n"));
BOOST_TEST_EQ(format(times, 5, " %w, %u, %s, %t, %%p%"),
string(" 5.12346, 2.12346, 1.23457, 3.35802, %65.5%"));
BOOST_TEST_EQ(format(times, 5, "boo"), string("boo"));
cout << " format test complete" << endl;
}
void std_c_consistency_test()
{
cout << "C library consistency test..." << endl;
// This test is designed to account for C timer resolution and for the possibility
// that another active process may take up a lot of time.
cpu_timer t; // calls start(), so ensures any cpu_timer dll loaded
std::time(0); // ensure any system dll's loaded
std::time_t stop_time, start_time = std::time(0);
// wait until the time() clock ticks
while (std::time(0) == start_time) {}
// start both timers
start_time = std::time(0);
t.start();
// wait until the time() clock ticks again
while (std::time(0) == start_time) {}
// stop both timers
stop_time = std::time(0);
t.stop();
cout << " std::time() elapsed is " << (stop_time - start_time) * 1.0L << " seconds\n";
cout << " cpu_timer wall elapsed is " << t.elapsed().wall / 1000000000.0L << " seconds\n";
cout << " The two clocks whose elapsed time is compared by this test are started\n"
" and stopped one right after the other. If the operating system suspends\n"
" the process in the interim, the test may fail. Thus no single failure\n"
" of this test is meaningful.\n";
// These tests allow lots of fuzz to reduce false positives
BOOST_TEST(t.elapsed().wall / 1000000000.0L > (stop_time - start_time) * 0.75L);
BOOST_TEST(t.elapsed().wall / 1000000000.0L < (stop_time - start_time) * 1.25L);
cout << " C library consistency test complete" << endl;
}
} // unnamed namespace
//--------------------------------------------------------------------------------------//
int cpp_main(int, char *[])
{
cout << "---------- timer_test ----------\n";
unit_test();
format_test();
std_c_consistency_test();
return ::boost::report_errors();
}

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C88697D9-587C-4649-AA39-8819A96A2A12}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>chrono_dll</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CHRONO_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHRONO_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\chrono\src\chrono.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\system_dll\system_dll.vcxproj">
<Project>{443dd1e8-4d52-4323-8280-a2320df7ef6d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Executing test $(TargetName).exe...</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{955C9C33-5364-4F02-9D59-65657E8DFBA9}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cpu_timer_test</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\cpu_timer_test.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\chrono_dll\chrono_dll.vcxproj">
<Project>{c88697d9-587c-4649-aa39-8819a96a2a12}</Project>
</ProjectReference>
<ProjectReference Include="..\system_dll\system_dll.vcxproj">
<Project>{443dd1e8-4d52-4323-8280-a2320df7ef6d}</Project>
</ProjectReference>
<ProjectReference Include="..\timer_dll\timer_dll.vcxproj">
<Project>{8a6cf2a1-c5f7-4119-b510-88b98197bcb2}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{443DD1E8-4D52-4323-8280-A2320DF7EF6D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>system_dll</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\system\src\error_code.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,50 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_dll", "timer_dll\timer_dll.vcxproj", "{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}"
ProjectSection(ProjectDependencies) = postProject
{C88697D9-587C-4649-AA39-8819A96A2A12} = {C88697D9-587C-4649-AA39-8819A96A2A12}
{443DD1E8-4D52-4323-8280-A2320DF7EF6D} = {443DD1E8-4D52-4323-8280-A2320DF7EF6D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chrono_dll", "chrono_dll\chrono_dll.vcxproj", "{C88697D9-587C-4649-AA39-8819A96A2A12}"
ProjectSection(ProjectDependencies) = postProject
{443DD1E8-4D52-4323-8280-A2320DF7EF6D} = {443DD1E8-4D52-4323-8280-A2320DF7EF6D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_dll", "system_dll\system_dll.vcxproj", "{443DD1E8-4D52-4323-8280-A2320DF7EF6D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpu_timer_test", "cpu_timer_test\cpu_timer_test.vcxproj", "{955C9C33-5364-4F02-9D59-65657E8DFBA9}"
ProjectSection(ProjectDependencies) = postProject
{8A6CF2A1-C5F7-4119-B510-88B98197BCB2} = {8A6CF2A1-C5F7-4119-B510-88B98197BCB2}
{C88697D9-587C-4649-AA39-8819A96A2A12} = {C88697D9-587C-4649-AA39-8819A96A2A12}
{443DD1E8-4D52-4323-8280-A2320DF7EF6D} = {443DD1E8-4D52-4323-8280-A2320DF7EF6D}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}.Debug|Win32.ActiveCfg = Debug|Win32
{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}.Debug|Win32.Build.0 = Debug|Win32
{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}.Release|Win32.ActiveCfg = Release|Win32
{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}.Release|Win32.Build.0 = Release|Win32
{C88697D9-587C-4649-AA39-8819A96A2A12}.Debug|Win32.ActiveCfg = Debug|Win32
{C88697D9-587C-4649-AA39-8819A96A2A12}.Debug|Win32.Build.0 = Debug|Win32
{C88697D9-587C-4649-AA39-8819A96A2A12}.Release|Win32.ActiveCfg = Release|Win32
{C88697D9-587C-4649-AA39-8819A96A2A12}.Release|Win32.Build.0 = Release|Win32
{443DD1E8-4D52-4323-8280-A2320DF7EF6D}.Debug|Win32.ActiveCfg = Debug|Win32
{443DD1E8-4D52-4323-8280-A2320DF7EF6D}.Debug|Win32.Build.0 = Debug|Win32
{443DD1E8-4D52-4323-8280-A2320DF7EF6D}.Release|Win32.ActiveCfg = Release|Win32
{443DD1E8-4D52-4323-8280-A2320DF7EF6D}.Release|Win32.Build.0 = Release|Win32
{955C9C33-5364-4F02-9D59-65657E8DFBA9}.Debug|Win32.ActiveCfg = Debug|Win32
{955C9C33-5364-4F02-9D59-65657E8DFBA9}.Debug|Win32.Build.0 = Debug|Win32
{955C9C33-5364-4F02-9D59-65657E8DFBA9}.Release|Win32.ActiveCfg = Release|Win32
{955C9C33-5364-4F02-9D59-65657E8DFBA9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8A6CF2A1-C5F7-4119-B510-88B98197BCB2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>timer_dll</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TIMER_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TIMER_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>
</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\auto_timers_construction.cpp" />
<ClCompile Include="..\..\..\src\cpu_timer.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\chrono_dll\chrono_dll.vcxproj">
<Project>{c88697d9-587c-4649-aa39-8819a96a2a12}</Project>
</ProjectReference>
<ProjectReference Include="..\system_dll\system_dll.vcxproj">
<Project>{443dd1e8-4d52-4323-8280-a2320df7ef6d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,89 @@
// timer, job_timer, and progress_display sample program -------------------//
// Copyright Beman Dawes 1998. 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
// 12 Jan 01 Cut time to 1.0 secs to speed regression tests (Beman Dawes)
// 25 Sep 99 added elapsed_min() and elapsed_max() reporting
// 16 Jul 99 Second beta
// 6 Jul 99 Initial boost version
#include <boost/progress.hpp>
#include <iostream>
#include <climits>
using boost::timer;
using boost::progress_timer;
using boost::progress_display;
using std::cout;
using std::endl;
int main() {
timer t0; // used only for elapsed_max() and elapsed_min()
cout << "timer::elapsed_min() reports " << t0.elapsed_min() << " seconds\n";
cout << "timer::elapsed_max() reports " << t0.elapsed_max()
<< " seconds, which is " << t0.elapsed_max()/3600.0 << " hours\n";
cout << "\nverify progress_display(0) doesn't divide by zero" << endl;
progress_display zero( 0 ); // verify 0 doesn't divide by zero
++zero;
long loops;
timer loop_timer;
const double time = 1.0;
cout << "\ndetermine " << time << " second iteration count" << endl;
for ( loops = 0; loops < LONG_MAX
&& loop_timer.elapsed() < time; ++loops ) {}
cout << loops << " iterations"<< endl;
long i;
bool time_waster; // defeat [some] optimizers by storing result here
progress_timer pt;
timer t1;
timer t4;
timer t5;
cout << "\nburn about " << time << " seconds" << endl;
progress_display pd( loops );
for ( i = loops; i--; )
{ time_waster = loop_timer.elapsed() < time; ++pd; }
timer t2( t1 );
timer t3;
t4 = t3;
t5.restart();
cout << "\nburn about " << time << " seconds again" << endl;
pd.restart( loops );
for ( i = loops; i--; )
{ time_waster = loop_timer.elapsed() < time; ++pd; }
if ( time_waster ) cout << ' '; // using time_waster quiets compiler warnings
progress_display pd2( 50, cout, "\nLead string 1 ", "Lead string 2 ", "Lead string 3 " );
for ( ; pd2.count() < 50; ++pd2 ) {}
cout << "\nt1 elapsed: " << t1.elapsed() << '\n';
cout << "t2 elapsed: " << t2.elapsed() << '\n';
cout << "t3 elapsed: " << t3.elapsed() << '\n';
cout << "t4 elapsed: " << t4.elapsed() << '\n';
cout << "t5 elapsed: " << t5.elapsed() << '\n';
cout << "t1 and t2 should report the same times (very approximately "
<< 2*time << " seconds).\n";
cout << "t3, t4 and t5 should report about the same times,\n";
cout << "and these should be about half the t1 and t2 times.\n";
cout << "The following elapsed time should be slightly greater than t1."
<< endl;
return 0;
} // main

View File

@@ -0,0 +1,37 @@
// Copyright 2019 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
#include <boost/timer/progress_display.hpp>
#include <boost/core/lightweight_test.hpp>
#include <sstream>
#include <cstddef>
int main()
{
int n = 17;
std::ostringstream os;
boost::timer::progress_display pd( n, os, "L1:", "L2:", "L3:" );
BOOST_TEST_EQ( os.str(), std::string(
"L1:0% 10 20 30 40 50 60 70 80 90 100%\n"
"L2:|----|----|----|----|----|----|----|----|----|----|\n"
"L3:" ) );
for( int i = 0; i < n; ++i )
{
std::size_t m1 = os.str().size();
++pd;
std::size_t m2 = os.str().size();
BOOST_TEST_LE( m1, m2 );
}
BOOST_TEST_EQ( os.str(), std::string(
"L1:0% 10 20 30 40 50 60 70 80 90 100%\n"
"L2:|----|----|----|----|----|----|----|----|----|----|\n"
"L3:***************************************************\n" ) );
return boost::report_errors();
}