win port for c and cpp perf tests

This commit is contained in:
unknown 2009-09-08 11:30:49 +02:00
parent b71c3005e6
commit ec6822a477
25 changed files with 1702 additions and 75 deletions

View File

@ -26,7 +26,7 @@ extern "C" {
#include <stddef.h>
#if defined MSC_VER && defined ZMQ_BUILDING_LIBZMQ
#if defined ZMQ_BUILDING_LIBZMQ_WITH_MSVC
#define ZMQ_EXPORT __declspec(dllexport)
#else
#define ZMQ_EXPORT
@ -199,6 +199,12 @@ ZMQ_EXPORT int zmq_flush (void *s);
// ENOTSUP - function isn't supported by particular socket type.
ZMQ_EXPORT int zmq_recv (void *s, struct zmq_msg_t *msg, int flags);
// Helper functions used by perf tests so that they don't have to care
// about minutiae of time-related functions on different OS platforms.
ZMQ_EXPORT void *zmq_stopwatch_start ();
ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_);
ZMQ_EXPORT void zmq_sleep (int seconds_);
#ifdef __cplusplus
}
#endif

View File

@ -48,7 +48,14 @@ namespace zmq
virtual const char *what () const throw ()
{
#if defined _MSC_VER
#pragma warning (push)
#pragma warning (disable:4996)
#endif
return strerror (errnum);
#if defined _MSC_VER
#pragma warning (pop)
#endif
}
private:

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="c_local_lat"
ProjectGUID="{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}"
RootNamespace="c_local_lat"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/local_lat.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/local_lat.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\c\local_lat.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="c_local_thr"
ProjectGUID="{8EF2DF6B-6646-460F-8032-913B70FE0E94}"
RootNamespace="c_local_thr"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/local_thr.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/local_thr.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\c\local_thr.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="c_remote_lat"
ProjectGUID="{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}"
RootNamespace="c_remote_lat"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/remote_lat.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/remote_lat.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\c\remote_lat.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="c_remote_thr"
ProjectGUID="{B15E059C-0CBB-4A82-8C42-6567FB650802}"
RootNamespace="c_remote_thr"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/remote_thr.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/c/remote_thr.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\c\remote_thr.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="cpp_local_lat"
ProjectGUID="{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}"
RootNamespace="cpp_local_lat"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c;../../cpp"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/local_lat.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c;../../cpp"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/local_lat.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\cpp\local_lat.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="cpp_local_thr"
ProjectGUID="{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}"
RootNamespace="cpp_local_thr"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c;../../cpp"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/local_thr.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c;../../cpp"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/local_thr.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\cpp\local_thr.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="cpp_remote_lat"
ProjectGUID="{123F35E4-CB95-472F-93DE-0F7624E63705}"
RootNamespace="cpp_remote_lat"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c;../../cpp"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/remote_lat.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c;../../cpp"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/remote_lat.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\cpp\remote_lat.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="cpp_remote_thr"
ProjectGUID="{EB051624-35C2-4B51-B5DD-8734372617A7}"
RootNamespace="cpp_remote_thr"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../c;../../cpp"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/remote_thr.exe"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../c;../../cpp"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../perf/cpp/remote_thr.exe"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\perf\cpp\remote_thr.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -19,7 +19,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
@ -40,6 +40,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="-DZMQ_BUILDING_LIBZMQ_WITH_MSVC"
Optimization="0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -58,6 +59,8 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Ws2_32.lib Rpcrt4.lib"
OutputFile="../../lib/libzmq.dll"
GenerateDebugInformation="true"
TargetMachine="1"
/>
@ -87,7 +90,7 @@
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
@ -109,6 +112,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="-DZMQ_BUILDING_LIBZMQ_WITH_MSVC"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
@ -127,6 +131,8 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Ws2_32.lib Rpcrt4.lib"
OutputFile="../../lib/libzmq.dll"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"

View File

