diff options
author | Halil İbrahim Kalkan <hi_kalkan@yahoo.com> | 2013-04-08 21:44:58 +0300 |
---|---|---|
committer | Halil İbrahim Kalkan <hi_kalkan@yahoo.com> | 2013-04-08 21:44:58 +0300 |
commit | 79953cb56cda204f190ffcd9995b27ebea25e62d (patch) | |
tree | de939755c2e32eaa5fa3e41e21114e1c727ed0a4 /performance-tests | |
parent | 934c543eb6b0bd7173038e45a7dac0241d091da4 (diff) | |
download | scs-79953cb56cda204f190ffcd9995b27ebea25e62d.zip scs-79953cb56cda204f190ffcd9995b27ebea25e62d.tar.gz scs-79953cb56cda204f190ffcd9995b27ebea25e62d.tar.bz2 |
Adding to github
Adding to github
Diffstat (limited to 'performance-tests')
33 files changed, 1342 insertions, 0 deletions
diff --git a/performance-tests/Messaging/ClientApp/ClientApp.csproj b/performance-tests/Messaging/ClientApp/ClientApp.csproj new file mode 100644 index 0000000..f34a440 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/ClientApp.csproj @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ClientApp</RootNamespace> + <AssemblyName>ClientApp</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkProfile>Client</TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="DuplexClientCustomProtocolSynchronized.cs" /> + <Compile Include="DuplexClientDefaultProtocolSynchronized.cs" /> + <Compile Include="DuplexClientDefaultProtocol.cs" /> + <Compile Include="OneWayClientDefaultProtocol.cs" /> + <Compile Include="DuplexClientCustomProtocol.cs" /> + <Compile Include="OneWayClientCustomProtocol.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\CommonLib\CommonLib.csproj"> + <Project>{7F7D3248-4432-4E7B-9CFD-25982668AD5B}</Project> + <Name>CommonLib</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocol.cs b/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocol.cs new file mode 100644 index 0000000..016e6c6 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocol.cs @@ -0,0 +1,52 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; + +namespace ClientApp +{ + class DuplexClientCustomProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + client.WireProtocol = new MyWireProtocol(); //Set custom wire protocol! + client.MessageReceived += client_MessageReceived; + + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + client.SendMessage(new ScsTextMessage("Hello from client!")); + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + + static void client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocolSynchronized.cs b/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocolSynchronized.cs new file mode 100644 index 0000000..007fd63 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/DuplexClientCustomProtocolSynchronized.cs @@ -0,0 +1,37 @@ +using System; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Communication.Messengers; + +namespace ClientApp +{ + class DuplexClientCustomProtocolSynchronized + { + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + client.WireProtocol = new MyWireProtocol(); + using (var synchronizedMessenger = new SynchronizedMessenger<IScsClient>(client)) + { + synchronizedMessenger.Start(); + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + synchronizedMessenger.SendMessage(new ScsTextMessage("Hello from client!")); + var reply = synchronizedMessenger.ReceiveMessage<ScsTextMessage>(); + } + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocol.cs b/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocol.cs new file mode 100644 index 0000000..13a6e40 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocol.cs @@ -0,0 +1,51 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; + +namespace ClientApp +{ + class DuplexClientDefaultProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + client.MessageReceived += client_MessageReceived; + + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + client.SendMessage(new ScsTextMessage("Hello from client!")); + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + + static void client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocolSynchronized.cs b/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocolSynchronized.cs new file mode 100644 index 0000000..33d46ba --- /dev/null +++ b/performance-tests/Messaging/ClientApp/DuplexClientDefaultProtocolSynchronized.cs @@ -0,0 +1,36 @@ +using System; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Communication.Messengers; + +namespace ClientApp +{ + class DuplexClientDefaultProtocolSynchronized + { + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + using (var synchronizedMessenger = new SynchronizedMessenger<IScsClient>(client)) + { + synchronizedMessenger.Start(); + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + synchronizedMessenger.SendMessage(new ScsTextMessage("Hello from client!")); + var reply = synchronizedMessenger.ReceiveMessage<ScsTextMessage>(); + } + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/OneWayClientCustomProtocol.cs b/performance-tests/Messaging/ClientApp/OneWayClientCustomProtocol.cs new file mode 100644 index 0000000..2d83559 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/OneWayClientCustomProtocol.cs @@ -0,0 +1,32 @@ +using System; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; + +namespace ClientApp +{ + class OneWayClientCustomProtocol + { + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + client.WireProtocol = new MyWireProtocol(); + + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + client.SendMessage(new ScsTextMessage("Hello from client!")); + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/OneWayClientDefaultProtocol.cs b/performance-tests/Messaging/ClientApp/OneWayClientDefaultProtocol.cs new file mode 100644 index 0000000..3d7ce3b --- /dev/null +++ b/performance-tests/Messaging/ClientApp/OneWayClientDefaultProtocol.cs @@ -0,0 +1,30 @@ +using System; +using CommonLib; +using Hik.Communication.Scs.Client; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; + +namespace ClientApp +{ + class OneWayClientDefaultProtocol + { + public static void Run() + { + Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages."); + Console.ReadLine(); + + using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033))) + { + client.Connect(); + + for (var i = 0; i < Consts.MessageCount; i++) + { + client.SendMessage(new ScsTextMessage("Hello from client!")); + } + + Console.WriteLine("Press enter to disconnect from server"); + Console.ReadLine(); + } + } + } +} diff --git a/performance-tests/Messaging/ClientApp/Program.cs b/performance-tests/Messaging/ClientApp/Program.cs new file mode 100644 index 0000000..cee869d --- /dev/null +++ b/performance-tests/Messaging/ClientApp/Program.cs @@ -0,0 +1,10 @@ +namespace ClientApp +{ + class Program + { + static void Main() + { + DuplexClientCustomProtocolSynchronized.Run(); + } + } +} diff --git a/performance-tests/Messaging/ClientApp/Properties/AssemblyInfo.cs b/performance-tests/Messaging/ClientApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7b4eed4 --- /dev/null +++ b/performance-tests/Messaging/ClientApp/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ClientApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ClientApp")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a9dbae74-bd80-4551-9ca8-bc212ea55174")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/Messaging/CommonLib/CommonLib.csproj b/performance-tests/Messaging/CommonLib/CommonLib.csproj new file mode 100644 index 0000000..7020b77 --- /dev/null +++ b/performance-tests/Messaging/CommonLib/CommonLib.csproj @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{7F7D3248-4432-4E7B-9CFD-25982668AD5B}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CommonLib</RootNamespace> + <AssemblyName>CommonLib</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Consts.cs" /> + <Compile Include="MyWireProtocol.cs" /> + <Compile Include="MyWireProtocolFactory.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/Messaging/CommonLib/Consts.cs b/performance-tests/Messaging/CommonLib/Consts.cs new file mode 100644 index 0000000..8eb31cf --- /dev/null +++ b/performance-tests/Messaging/CommonLib/Consts.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CommonLib +{ + public class Consts + { + public const int MessageCount = 1000000; + } +} diff --git a/performance-tests/Messaging/CommonLib/MyWireProtocol.cs b/performance-tests/Messaging/CommonLib/MyWireProtocol.cs new file mode 100644 index 0000000..11227f4 --- /dev/null +++ b/performance-tests/Messaging/CommonLib/MyWireProtocol.cs @@ -0,0 +1,32 @@ +using System.Text; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Communication.Protocols.BinarySerialization; + +namespace CommonLib +{ + /// <summary> + /// This class is a sample custom wire protocol to use as wire protocol in SCS framework. + /// It extends BinarySerializationProtocol. + /// It is used just to send/receive ScsTextMessage messages. + /// + /// Since BinarySerializationProtocol automatically writes message length to the beggining + /// of the message, a message format of this class is: + /// + /// [Message length (4 bytes)][UTF-8 encoded text (N bytes)] + /// + /// So, total length of the message = (N + 4) bytes; + /// </summary> + public class MyWireProtocol : BinarySerializationProtocol + { + protected override byte[] SerializeMessage(IScsMessage message) + { + return Encoding.UTF8.GetBytes(((ScsTextMessage)message).Text); + } + + protected override IScsMessage DeserializeMessage(byte[] bytes) + { + //Decode UTF8 encoded text and create a ScsTextMessage object + return new ScsTextMessage(Encoding.UTF8.GetString(bytes)); + } + } +} diff --git a/performance-tests/Messaging/CommonLib/MyWireProtocolFactory.cs b/performance-tests/Messaging/CommonLib/MyWireProtocolFactory.cs new file mode 100644 index 0000000..7f5f1ae --- /dev/null +++ b/performance-tests/Messaging/CommonLib/MyWireProtocolFactory.cs @@ -0,0 +1,12 @@ +using Hik.Communication.Scs.Communication.Protocols; + +namespace CommonLib +{ + public class MyWireProtocolFactory : IScsWireProtocolFactory + { + public IScsWireProtocol CreateWireProtocol() + { + return new MyWireProtocol(); + } + } +} diff --git a/performance-tests/Messaging/CommonLib/Properties/AssemblyInfo.cs b/performance-tests/Messaging/CommonLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8461698 --- /dev/null +++ b/performance-tests/Messaging/CommonLib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CommonLib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CommonLib")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("50d012ed-8149-4bfb-8cb4-0f325628bdf7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/Messaging/ServerApp.sln b/performance-tests/Messaging/ServerApp.sln new file mode 100644 index 0000000..10eed7d --- /dev/null +++ b/performance-tests/Messaging/ServerApp.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerApp", "ServerApp\ServerApp.csproj", "{F515CE95-6A3F-4E5E-867A-899FFFC90D43}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientApp", "ClientApp\ClientApp.csproj", "{8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonLib", "CommonLib\CommonLib.csproj", "{7F7D3248-4432-4E7B-9CFD-25982668AD5B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Debug|Any CPU.ActiveCfg = Debug|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Debug|x86.ActiveCfg = Debug|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Debug|x86.Build.0 = Debug|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Release|Any CPU.ActiveCfg = Release|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Release|Mixed Platforms.Build.0 = Release|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Release|x86.ActiveCfg = Release|x86 + {F515CE95-6A3F-4E5E-867A-899FFFC90D43}.Release|x86.Build.0 = Release|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Debug|Any CPU.ActiveCfg = Debug|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Debug|x86.ActiveCfg = Debug|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Debug|x86.Build.0 = Debug|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Release|Any CPU.ActiveCfg = Release|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Release|Mixed Platforms.Build.0 = Release|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Release|x86.ActiveCfg = Release|x86 + {8D1CD669-49E3-4F7E-98B1-6E4405BEBAD6}.Release|x86.Build.0 = Release|x86 + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Debug|x86.ActiveCfg = Debug|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Release|Any CPU.Build.0 = Release|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {7F7D3248-4432-4E7B-9CFD-25982668AD5B}.Release|x86.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/performance-tests/Messaging/ServerApp/DuplexServerCustomProtocol.cs b/performance-tests/Messaging/ServerApp/DuplexServerCustomProtocol.cs new file mode 100644 index 0000000..88eafd9 --- /dev/null +++ b/performance-tests/Messaging/ServerApp/DuplexServerCustomProtocol.cs @@ -0,0 +1,53 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Server; + +namespace ServerApp +{ + public class DuplexServerCustomProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); + + server.WireProtocolFactory = new MyWireProtocolFactory(); + server.ClientConnected += server_ClientConnected; + + server.Start(); + + Console.WriteLine("Press enter to stop server"); + Console.ReadLine(); + + server.Stop(); + } + + static void server_ClientConnected(object sender, ServerClientEventArgs e) + { + e.Client.MessageReceived += Client_MessageReceived; + } + + static void Client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + + var client = (IScsServerClient) sender; + client.SendMessage(new ScsTextMessage("Hello from server!")); + + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ServerApp/DuplexServerDefaultProtocol.cs b/performance-tests/Messaging/ServerApp/DuplexServerDefaultProtocol.cs new file mode 100644 index 0000000..8fbce3f --- /dev/null +++ b/performance-tests/Messaging/ServerApp/DuplexServerDefaultProtocol.cs @@ -0,0 +1,51 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Server; + +namespace ServerApp +{ + public class DuplexServerDefaultProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); + server.ClientConnected += server_ClientConnected; + + server.Start(); + + Console.WriteLine("Press enter to stop server"); + Console.ReadLine(); + + server.Stop(); + } + + static void server_ClientConnected(object sender, ServerClientEventArgs e) + { + e.Client.MessageReceived += Client_MessageReceived; + } + + static void Client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + + var client = (IScsServerClient) sender; + client.SendMessage(new ScsTextMessage("Hello from server!")); + + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ServerApp/OneWayServerCustomProtocol.cs b/performance-tests/Messaging/ServerApp/OneWayServerCustomProtocol.cs new file mode 100644 index 0000000..eb0da5f --- /dev/null +++ b/performance-tests/Messaging/ServerApp/OneWayServerCustomProtocol.cs @@ -0,0 +1,49 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Server; + +namespace ServerApp +{ + public class OneWayServerCustomProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); + + server.WireProtocolFactory = new MyWireProtocolFactory(); + server.ClientConnected += server_ClientConnected; + + server.Start(); + + Console.WriteLine("Press enter to stop server"); + Console.ReadLine(); + + server.Stop(); + } + + static void server_ClientConnected(object sender, ServerClientEventArgs e) + { + e.Client.MessageReceived += Client_MessageReceived; + } + + static void Client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ServerApp/OneWayServerDefaultProtocol.cs b/performance-tests/Messaging/ServerApp/OneWayServerDefaultProtocol.cs new file mode 100644 index 0000000..fdf5887 --- /dev/null +++ b/performance-tests/Messaging/ServerApp/OneWayServerDefaultProtocol.cs @@ -0,0 +1,47 @@ +using System; +using System.Diagnostics; +using CommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.Scs.Communication.Messages; +using Hik.Communication.Scs.Server; + +namespace ServerApp +{ + public class OneWayServerDefaultProtocol + { + private static int _messageCount; + private static Stopwatch _stopwatch; + + public static void Run() + { + var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); + server.ClientConnected += server_ClientConnected; + + server.Start(); + + Console.WriteLine("Press enter to stop server"); + Console.ReadLine(); + + server.Stop(); + } + + static void server_ClientConnected(object sender, ServerClientEventArgs e) + { + e.Client.MessageReceived += Client_MessageReceived; + } + + static void Client_MessageReceived(object sender, MessageEventArgs e) + { + ++_messageCount; + if (_messageCount == 1) + { + _stopwatch = Stopwatch.StartNew(); + } + else if (_messageCount == Consts.MessageCount) + { + _stopwatch.Stop(); + Console.WriteLine(Consts.MessageCount + " message is received in " + _stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + } + } +} diff --git a/performance-tests/Messaging/ServerApp/Program.cs b/performance-tests/Messaging/ServerApp/Program.cs new file mode 100644 index 0000000..0aab3b5 --- /dev/null +++ b/performance-tests/Messaging/ServerApp/Program.cs @@ -0,0 +1,10 @@ +namespace ServerApp +{ + public class Program + { + static void Main() + { + DuplexServerCustomProtocol.Run(); + } + } +} diff --git a/performance-tests/Messaging/ServerApp/Properties/AssemblyInfo.cs b/performance-tests/Messaging/ServerApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..125c23c --- /dev/null +++ b/performance-tests/Messaging/ServerApp/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ServerApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ServerApp")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bae7ad3a-ea6a-44f7-8429-89f23b17abfe")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/Messaging/ServerApp/ServerApp.csproj b/performance-tests/Messaging/ServerApp/ServerApp.csproj new file mode 100644 index 0000000..f5a6c0f --- /dev/null +++ b/performance-tests/Messaging/ServerApp/ServerApp.csproj @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F515CE95-6A3F-4E5E-867A-899FFFC90D43}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ServerApp</RootNamespace> + <AssemblyName>ServerApp</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkProfile>Client</TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="DuplexServerDefaultProtocol.cs" /> + <Compile Include="OneWayServerCustomProtocol.cs" /> + <Compile Include="DuplexServerCustomProtocol.cs" /> + <Compile Include="OneWayServerDefaultProtocol.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\CommonLib\CommonLib.csproj"> + <Project>{7F7D3248-4432-4E7B-9CFD-25982668AD5B}</Project> + <Name>CommonLib</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/RMI/CalculatorClient/CalculatorClient.csproj b/performance-tests/RMI/CalculatorClient/CalculatorClient.csproj new file mode 100644 index 0000000..d9b1a48 --- /dev/null +++ b/performance-tests/RMI/CalculatorClient/CalculatorClient.csproj @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6DD6F730-E353-4B0C-9655-8370A943A7BF}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CalculatorClient</RootNamespace> + <AssemblyName>CalculatorClient</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkProfile>Client</TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\CalculatorCommonLib\CalculatorCommonLib.csproj"> + <Project>{6F2D58C9-0395-4048-A304-17304D12BC63}</Project> + <Name>CalculatorCommonLib</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/RMI/CalculatorClient/Program.cs b/performance-tests/RMI/CalculatorClient/Program.cs new file mode 100644 index 0000000..2532ea3 --- /dev/null +++ b/performance-tests/RMI/CalculatorClient/Program.cs @@ -0,0 +1,34 @@ +using System; +using CalculatorCommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.ScsServices.Client; +using System.Diagnostics; + +namespace CalculatorClient +{ + class Program + { + static void Main() + { + Console.WriteLine("Press enter to connect to server and call " + Consts.MethodCallCount + " methods..."); + Console.ReadLine(); + + using (var client = ScsServiceClientBuilder.CreateClient<ICalculatorService>(new ScsTcpEndPoint("127.0.0.1", 10083))) + { + client.Connect(); + + var stopwatch = Stopwatch.StartNew(); + for (var i = 0; i < Consts.MethodCallCount; i++) + { + var division = client.ServiceProxy.Add(2, 3); + } + + stopwatch.Stop(); + Console.WriteLine(Consts.MethodCallCount + " remote method call made in " + stopwatch.Elapsed.TotalMilliseconds.ToString("0.000") + " ms."); + } + + Console.WriteLine("Press enter to stop client application"); + Console.ReadLine(); + } + } +} diff --git a/performance-tests/RMI/CalculatorClient/Properties/AssemblyInfo.cs b/performance-tests/RMI/CalculatorClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1c1a455 --- /dev/null +++ b/performance-tests/RMI/CalculatorClient/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CalculatorClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CalculatorClient")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5712ded0-d09a-4e56-8de4-1d9145854ee5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/RMI/CalculatorCommonLib/CalculatorCommonLib.csproj b/performance-tests/RMI/CalculatorCommonLib/CalculatorCommonLib.csproj new file mode 100644 index 0000000..c5ac4f6 --- /dev/null +++ b/performance-tests/RMI/CalculatorCommonLib/CalculatorCommonLib.csproj @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6F2D58C9-0395-4048-A304-17304D12BC63}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CalculatorCommonLib</RootNamespace> + <AssemblyName>CalculatorCommonLib</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Consts.cs" /> + <Compile Include="ICalculatorService.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/RMI/CalculatorCommonLib/Consts.cs b/performance-tests/RMI/CalculatorCommonLib/Consts.cs new file mode 100644 index 0000000..c220625 --- /dev/null +++ b/performance-tests/RMI/CalculatorCommonLib/Consts.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CalculatorCommonLib +{ + public class Consts + { + public const int MethodCallCount = 1000000; + } +} diff --git a/performance-tests/RMI/CalculatorCommonLib/ICalculatorService.cs b/performance-tests/RMI/CalculatorCommonLib/ICalculatorService.cs new file mode 100644 index 0000000..c04013f --- /dev/null +++ b/performance-tests/RMI/CalculatorCommonLib/ICalculatorService.cs @@ -0,0 +1,15 @@ +using Hik.Communication.ScsServices.Service; + +namespace CalculatorCommonLib +{ + /// <summary> + /// This interface defines methods of calculator service that can be called by clients. + /// </summary> + [ScsService] + public interface ICalculatorService + { + int Add(int number1, int number2); + + double Divide(double number1, double number2); + } +} diff --git a/performance-tests/RMI/CalculatorCommonLib/Properties/AssemblyInfo.cs b/performance-tests/RMI/CalculatorCommonLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4848095 --- /dev/null +++ b/performance-tests/RMI/CalculatorCommonLib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CalculatorCommonLib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CalculatorCommonLib")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8a08ef54-dde6-4f7a-8656-57518c5098ea")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/RMI/CalculatorServer/CalculatorServer.csproj b/performance-tests/RMI/CalculatorServer/CalculatorServer.csproj new file mode 100644 index 0000000..259762d --- /dev/null +++ b/performance-tests/RMI/CalculatorServer/CalculatorServer.csproj @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{1BB6B428-E4C3-467F-824F-1DB84E310FF2}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CalculatorServer</RootNamespace> + <AssemblyName>CalculatorServer</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkProfile>Client</TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <PlatformTarget>x86</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Scs, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\Scs-Binaries\Scs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\CalculatorCommonLib\CalculatorCommonLib.csproj"> + <Project>{6F2D58C9-0395-4048-A304-17304D12BC63}</Project> + <Name>CalculatorCommonLib</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/performance-tests/RMI/CalculatorServer/Program.cs b/performance-tests/RMI/CalculatorServer/Program.cs new file mode 100644 index 0000000..8ec07ef --- /dev/null +++ b/performance-tests/RMI/CalculatorServer/Program.cs @@ -0,0 +1,46 @@ +using System; +using CalculatorCommonLib; +using Hik.Communication.Scs.Communication.EndPoints.Tcp; +using Hik.Communication.ScsServices.Service; + +namespace CalculatorServer +{ + class Program + { + static void Main() + { + //Create a service application that runs on 10083 TCP port + var serviceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(10083)); + + //Create a CalculatorService and add it to service application + serviceApplication.AddService<ICalculatorService, CalculatorService>(new CalculatorService()); + + //Start service application + serviceApplication.Start(); + + Console.WriteLine("Calculator service is started. Press enter to stop..."); + Console.ReadLine(); + + //Stop service application + serviceApplication.Stop(); + } + } + + public class CalculatorService : ScsService, ICalculatorService + { + public int Add(int number1, int number2) + { + return number1 + number2; + } + + public double Divide(double number1, double number2) + { + if(number2 == 0.0) + { + throw new DivideByZeroException("number2 can not be zero!"); + } + + return number1 / number2; + } + } +} diff --git a/performance-tests/RMI/CalculatorServer/Properties/AssemblyInfo.cs b/performance-tests/RMI/CalculatorServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..46a9398 --- /dev/null +++ b/performance-tests/RMI/CalculatorServer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CalculatorServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CalculatorServer")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fc3f0ecf-46ea-437e-a535-82dffae3dc9e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/performance-tests/RMI/SimpleCalculatorSystem.sln b/performance-tests/RMI/SimpleCalculatorSystem.sln new file mode 100644 index 0000000..236647f --- /dev/null +++ b/performance-tests/RMI/SimpleCalculatorSystem.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorServer", "CalculatorServer\CalculatorServer.csproj", "{1BB6B428-E4C3-467F-824F-1DB84E310FF2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorCommonLib", "CalculatorCommonLib\CalculatorCommonLib.csproj", "{6F2D58C9-0395-4048-A304-17304D12BC63}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CalculatorClient", "CalculatorClient\CalculatorClient.csproj", "{6DD6F730-E353-4B0C-9655-8370A943A7BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Debug|Any CPU.ActiveCfg = Debug|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Debug|x86.ActiveCfg = Debug|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Debug|x86.Build.0 = Debug|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Release|Any CPU.ActiveCfg = Release|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Release|Mixed Platforms.Build.0 = Release|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Release|x86.ActiveCfg = Release|x86 + {1BB6B428-E4C3-467F-824F-1DB84E310FF2}.Release|x86.Build.0 = Release|x86 + {6F2D58C9-0395-4048-A304-17304D12BC63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Debug|x86.ActiveCfg = Debug|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Release|Any CPU.Build.0 = Release|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6F2D58C9-0395-4048-A304-17304D12BC63}.Release|x86.ActiveCfg = Release|Any CPU + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Debug|Any CPU.ActiveCfg = Debug|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Debug|x86.ActiveCfg = Debug|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Debug|x86.Build.0 = Debug|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Release|Any CPU.ActiveCfg = Release|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Release|Mixed Platforms.Build.0 = Release|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Release|x86.ActiveCfg = Release|x86 + {6DD6F730-E353-4B0C-9655-8370A943A7BF}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal |