From 7561e292a40ad8cc07ed666a08edde1f480f498b Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 10 Oct 2008 12:06:07 +0000 Subject: QPID-1346: Added .net perftest git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@703430 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/Client.csproj | 1 - qpid/dotnet/client-010/client/client.sln | 82 ++- qpid/dotnet/client-010/client/client.suo | Bin 566784 -> 585728 bytes .../dotnet/client-010/client/transport/Receiver.cs | 1 - qpid/dotnet/client-010/client/transport/Result.cs | 35 -- .../client-010/client/transport/SessionDelegate.cs | 2 - .../client/transport/util/CircularBuffer.cs | 8 +- qpid/dotnet/client-010/default.build | 10 + qpid/dotnet/client-010/lib/plossum/C5-License.txt | 27 + qpid/dotnet/client-010/lib/plossum/C5.dll | Bin 0 -> 274432 bytes .../client-010/lib/plossum/Plossum CommandLine.dll | Bin 0 -> 98304 bytes qpid/dotnet/client-010/lib/plossum/license.txt | 28 + qpid/dotnet/client-010/perftest/PerfTest.cs | 684 +++++++++++++++++++++ .../client-010/perftest/Properties/AssemblyInfo.cs | 33 + qpid/dotnet/client-010/perftest/README.txt | 38 ++ qpid/dotnet/client-010/perftest/default.build | 29 + qpid/dotnet/client-010/perftest/perftest.csproj | 61 ++ 17 files changed, 990 insertions(+), 49 deletions(-) delete mode 100644 qpid/dotnet/client-010/client/transport/Result.cs create mode 100644 qpid/dotnet/client-010/lib/plossum/C5-License.txt create mode 100644 qpid/dotnet/client-010/lib/plossum/C5.dll create mode 100644 qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll create mode 100644 qpid/dotnet/client-010/lib/plossum/license.txt create mode 100644 qpid/dotnet/client-010/perftest/PerfTest.cs create mode 100644 qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/perftest/README.txt create mode 100644 qpid/dotnet/client-010/perftest/default.build create mode 100644 qpid/dotnet/client-010/perftest/perftest.csproj (limited to 'qpid') diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 35d8fae114..38f1dac737 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -189,7 +189,6 @@ - diff --git a/qpid/dotnet/client-010/client/client.sln b/qpid/dotnet/client-010/client/client.sln index 5b4a732545..f6688b7a09 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -3,9 +3,33 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddIn", "..\addins\ExcelAddIn\ExcelAddIn.csproj", "{85EFD719-39F6-4471-90FF-9E621430344B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInProducer", "..\addins\ExcelAddInProducer\ExcelAddInProducer.csproj", "{80F00C3B-EB38-4B3B-9F77-68977A30B155}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePRocessor", "..\addins\MessagePRocessor\MessagePRocessor.csproj", "{244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-producer", "..\examples\direct\example-direct-producer\example-direct-producer.csproj", "{96FCB250-8142-40EE-9BDD-CA839EE21021}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-Listener", "..\examples\direct\example-direct-Listener\example-direct-Listener.csproj", "{AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Listener", "..\examples\pub-sub\example-pub-sub-Listener\example-pub-sub-Listener.csproj", "{2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Publisher", "..\examples\pub-sub\example-pub-sub-Publisher\example-pub-sub-Publisher.csproj", "{F8857634-A134-44E7-A953-F2B22688C599}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\test\Test.csproj", "{95CB4C90-7C53-44A9-B11C-96235F158ACA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Client", "..\examples\request-response\example-request-response-Client\example-request-response-Client.csproj", "{1BC63815-4029-4039-9207-35E7E06ECC99}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Server", "..\examples\request-response\example-request-response-Server\example-request-response-Server.csproj", "{922FBA9C-E483-4AEF-ABE8-AC87421E829B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Producer", "..\examples\fanout\example-fanout-Producer\example-fanout-Producer.csproj", "{4513BF94-D54A-42FE-8506-FE2CD57B2C51}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Listener", "..\examples\fanout\example-fanout-Listener\example-fanout-Listener.csproj", "{18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "perftest", "..\perftest\perftest.csproj", "{7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,14 +41,62 @@ Global {B911FFD7-754F-4735-A188-218D5065BE79}.Debug|Any CPU.Build.0 = Debug|Any CPU {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.ActiveCfg = Release|Any CPU {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.Build.0 = Release|Any CPU - {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.Build.0 = Release|Any CPU {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.Build.0 = Release|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.Build.0 = Release|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.Build.0 = Release|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Release|Any CPU.Build.0 = Release|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.Build.0 = Release|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.Build.0 = Release|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.Build.0 = Release|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.Build.0 = Release|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.Build.0 = Release|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.Build.0 = Release|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.Build.0 = Release|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.Build.0 = Release|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.Build.0 = Release|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index 22e8b25895..1ccb5725ef 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ diff --git a/qpid/dotnet/client-010/client/transport/Receiver.cs b/qpid/dotnet/client-010/client/transport/Receiver.cs index be28d4ab6e..7b61d7f684 100644 --- a/qpid/dotnet/client-010/client/transport/Receiver.cs +++ b/qpid/dotnet/client-010/client/transport/Receiver.cs @@ -20,7 +20,6 @@ */ using System; -using org.apache.qpid.transport; namespace org.apache.qpid.transport { diff --git a/qpid/dotnet/client-010/client/transport/Result.cs b/qpid/dotnet/client-010/client/transport/Result.cs deleted file mode 100644 index bde1a2f98c..0000000000 --- a/qpid/dotnet/client-010/client/transport/Result.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ -using System; -namespace org.apache.qpid.transport -{ - - - /// Result - /// - /// - /// Rafael H. Schloming - /// - - public abstract class Result:Struct - { - } -} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs index daae528eb0..e4b58b20ff 100644 --- a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs @@ -19,8 +19,6 @@ * */ -using System; - namespace org.apache.qpid.transport { /// diff --git a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs index 3c08a7162f..05c26bcc49 100644 --- a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -105,10 +105,8 @@ namespace common.org.apache.qpid.transport.util buffer[i] = t; i += add; if (i < 0) i += len; - nwp = i; - countValue = nwp - nrp; - if (countValue == 0) - countValue += len; + nwp = i; + updateCount(); } private void updateCount() @@ -125,7 +123,7 @@ namespace common.org.apache.qpid.transport.util i += add; if (i < 0) i += len; nrp = i; - countValue = nwp - nrp; + countValue--; return (temp); } diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 99d8e239a3..1e49cb31a2 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -38,6 +38,11 @@ + + + + + @@ -171,6 +176,11 @@ + + + + + diff --git a/qpid/dotnet/client-010/lib/plossum/C5-License.txt b/qpid/dotnet/client-010/lib/plossum/C5-License.txt new file mode 100644 index 0000000000..e1c0876081 --- /dev/null +++ b/qpid/dotnet/client-010/lib/plossum/C5-License.txt @@ -0,0 +1,27 @@ +----------------------------------------------------------------------------- + +The following license applies to the C5 library (found in C5.dll and C5.pdb) +The source code for this library together with more information can be found on +http://www.itu.dk/research/c5/. + +----------------------------------------------------------------------------- + +Copyright (c) 2003-2007 Niels Kokholm and Peter Sestoft. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/qpid/dotnet/client-010/lib/plossum/C5.dll b/qpid/dotnet/client-010/lib/plossum/C5.dll new file mode 100644 index 0000000000..08362849c9 Binary files /dev/null and b/qpid/dotnet/client-010/lib/plossum/C5.dll differ diff --git a/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll b/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll new file mode 100644 index 0000000000..d3aad9485d Binary files /dev/null and b/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll differ diff --git a/qpid/dotnet/client-010/lib/plossum/license.txt b/qpid/dotnet/client-010/lib/plossum/license.txt new file mode 100644 index 0000000000..714c2d8821 --- /dev/null +++ b/qpid/dotnet/client-010/lib/plossum/license.txt @@ -0,0 +1,28 @@ +Copyright (c) Peter Palotas 2007 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/qpid/dotnet/client-010/perftest/PerfTest.cs b/qpid/dotnet/client-010/perftest/PerfTest.cs new file mode 100644 index 0000000000..97a609ba32 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/PerfTest.cs @@ -0,0 +1,684 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using common.org.apache.qpid.transport.util; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; +using Plossum.CommandLine; + +namespace PerfTest +{ + [CommandLineManager(ApplicationName = "Qpid Perf Tests", Copyright = "Apache Software Foundation")] + public class Options + { + [CommandLineOption(Description = "Displays this help text")] public bool Help; + + [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] public Boolean Setup; + + [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] public Boolean Control; + + [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] public Boolean Publish; + + [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] public Boolean Subscribe; + + [CommandLineOption(Description = "Test mode: [shared|fanout|topic]", MinOccurs = 0)] + public string Mode + { + get { return _mMode; } + set + { + if (! value.Equals("shared") && ! value.Equals("fanout") && ! value.Equals("topic")) + throw new InvalidOptionValueException( + "The mode must not be shared|fanout|topic", false); + _mMode = value; + } + } + + private string _mMode = "shared"; + + [CommandLineOption(Description = "Specifies the broler name", MinOccurs = 0)] + public string Broker + { + get { return _broker; } + set + { + if (String.IsNullOrEmpty(value)) + throw new InvalidOptionValueException( + "The broker name must not be empty", false); + _broker = value; + } + } + + private string _broker = "localhost"; + + [CommandLineOption(Description = "Specifies the port name", MinOccurs = 0)] + public int Port + { + get { return _port; } + set { _port = value; } + } + + private int _port = 5672; + + #region Publisher + + [CommandLineOption(Description = "Create N publishers.", MinOccurs = 0)] + public int Pubs + { + get { return _pubs; } + set { _pubs = value; } + } + + private int _pubs = 1; + + [CommandLineOption(Description = "Each publisher sends N messages.", MinOccurs = 0)] + public double Count + { + get { return _count; } + set { _count = value; } + } + + private double _count = 5000; + + [CommandLineOption(Description = "Size of messages in bytes.", MinOccurs = 0)] + public long Size + { + get { return _size; } + set { _size = value; } + } + + private long _size = 1024; + + [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] public Boolean Confirm = true; + + [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] public Boolean Durable; + + [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] public Boolean UniqueData; + + [CommandLineOption(Description = "Wait for confirmation of each message before sending the next one.", + MinOccurs = 0)] public Boolean SyncPub; + + [CommandLineOption(Description = ">=0 delay between msg publish.", MinOccurs = 0)] + public double IntervalPub + { + get { return _interval_pub; } + set { _interval_pub = value; } + } + + private double _interval_pub; + + #endregion + + #region Subscriber + + [CommandLineOption(Description = "Create N subscribers.", MinOccurs = 0)] + public int Subs + { + get { return _subs; } + set { _subs = value; } + } + + private int _subs = 1; + + [CommandLineOption(Description = "N>0: Subscriber acks batches of N.\n N==0: Subscriber uses unconfirmed mode", + MinOccurs = 0)] + public int SubAck + { + get { return _suback; } + set { _suback = value; } + } + + private int _suback; + + [CommandLineOption(Description = ">=0 delay between msg consume", MinOccurs = 0)] + public double IntervalSub + { + get { return _interval_sub; } + set { _interval_sub = value; } + } + + private double _interval_sub; + + #endregion + + [CommandLineOption(Description = "Create N queues.", MinOccurs = 0)] + public int Queues + { + get { return _qt; } + set { _qt = value; } + } + + private int _qt = 1; + + [CommandLineOption(Description = "Desired number of iterations of the test.", MinOccurs = 0)] + public int Iterations + { + get { return _iterations; } + set { _iterations = value; } + } + + private int _iterations = 1; + + [CommandLineOption(Description = "If non-zero, the transaction batch size.", MinOccurs = 0)] + public int Tx + { + get { return _tx; } + set { _tx = value; } + } + + private int _tx; + + [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] public Boolean + QueueDurable; + + [CommandLineOption(Description = "Queue policy: count to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxCount + { + get { return _queueMaxCount; } + set { _queueMaxCount = value; } + } + + private double _queueMaxCount; + + [CommandLineOption(Description = "Queue policy: accumulated size to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxSize + { + get { return _queueMaxSize; } + set { _queueMaxSize = value; } + } + + private double _queueMaxSize; + + public double SubQuota + { + get { return _subQuota; } + set { _subQuota = value; } + } + + private double _subQuota; + } + + internal interface Startable + { + void Start(); + } + + public abstract class PerfTestClient : Startable + { + private readonly Client _connection; + private readonly ClientSession _session; + private readonly Options _options; + + public ClientSession Session + { + get { return _session; } + } + + public Options Options + { + get { return _options; } + } + + protected PerfTestClient(Options options) + { + _options = options; + _connection = new Client(); + _connection.connect(options.Broker, options.Port, "test", "guest", "guest"); + _session = _connection.createSession(50000); + } + + public abstract void Start(); + } + + public class SetupTest : PerfTestClient + { + public SetupTest(Options options) + : base(options) + { + } + + private void queueInit(String name, Boolean durable, Dictionary arguments) + { + Session.queueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); + Session.queuePurge(name); + Session.exchangeBind(name, "amq.direct", name); + Session.sync(); + } + + public override void Start() + { + queueInit("pub_start", false, null); + queueInit("pub_done", false, null); + queueInit("sub_ready", false, null); + queueInit("sub_done", false, null); + if (Options.Mode.Equals("shared")) + { + Dictionary settings = new Dictionary(); + if (Options.QueueMaxCount > 0) + settings.Add("qpid.max_count", Options.QueueMaxCount); + if (Options.QueueMaxSize > 0) + settings.Add("qpid.max_size", Options.QueueMaxSize); + for (int i = 0; i < Options.Queues; ++i) + { + string qname = "perftest" + i; + queueInit(qname, Options.Durable || Options.QueueDurable, settings); + } + } + } + } + + public class SubscribeThread : PerfTestClient + { + private readonly string _queue; + + public SubscribeThread(Options options, string key, string exchange) + : base(options) + { + _queue = "perftest" + (new UUID(10, 10)).ToString(); + Session.queueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, + Options.Durable ? Option.DURABLE : Option.NONE); + Session.exchangeBind(_queue, exchange, key); + } + + public SubscribeThread(Options options, string key) + : base(options) + { + _queue = key; + } + + public override void Start() + { + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "message_queue" + IMessageListener listener = new SyncListener(buffer); + string dest = "dest" + UUID.randomUUID().ToString(); + Session.attachMessageListener(listener, dest); + Session.messageSubscribe(_queue, dest, + Options.Tx > 0 || Options.SubAck > 0 + ? MessageAcceptMode.EXPLICIT + : MessageAcceptMode.NONE, + MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + Session.messageSetFlowMode(dest, MessageFlowMode.WINDOW); + Session.messageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + + // Notify controller we are ready. + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey("sub_ready"); + + message.appendData(Encoding.UTF8.GetBytes("ready")); + Session.messageTransfer("amq.direct", message); + + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + + + for (int j = 0; j < Options.Iterations; ++j) + { + + //need to allocate some more credit + Session.messageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); + + RangeSet range = new RangeSet(); + IMessage msg; + DateTime start = DateTime.Now; + for (long i = 0; i < Options.SubQuota; ++i) + { + msg = buffer.Dequeue(); + if (Options.Tx > 0 && ((i + 1)%Options.Tx == 0)) + { + Session.txCommit(); + Session.sync(); + } + if (Options.IntervalSub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + range.add(msg.Id); + } + if (Options.Tx > 0 || Options.SubAck > 0) + Session.messageAccept(range); + range.clear(); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("sub_done"); + message.clearData(); + message.appendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class SyncListener : IMessageListener + { + private readonly CircularBuffer _buffer; + + public SyncListener(CircularBuffer buffer) + { + _buffer = buffer; + } + + public void messageTransfer(IMessage m) + { + _buffer.Enqueue(m); + } + } + + + public class PublishThread : PerfTestClient + { + private readonly string _exchange; + private readonly string _key; + + public PublishThread(Options options, string key, string exchange) + : base(options) + { + _key = key; + _exchange = exchange; + } + + + public override void Start() + { + byte[] data = new byte[Options.Size]; + // randomly populate data + Random r = new Random(34); + r.NextBytes(data); + IMessage message = new Message(); + message.appendData(data); + + message.DeliveryProperties.setRoutingKey(_key); + + if (Options.Durable) + message.DeliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); + + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "pub_start" + IMessageListener listener = new SyncListener(buffer); + string localQueue = "localQueue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", "pub_start"); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + buffer.Dequeue(); + + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + for (long i = 0; i < Options.Count; ++i) + { + Session.messageTransfer(_exchange, message); + + if (Options.SyncPub) + { + Session.sync(); + } + if (Options.Tx > 0 && (i + 1)%Options.Tx == 0) + { + Session.txSelect(); + Session.sync(); + } + if (Options.IntervalPub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + } + Session.sync(); + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("pub_done"); + message.clearData(); + double time = end.Subtract(start).TotalMilliseconds; + byte[] rate = BitConverter.GetBytes( Options.Count / time ); + message.appendData(rate); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class Controller : PerfTestClient + { + public Controller(Options options) + : base(options) + { + } + + private void process(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + for (int i = 0; i < size; ++i) + { + buffer.Dequeue(); + } + } + + private double processRate(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + double rate = 0; + RangeSet range = new RangeSet(); + for (int i = 0; i < size; ++i) + { + IMessage m = buffer.Dequeue(); + range.add(m.Id); + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + rate += BitConverter.ToDouble(body,0); + } + Session.messageAccept(range); + return rate; + } + + private void send(int size, string queue, string data) + { + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey(queue); + message.appendData(Encoding.UTF8.GetBytes(data)); + for (int i = 0; i < size; ++i) + { + Session.messageTransfer("amq.direct", message); + } + } + + public override void Start() + { + process(Options.Subs, "sub_ready"); + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + send(Options.Pubs, "pub_start", "start"); // Start publishers + double pubrate = processRate(Options.Pubs, "pub_done"); + double subrate = processRate(Options.Subs, "sub_done"); + DateTime end = DateTime.Now; + + double transfers = (Options.Pubs*Options.Count) + (Options.Subs*Options.SubQuota); + double time = end.Subtract(start).TotalSeconds; + double txrate = transfers/time; + double mbytes = (txrate*Options.Size) / (1024 * 1024) ; + + Console.WriteLine("Total: " + transfers + " transfers of " + Options.Size + " bytes in " + + time + " seconds.\n" + + "Publish transfers/sec: " + pubrate * 1000 + "\n" + + "Subscribe transfers/sec: " + subrate * 1000 + "\n" + + "Total transfers/sec: " + txrate + "\n" + + "Total Mbytes/sec: " + mbytes); + Console.WriteLine("done"); + } + + } + } + + + public class PerfTest + { + private static int Main(string[] args) + { + Options options = new Options(); + CommandLineParser parser = new CommandLineParser(options); + parser.Parse(); + if (parser.HasErrors) + { + Console.WriteLine(parser.UsageInfo.GetErrorsAsString(78)); + return -1; + } + if (options.Help) + { + Console.WriteLine(parser.UsageInfo.GetOptionsAsString(78)); + return 0; + } + bool singleProcess = + (!options.Setup && !options.Control && !options.Publish && !options.Subscribe); + if (singleProcess) + { + options.Setup = options.Control = options.Publish = true; + options.Subscribe = true; + } + + + string exchange = "amq.direct"; + switch (options.Mode) + { + case "shared": + options.SubQuota = (options.Pubs*options.Count)/options.Subs; + break; + case "fanout": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.fanout"; + break; + case "topic": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.topic"; + break; + } + + if (options.Setup) + { + SetupTest setup = new SetupTest(options); + setup.Start(); // Set up queues + } + + Thread contT = null; + if ( options.Control) + { + Controller c = new Controller(options); + contT = new Thread(c.Start); + contT.Start(); + } + + Thread[] publishers = null; + Thread[] subscribers = null; + + // Start pubs/subs for each queue/topic. + for (int i = 0; i < options.Queues; ++i) + { + string key = "perftest" + i; // Queue or topic name. + if (options.Publish) + { + int n = singleProcess ? options.Pubs : 1; + publishers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + PublishThread pt = new PublishThread(options, key, exchange); + publishers[i] = new Thread(pt.Start); + publishers[i].Start(); + } + } + if ( options.Subscribe) + { + int n = singleProcess ? options.Subs : 1; + subscribers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + SubscribeThread st; + if (options.Mode.Equals("shared")) + st = new SubscribeThread(options, key); + else + st = new SubscribeThread(options, key, exchange); + subscribers[i] = new Thread(st.Start); + subscribers[i].Start(); + } + } + } + + if (options.Control) + { + contT.Join(); + } + + + // Wait for started threads. + if (options.Publish) + { + foreach (Thread t in publishers) + { + t.Join(); + } + } + + if (options.Subscribe) + { + foreach (Thread t in subscribers) + { + t.Join(); + } + } + + + return 0; + } + } +} diff --git a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..4ca588786e --- /dev/null +++ b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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("perftest")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("perftest")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[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("11b542db-0d57-4a67-8b92-24ac1d4ed4cf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/perftest/README.txt b/qpid/dotnet/client-010/perftest/README.txt new file mode 100644 index 0000000000..fadde27693 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/README.txt @@ -0,0 +1,38 @@ +There are two ways to use perftest: +- single process: +If none of the -Setup, -Publish, -Subscribe or -Control options are given perftest will run a single-process test. +- multi-process: +For a multi-process test first run: +Perftest.exe -Setup +and wait for it to complete. The remaining process should run concurrently: +Run -Pubs times: Perftest.exe -Publish +Run -Subs times: Perftest.exe -Subscribe +Run once: Perftest.exe -Control +Note the must be identical for all processes. + +Options: + -Broker Specifies the broler name + -Confirm Publisher use confirm-mode. + -Control Run test, print report. + -Count Each publisher sends N messages. + -Durable Publish messages as durable. + -Help Displays this help text + -IntervalPub >=0 delay between msg publish. + -IntervalSub >=0 delay between msg consume + -Iterations Desired number of iterations of the test. + -Mode Test mode: [shared|fanout|topic] + -Port Specifies the port name + -Publish Publish messages. + -Pubs Create N publishers. + -QueueDurable Make queue durable (implied if durable set. + -QueueMaxCount Queue policy: count to trigger 'flow to disk' + -QueueMaxSize Queue policy: accumulated size to trigger 'flow to disk' + -Queues Create N queues. + -Setup Create shared queues. + -Size Size of messages in bytes. + -SubAck N>0: Subscriber acks batches of N. N==0: Subscriber uses unconfirmed mode + -Subs Create N subscribers. + -Subscribe Subscribe for messages. + -SyncPub Wait for confirmation of each message before sending the next one. + -Tx If non-zero, the transaction batch size. + -UniqueData Make data for each message unique. \ No newline at end of file diff --git a/qpid/dotnet/client-010/perftest/default.build b/qpid/dotnet/client-010/perftest/default.build new file mode 100644 index 0000000000..a126a8bc86 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/default.build @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj new file mode 100644 index 0000000000..8f82f195b6 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -0,0 +1,61 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} + Exe + Properties + perftest + perftest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\plossum\C5.dll + + + False + ..\lib\plossum\Plossum CommandLine.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file -- cgit v1.2.1