@ -3,6 +3,46 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzmq", "libzmq\libzmq.vcproj", "{641C5F36-32EE-4323-B740-992B651CF9D6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c_local_lat", "c_local_lat\c_local_lat.vcproj", "{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c_remote_lat", "c_remote_lat\c_remote_lat.vcproj", "{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c_local_thr", "c_local_thr\c_local_thr.vcproj", "{8EF2DF6B-6646-460F-8032-913B70FE0E94}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c_remote_thr", "c_remote_thr\c_remote_thr.vcproj", "{B15E059C-0CBB-4A82-8C42-6567FB650802}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp_local_lat", "cpp_local_lat\cpp_local_lat.vcproj", "{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp_remote_lat", "cpp_remote_lat\cpp_remote_lat.vcproj", "{123F35E4-CB95-472F-93DE-0F7624E63705}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp_local_thr", "cpp_local_thr\cpp_local_thr.vcproj", "{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp_remote_thr", "cpp_remote_thr\cpp_remote_thr.vcproj", "{EB051624-35C2-4B51-B5DD-8734372617A7}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -13,6 +53,38 @@ Global
{641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.Build.0 = Debug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.ActiveCfg = Release|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.Build.0 = Release|Win32
{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}.Debug|Win32.ActiveCfg = Debug|Win32
{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}.Debug|Win32.Build.0 = Debug|Win32
{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}.Release|Win32.ActiveCfg = Release|Win32
{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}.Release|Win32.Build.0 = Release|Win32
{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}.Debug|Win32.ActiveCfg = Debug|Win32
{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}.Debug|Win32.Build.0 = Debug|Win32
{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}.Release|Win32.ActiveCfg = Release|Win32
{9C20A37C-5D9F-4C4C-A2D9-E6EE91A077D1}.Release|Win32.Build.0 = Release|Win32
{8EF2DF6B-6646-460F-8032-913B70FE0E94}.Debug|Win32.ActiveCfg = Debug|Win32
{8EF2DF6B-6646-460F-8032-913B70FE0E94}.Debug|Win32.Build.0 = Debug|Win32
{8EF2DF6B-6646-460F-8032-913B70FE0E94}.Release|Win32.ActiveCfg = Release|Win32
{8EF2DF6B-6646-460F-8032-913B70FE0E94}.Release|Win32.Build.0 = Release|Win32
{B15E059C-0CBB-4A82-8C42-6567FB650802}.Debug|Win32.ActiveCfg = Debug|Win32
{B15E059C-0CBB-4A82-8C42-6567FB650802}.Debug|Win32.Build.0 = Debug|Win32
{B15E059C-0CBB-4A82-8C42-6567FB650802}.Release|Win32.ActiveCfg = Release|Win32
{B15E059C-0CBB-4A82-8C42-6567FB650802}.Release|Win32.Build.0 = Release|Win32
{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}.Debug|Win32.ActiveCfg = Debug|Win32
{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}.Debug|Win32.Build.0 = Debug|Win32
{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}.Release|Win32.ActiveCfg = Release|Win32
{4F6EA424-54BA-4CD6-BD91-8465DB230D3A}.Release|Win32.Build.0 = Release|Win32
{123F35E4-CB95-472F-93DE-0F7624E63705}.Debug|Win32.ActiveCfg = Debug|Win32
{123F35E4-CB95-472F-93DE-0F7624E63705}.Debug|Win32.Build.0 = Debug|Win32
{123F35E4-CB95-472F-93DE-0F7624E63705}.Release|Win32.ActiveCfg = Release|Win32
{123F35E4-CB95-472F-93DE-0F7624E63705}.Release|Win32.Build.0 = Release|Win32
{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}.Debug|Win32.ActiveCfg = Debug|Win32
{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}.Debug|Win32.Build.0 = Debug|Win32
{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}.Release|Win32.ActiveCfg = Release|Win32
{3BC53F9B-655A-41A4-BD57-F7AB94ED3E09}.Release|Win32.Build.0 = Release|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Debug|Win32.ActiveCfg = Debug|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Debug|Win32.Build.0 = Debug|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Release|Win32.ActiveCfg = Release|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -20,7 +20,6 @@
#include <zmq.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
int main (int argc, char *argv [])
@ -66,7 +65,7 @@ int main (int argc, char *argv [])
rc = zmq_msg_close (&msg);
assert (rc == 0);
sleep (1);
zmq_sleep (1);
rc = zmq_close (s);
assert (rc == 0);

View File

@ -21,8 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
#include <sys/time.h>
int main (int argc, char *argv [])
{
@ -34,10 +32,9 @@ int main (int argc, char *argv [])
int rc;
int i;
struct zmq_msg_t msg;
struct timeval start;
struct timeval end;
uint64_t elapsed;
uint64_t throughput;
void *watch;
unsigned long elapsed;
unsigned long throughput;
double megabits;
if (argc != 4) {
@ -64,8 +61,7 @@ int main (int argc, char *argv [])
assert (rc == 0);
assert (zmq_msg_size (&msg) == message_size);
rc = gettimeofday (&start, NULL);
assert (rc == 0);
watch = zmq_stopwatch_start ();
for (i = 0; i != message_count - 1; i++) {
rc = zmq_recv (s, &msg, 0);
@ -73,17 +69,11 @@ int main (int argc, char *argv [])
assert (zmq_msg_size (&msg) == message_size);
}
rc = gettimeofday (&end, NULL);
assert (rc == 0);
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
elapsed = zmq_stopwatch_stop (watch);
if (elapsed == 0)
elapsed = 1;
throughput = (uint64_t) message_count * 1000000 / elapsed;
throughput = (double) message_count / (double) elapsed * 1000000;
megabits = (double) (throughput * message_size * 8) / 1000000;
printf ("message size: %d [B]\n", (int) message_size);

View File

@ -21,7 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/time.h>
int main (int argc, char *argv [])
{
@ -33,9 +32,8 @@ int main (int argc, char *argv [])
int rc;
int i;
struct zmq_msg_t msg;
struct timeval start;
struct timeval end;
double elapsed;
void *watch;
unsigned long elapsed;
double latency;
if (argc != 4) {
@ -56,8 +54,7 @@ int main (int argc, char *argv [])
rc = zmq_connect (s, connect_to);
assert (rc == 0);
rc = gettimeofday (&start, NULL);
assert (rc == 0);
watch = zmq_stopwatch_start ();
rc = zmq_msg_init_size (&msg, message_size);
assert (rc == 0);
@ -73,15 +70,9 @@ int main (int argc, char *argv [])
rc = zmq_msg_close (&msg);
assert (rc == 0);
rc = gettimeofday (&end, NULL);
assert (rc == 0);
elapsed = zmq_stopwatch_stop (watch);
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
elapsed = (end.tv_sec * 1000000 + end.tv_usec) -
(start.tv_sec * 1000000 + start.tv_usec);
latency = elapsed / (roundtrip_count * 2);
latency = (double) elapsed / (roundtrip_count * 2);
printf ("message size: %d [B]\n", (int) message_size);
printf ("roundtrip count: %d\n", (int) roundtrip_count);

View File

@ -20,7 +20,6 @@
#include <zmq.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
int main (int argc, char *argv [])
@ -61,7 +60,7 @@ int main (int argc, char *argv [])
assert (rc == 0);
}
sleep (10);
zmq_sleep (10);
rc = zmq_close (s);
assert (rc == 0);

View File

@ -20,7 +20,6 @@
#include <zmq.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <stddef.h>
@ -47,7 +46,7 @@ int main (int argc, char *argv [])
s.send (msg);
}
sleep (1);
zmq_sleep (1);
return 0;
}

View File

@ -22,8 +22,6 @@
#include <stdlib.h>
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/time.h>
int main (int argc, char *argv [])
{
@ -45,27 +43,17 @@ int main (int argc, char *argv [])
s.recv (&msg);
assert (msg.size () == message_size);
timeval start;
int rc = gettimeofday (&start, NULL);
assert (rc == 0);
void *watch = zmq_stopwatch_start ();
for (int i = 1; i != message_count; i++) {
s.recv (&msg);
assert (msg.size () == message_size);
}
timeval end;
rc = gettimeofday (&end, NULL);
assert (rc == 0);
unsigned long elapsed = zmq_stopwatch_stop (watch);
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
uint64_t elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
if (elapsed == 0)
elapsed = 1;
uint64_t throughput = (uint64_t) message_count * 1000000 / elapsed;
unsigned long throughput = (unsigned long)
((double) message_count / (double) elapsed * 1000000);
double megabits = (double) (throughput * message_size * 8) / 1000000;
printf ("message size: %d [B]\n", (int) message_size);

View File

@ -22,7 +22,6 @@
#include <stdlib.h>
#include <assert.h>
#include <stddef.h>
#include <sys/time.h>
int main (int argc, char *argv [])
{
@ -40,9 +39,7 @@ int main (int argc, char *argv [])
zmq::socket_t s (ctx, ZMQ_REQ);
s.connect (connect_to);
timeval start;
int rc = gettimeofday (&start, NULL);
assert (rc == 0);
void *watch = zmq_stopwatch_start ();
for (int i = 0; i != roundtrip_count; i++) {
zmq::message_t msg (message_size);
@ -51,16 +48,9 @@ int main (int argc, char *argv [])
assert (msg.size () == message_size);
}
timeval end;
rc = gettimeofday (&end, NULL);
assert (rc == 0);
unsigned long elapsed = zmq_stopwatch_stop (watch);
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
double elapsed = (end.tv_sec * 1000000 + end.tv_usec) -
(start.tv_sec * 1000000 + start.tv_usec);
double latency = elapsed / (roundtrip_count * 2);
double latency = (double) elapsed / (roundtrip_count * 2);
printf ("message size: %d [B]\n", (int) message_size);
printf ("roundtrip count: %d\n", (int) roundtrip_count);

View File

@ -20,7 +20,6 @@
#include <zmq.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <stddef.h>
@ -45,7 +44,7 @@ int main (int argc, char *argv [])
s.send (msg);
}
sleep (10);
zmq_sleep (10);
return 0;
}

View File

@ -151,7 +151,7 @@ zmq::fd_signaler_t::signals_t zmq::fd_signaler_t::check ()
signals_t signals = 0;
for (int pos = 0; pos != nbytes; pos++) {
zmq_assert (buffer [pos] < 64);
signals |= (1 << (buffer [pos]));
signals |= (signals_t (1) << (buffer [pos]));
}
return signals;
}

View File

@ -98,7 +98,23 @@ zmq::fd_t zmq::tcp_connecter_t::get_fd ()
return s;
}
// connect
zmq::fd_t zmq::tcp_connecter_t::connect ()
{
// Nonblocking connect have finished. Check whether an error occured.
int err = 0;
socklen_t len = sizeof err;
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
zmq_assert (rc == 0);
if (err != 0) {
errno = err;
return retired_fd;
}
// Return the newly connected socket.
fd_t result = s;
s = retired_fd;
return result;
}
#else

View File

@ -27,7 +27,94 @@
#ifdef ZMQ_HAVE_WINDOWS
#error
zmq::tcp_listener_t::tcp_listener_t () :
s (retired_fd)
{
memset (&addr, 0, sizeof (addr));
}
zmq::tcp_listener_t::~tcp_listener_t ()
{
if (s != retired_fd)
close ();
}
int zmq::tcp_listener_t::set_address (const char *addr_)
{
// Convert the interface into sockaddr_in structure.
int rc = resolve_ip_interface (&addr, addr_);
if (rc != 0)
return rc;
// Create a listening socket.
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
// TODO: Convert error code to errno.
wsa_assert (s != INVALID_SOCKET);
// Allow reusing of the address.
int flag = 1;
rc = setsockopt (s, SOL_SOCKET, SO_REUSEADDR,
(const char*) &flag, sizeof (int));
wsa_assert (rc != SOCKET_ERROR);
// Set the non-blocking flag.
flag = 1;
rc = ioctlsocket (s, FIONBIO, (u_long*) &flag);
wsa_assert (rc != SOCKET_ERROR);
// Bind the socket to the network interface and port.
rc = bind (s, (struct sockaddr*) &addr, sizeof (addr));
// TODO: Convert error code to errno.
wsa_assert (rc != SOCKET_ERROR);
// Listen for incomming connections.
rc = listen (s, 1);
// TODO: Convert error code to errno.
wsa_assert (rc != SOCKET_ERROR);
return 0;
}
int zmq::tcp_listener_t::close ()
{
zmq_assert (s != retired_fd);
int rc = closesocket (s);
wsa_assert (rc != SOCKET_ERROR);
s = retired_fd;
return 0;
}
zmq::fd_t zmq::tcp_listener_t::get_fd ()
{
return s;
}
zmq::fd_t zmq::tcp_listener_t::accept ()
{
zmq_assert (s != retired_fd);
// Accept one incoming connection.
fd_t sock = ::accept (s, NULL, NULL);
if (sock == INVALID_SOCKET &&
(WSAGetLastError () == WSAEWOULDBLOCK ||
WSAGetLastError () == WSAECONNRESET))
return retired_fd;
zmq_assert (sock != INVALID_SOCKET);
// Set to non-blocking mode.
unsigned long argp = 1;
int rc = ioctlsocket (sock, FIONBIO, &argp);
wsa_assert (rc != SOCKET_ERROR);
// Disable Nagle's algorithm.
int flag = 1;
rc = setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, (char*) &flag,
sizeof (int));
wsa_assert (rc != SOCKET_ERROR);
return sock;
}
#else

View File

@ -50,6 +50,11 @@ int zmq::tcp_socket_t::close ()
return 0;
}
zmq::fd_t zmq::tcp_socket_t::get_fd ()
{
return s;
}
int zmq::tcp_socket_t::write (const void *data, int size)
{
int nbytes = send (s, (char*) data, size, 0);

View File

@ -27,6 +27,13 @@
#include "err.hpp"
#include "dispatcher.hpp"
#include "msg_content.hpp"
#include "platform.hpp"
#include "stdint.hpp"
#if !defined ZMQ_HAVE_WINDOWS
#include <unistd.h>
#include <sys/time.h>
#endif
int zmq_msg_init (zmq_msg_t *msg_)
{
@ -39,7 +46,7 @@ int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_)
{
if (size_ <= ZMQ_MAX_VSM_SIZE) {
msg_->content = (zmq::msg_content_t*) ZMQ_VSM;
msg_->vsm_size = (uint16_t) size_;
msg_->vsm_size = (uint8_t) size_;
}
else {
msg_->content =
@ -228,3 +235,61 @@ int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_)
{
return (((zmq::socket_base_t*) s_)->recv (msg_, flags_));
}
#if defined ZMQ_HAVE_WINDOWS
static uint64_t now ()
{
// Get the high resolution counter's accuracy.
LARGE_INTEGER ticksPerSecond;
QueryPerformanceFrequency (&ticksPerSecond);
// What time is it?
LARGE_INTEGER tick;
QueryPerformanceCounter (&tick);
// Convert the tick number into the number of seconds
// since the system was started.
double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000);
return (uint64_t) (tick.QuadPart / ticks_div);
}
void zmq_sleep (int seconds_)
{
Sleep (seconds_ * 1000);
}
#else
static uint64_t now ()
{
struct timeval tv;
int rc;
rc = gettimeofday (&tv, NULL);
assert (rc == 0);
return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec);
}
void zmq_sleep (int seconds_)
{
sleep (seconds_);
}
#endif
void *zmq_stopwatch_start ()
{
uint64_t *watch = (uint64_t*) malloc (sizeof (uint64_t));
zmq_assert (watch);
*watch = now ();
return (void*) watch;
}
unsigned long zmq_stopwatch_stop (void *watch_)
{
uint64_t end = now ();
uint64_t start = *(uint64_t*) watch_;
free (watch_);
return (unsigned long) (end - start);
}