diff options
author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2017-04-17 15:45:49 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2017-04-17 15:45:49 -0700 |
commit | d8f5cfdee4665451960505d375bd7a20fb0d6f04 (patch) | |
tree | 627307e4cbb9e1023cfbc88e454def41f693f07d | |
parent | 95e5345cc37316c264c8d3d732d324c60f18ab72 (diff) | |
download | infinitytier-d8f5cfdee4665451960505d375bd7a20fb0d6f04.tar.gz infinitytier-d8f5cfdee4665451960505d375bd7a20fb0d6f04.zip |
Windows profile build target (CPU profiling), and a little bit of optimization revealed by such.
-rw-r--r-- | node/Poly1305.cpp | 21 | ||||
-rw-r--r-- | windows/ZeroTierOne.sln | 31 | ||||
-rw-r--r-- | windows/ZeroTierOne/ZeroTierOne.vcxproj | 74 | ||||
-rw-r--r-- | windows/ZeroTierOne/ZeroTierOne.vcxproj.filters | 3 |
4 files changed, 121 insertions, 8 deletions
diff --git a/node/Poly1305.cpp b/node/Poly1305.cpp index b78071f6..13d4712d 100644 --- a/node/Poly1305.cpp +++ b/node/Poly1305.cpp @@ -135,11 +135,12 @@ typedef struct poly1305_context { unsigned char opaque[136]; } poly1305_context; -#if (defined(_MSC_VER) || defined(__GNUC__)) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__)) +#if (defined(_MSC_VER) || defined(__GNUC__)) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64)) ////////////////////////////////////////////////////////////////////////////// // 128-bit implementation for MSC and GCC from Poly1305-donna + #if defined(_MSC_VER) #include <intrin.h> @@ -183,9 +184,9 @@ typedef struct poly1305_state_internal_t { unsigned char final; } poly1305_state_internal_t; -/* interpret eight 8 bit unsigned integers as a 64 bit unsigned integer in little endian */ -static inline unsigned long long -U8TO64(const unsigned char *p) { +#if defined(ZT_NO_TYPE_PUNNING) || (__BYTE_ORDER != __LITTLE_ENDIAN) +static inline unsigned long long U8TO64(const unsigned char *p) +{ return (((unsigned long long)(p[0] & 0xff) ) | ((unsigned long long)(p[1] & 0xff) << 8) | @@ -196,10 +197,13 @@ U8TO64(const unsigned char *p) { ((unsigned long long)(p[6] & 0xff) << 48) | ((unsigned long long)(p[7] & 0xff) << 56)); } +#else +#define U8TO64(p) (*reinterpret_cast<const unsigned long long *>(p)) +#endif -/* store a 64 bit unsigned integer as eight 8 bit unsigned integers in little endian */ -static inline void -U64TO8(unsigned char *p, unsigned long long v) { +#if defined(ZT_NO_TYPE_PUNNING) || (__BYTE_ORDER != __LITTLE_ENDIAN) +static inline void U64TO8(unsigned char *p, unsigned long long v) +{ p[0] = (v ) & 0xff; p[1] = (v >> 8) & 0xff; p[2] = (v >> 16) & 0xff; @@ -209,6 +213,9 @@ U64TO8(unsigned char *p, unsigned long long v) { p[6] = (v >> 48) & 0xff; p[7] = (v >> 56) & 0xff; } +#else +#define U64TO8(p,v) ((*reinterpret_cast<unsigned long long *>(p)) = (v)) +#endif static inline void poly1305_init(poly1305_context *ctx, const unsigned char key[32]) { diff --git a/windows/ZeroTierOne.sln b/windows/ZeroTierOne.sln index 9baadd81..05f498fb 100644 --- a/windows/ZeroTierOne.sln +++ b/windows/ZeroTierOne.sln @@ -28,6 +28,10 @@ Global DVD-5|Mixed Platforms = DVD-5|Mixed Platforms DVD-5|Win32 = DVD-5|Win32 DVD-5|x64 = DVD-5|x64 + Profile|Any CPU = Profile|Any CPU + Profile|Mixed Platforms = Profile|Mixed Platforms + Profile|Win32 = Profile|Win32 + Profile|x64 = Profile|x64 Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 @@ -91,6 +95,13 @@ Global {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.DVD-5|x64.ActiveCfg = Debug|x64 {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.DVD-5|x64.Build.0 = Debug|x64 {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.DVD-5|x64.Deploy.0 = Debug|x64 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|Any CPU.ActiveCfg = Profile|Win32 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|Mixed Platforms.ActiveCfg = Profile|Win32 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|Mixed Platforms.Build.0 = Profile|Win32 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|Win32.ActiveCfg = Profile|Win32 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|Win32.Build.0 = Profile|Win32 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|x64.ActiveCfg = Profile|x64 + {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Profile|x64.Build.0 = Profile|x64 {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Release|Any CPU.ActiveCfg = Release|Win32 {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {B00A4957-5977-4AC1-9EF4-571DC27EADA2}.Release|Mixed Platforms.Build.0 = Release|Win32 @@ -189,6 +200,10 @@ Global {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.DVD-5|x64.ActiveCfg = Win8 Release|x64 {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.DVD-5|x64.Build.0 = Win8 Release|x64 {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.DVD-5|x64.Deploy.0 = Win8 Release|x64 + {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Profile|Any CPU.ActiveCfg = Win8 Debug|x64 + {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Profile|Mixed Platforms.ActiveCfg = Win8 Debug|Win32 + {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Profile|Win32.ActiveCfg = Win8 Debug|Win32 + {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Profile|x64.ActiveCfg = Win8 Debug|x64 {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Release|Any CPU.ActiveCfg = Win8 Release|Win32 {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Release|Mixed Platforms.ActiveCfg = Win8 Release|Win32 {43BA7584-D4DB-4F7C-90FC-E2B18A68A213}.Release|Mixed Platforms.Build.0 = Win8 Release|Win32 @@ -287,6 +302,14 @@ Global {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.DVD-5|Mixed Platforms.Build.0 = Debug|Any CPU {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.DVD-5|Win32.ActiveCfg = Debug|Any CPU {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.DVD-5|x64.ActiveCfg = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Any CPU.ActiveCfg = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Any CPU.Build.0 = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Mixed Platforms.Build.0 = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Win32.ActiveCfg = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|Win32.Build.0 = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|x64.ActiveCfg = Debug|Any CPU + {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Profile|x64.Build.0 = Debug|Any CPU {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Release|Any CPU.ActiveCfg = Release|Any CPU {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Release|Any CPU.Build.0 = Release|Any CPU {4CCA6B98-5E64-45BF-AC34-19B3E2570DB1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -361,6 +384,14 @@ Global {6D27214A-087B-4484-B898-AD2A13FA3B9E}.DVD-5|Win32.Build.0 = Debug|Any CPU {6D27214A-087B-4484-B898-AD2A13FA3B9E}.DVD-5|x64.ActiveCfg = Debug|Any CPU {6D27214A-087B-4484-B898-AD2A13FA3B9E}.DVD-5|x64.Build.0 = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Any CPU.ActiveCfg = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Any CPU.Build.0 = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Mixed Platforms.Build.0 = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Win32.ActiveCfg = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|Win32.Build.0 = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|x64.ActiveCfg = Debug|Any CPU + {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Profile|x64.Build.0 = Debug|Any CPU {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Release|Any CPU.Build.0 = Release|Any CPU {6D27214A-087B-4484-B898-AD2A13FA3B9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj b/windows/ZeroTierOne/ZeroTierOne.vcxproj index 32d7fa4a..84a44198 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj @@ -9,6 +9,14 @@ <Configuration>Debug</Configuration> <Platform>x64</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Profile|Win32"> + <Configuration>Profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Profile|x64"> + <Configuration>Profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> @@ -66,6 +74,7 @@ <ClCompile Include="..\..\node\Utils.cpp" /> <ClCompile Include="..\..\one.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">false</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\..\osdep\Http.cpp" /> <ClCompile Include="..\..\osdep\ManagedRoute.cpp" /> @@ -113,6 +122,7 @@ <ClInclude Include="..\..\node\Cluster.hpp" /> <ClInclude Include="..\..\node\CMWC4096.hpp" /> <ClInclude Include="..\..\node\Constants.hpp" /> + <ClInclude Include="..\..\node\Credential.hpp" /> <ClInclude Include="..\..\node\DeferredPackets.hpp" /> <ClInclude Include="..\..\node\Dictionary.hpp" /> <ClInclude Include="..\..\node\Hashtable.hpp" /> @@ -172,12 +182,24 @@ <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> @@ -198,9 +220,15 @@ <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" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </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" /> </ImportGroup> @@ -213,6 +241,11 @@ <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> <TargetName>zerotier-one_x86</TargetName> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'"> + <TargetExt>.exe</TargetExt> + <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> + <TargetName>zerotier-one_x86</TargetName> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <TargetExt>.exe</TargetExt> <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> @@ -223,6 +256,11 @@ <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> <TargetName>zerotier-one_x64</TargetName> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'"> + <TargetExt>.exe</TargetExt> + <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> + <TargetName>zerotier-one_x64</TargetName> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <TargetExt>.exe</TargetExt> <OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir> @@ -244,6 +282,22 @@ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <PreprocessorDefinitions>NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <WarningLevel>Level3</WarningLevel> @@ -262,6 +316,24 @@ <AdditionalOptions>"notelemetry.obj" %(AdditionalOptions)</AdditionalOptions> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <AdditionalIncludeDirectories> + </AdditionalIncludeDirectories> + <PreprocessorDefinitions>NOMINMAX;STATICLIB;WIN32;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MultiProcessorCompilation>false</MultiProcessorCompilation> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalOptions>"notelemetry.obj" %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> @@ -291,7 +363,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> + <Optimization>Full</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters index ca1640e9..b051b4f7 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters @@ -482,6 +482,9 @@ <ClInclude Include="..\..\node\CertificateOfOwnership.hpp"> <Filter>Header Files\node</Filter> </ClInclude> + <ClInclude Include="..\..\node\Credential.hpp"> + <Filter>Header Files\node</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ResourceCompile Include="ZeroTierOne.rc"> |