mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 13:41:47 +00:00
path_times initial commit
[SVN r82916]
This commit is contained in:
parent
15491b6fcf
commit
e613187a30
@ -112,6 +112,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "macro_default_test", "macro
|
||||
{2C1770A4-4AC3-4102-9D36-E652DBB686D8} = {2C1770A4-4AC3-4102-9D36-E652DBB686D8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_timings", "path_timings\path_timings.vcxproj", "{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
|
||||
{FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -230,6 +236,10 @@ Global
|
||||
{36E2032D-F9E6-4FBA-9630-3D4AC518DC6C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{36E2032D-F9E6-4FBA-9630-3D4AC518DC6C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{36E2032D-F9E6-4FBA-9630-3D4AC518DC6C}.Release|Win32.Build.0 = Release|Win32
|
||||
{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
96
test/msvc10/path_timings/path_timings.vcxproj
Normal file
96
test/msvc10/path_timings/path_timings.vcxproj
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.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>{3AB1E2A1-9616-4E91-83F4-1D7A33A586DE}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>path_timings</RootNamespace>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</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>
|
||||
<ExecutablePath>C:\boost\trunk-git-svn\lib;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<ExecutablePath>C:\boost\trunk-git-svn\lib;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;BOOST_SYSTEM_NO_LIB;BOOST_FILESYSTEM_NO_LIB;BOOST_ALL_DYN_LINK;_UNICODE;UNICODE</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>C:\boost\trunk-git-svn\bin.v2\libs\timer\build\msvc-10.0express\debug\threading-multi;C:\boost\trunk-git-svn\bin.v2\libs\system\build\msvc-10.0express\debug\threading-multi;C:\boost\trunk-git-svn\bin.v2\libs\chrono\build\msvc-10.0express\debug\threading-multi;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;BOOST_SYSTEM_NO_LIB;BOOST_FILESYSTEM_NO_LIB;BOOST_ALL_DYN_LINK;_UNICODE;UNICODE;WIN32;NDEBUG;_CONSOLE</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>C:\boost\trunk-git-svn\bin.v2\libs\chrono\build\msvc-10.0express\release\threading-multi;C:\boost\trunk-git-svn\bin.v2\libs\system\build\msvc-10.0express\release\threading-multi;C:\boost\trunk-git-svn\bin.v2\libs\timer\build\msvc-10.0express\release\threading-multi;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\path_times.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj">
|
||||
<Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\system_dll\system_dll.vcxproj">
|
||||
<Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
84
test/path_times.cpp
Normal file
84
test/path_times.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
// Boost Filesystem path_times.cpp ---------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2013
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// Library home page: http://www.boost.org/libs/filesystem
|
||||
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
|
||||
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
# define BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
#endif
|
||||
#ifndef BOOST_SYSTEM_NO_DEPRECATED
|
||||
# define BOOST_SYSTEM_NO_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
# if defined( BOOST_NO_STD_WSTRING )
|
||||
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
|
||||
# endif
|
||||
|
||||
#define BOOST_LIGHTWEIGHT_MAIN
|
||||
#ifndef BOOST_LIGHTWEIGHT_MAIN
|
||||
# include <boost/test/prg_exec_monitor.hpp>
|
||||
#else
|
||||
# include <boost/detail/lightweight_main.hpp>
|
||||
#endif
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
namespace
|
||||
{
|
||||
template <class STD_STRING>
|
||||
boost::int64_t time_ctor(const STD_STRING& s)
|
||||
{
|
||||
boost::timer::nanosecond_type timeout(1000000000);
|
||||
// typename STD_STRING::size_type len(0);
|
||||
boost::timer::auto_cpu_timer tmr;
|
||||
boost::int64_t count = 0;
|
||||
do
|
||||
{
|
||||
fs::path p(s);
|
||||
// len += p.native().size();
|
||||
++count;
|
||||
} while (tmr.elapsed().user < timeout);
|
||||
|
||||
// cout << " len = " << len << endl;
|
||||
cout << " count = " << count << endl;
|
||||
return count;
|
||||
}
|
||||
} // unnamed namespace
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// main //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
int cpp_main(int argc, char* argv[])
|
||||
{
|
||||
cout << "time_ctor with string" << endl;
|
||||
boost::int64_t s = time_ctor(std::string("/foo/bar/baz"));
|
||||
|
||||
cout << "time_ctor with wstring" << endl;
|
||||
boost::int64_t w = time_ctor(std::wstring(L"/foo/bar/baz"));
|
||||
|
||||
if (s > w)
|
||||
cout << "narrow/wide ratio = " << long double(s)/w << endl;
|
||||
else
|
||||
cout << "wide/narrow ratio = " << long double(w)/s << endl;
|
||||
|
||||
cout << "returning from main()" << endl;
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user