summaryrefslogtreecommitdiff
path: root/IvyFilter
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:05:28 +0000
committerfcolin2007-02-01 12:05:28 +0000
commit3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6 (patch)
tree0cdd055c290b0dcafa42092f40305e5e9d09652f /IvyFilter
parent12c926b30ac4c97773d93afbd9adadd3bc5251b4 (diff)
downloadivy-csharp-3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6.zip
ivy-csharp-3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6.tar.gz
ivy-csharp-3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6.tar.bz2
ivy-csharp-3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6.tar.xz
modification structure svn
Diffstat (limited to 'IvyFilter')
-rw-r--r--IvyFilter/Filter.cs119
-rw-r--r--IvyFilter/IvyFilter.csproj61
-rw-r--r--IvyFilter/IvyFilter.csproj.vspscc10
-rw-r--r--IvyFilter/Properties/AssemblyInfo.cs33
4 files changed, 223 insertions, 0 deletions
diff --git a/IvyFilter/Filter.cs b/IvyFilter/Filter.cs
new file mode 100644
index 0000000..03e2435
--- /dev/null
+++ b/IvyFilter/Filter.cs
@@ -0,0 +1,119 @@
+
+using System;
+using IvyBus;
+using System.Threading;
+using Gnu;
+
+namespace IvyFilter
+{
+ class Filter
+ {
+
+ internal Ivy bus;
+
+ [STAThread]
+ public static void Main(System.String[] args)
+ {
+ GetOpt opt = new GetOpt(args, "b:n:t:");
+ System.String domain = Ivy.GetDomain(null);
+ int nb = 10000;
+ int t = 1000;
+ Arg a;
+ while ((a = opt.NextArg() )!= null)
+ {
+ switch (a.Flag)
+ {
+
+ case 'b':
+ domain = a.Parameter;
+ break;
+
+ case 't':
+ t = int.Parse(a.Parameter);
+ break;
+
+ case 'n':
+ nb = int.Parse(a.Parameter);
+ break;
+
+ default:
+ System.Environment.Exit(0);
+ break;
+
+ }
+ }
+ new Filter(domain, nb, t, true);
+ }
+
+ private int nbmsg;
+ private int bounded = 0, unbounded = 0;
+ private string[] filter = new string[] { "GetDummy" };
+
+ public Filter(string domain, int n, int t, bool f)
+ {
+ System.Console.Out.WriteLine("trying Filter on " + n + " messages, " + t + " ms delay");
+ nbmsg = n;
+ bus = new Ivy("Filter", "Filter ready");
+ if (f)
+ bus.SentMessageFilter.AddRange(filter);
+ bus.BindingAdd += new EventHandler<IvyEventArgs>(bus_BindingAdd);
+ bus.BindingRemove += new EventHandler<IvyEventArgs>(bus_BindingRemove);
+ bus.BindingFilter += new EventHandler<IvyEventArgs>(bus_BindingFilter);
+ bus.Start(domain);
+ /* attend une seconde ou deux */
+ try
+ {
+ Thread.Sleep(2000);
+ }
+ catch (System.Threading.ThreadInterruptedException )
+ {
+ }
+ System.Console.Out.WriteLine(bounded + " bounded subscriptions, " + unbounded + " unbounded");
+ System.Console.Out.WriteLine(bus.IvyClients.Count + " clients");
+ DateTime debut = System.DateTime.Now;
+ TimeSpan total = new TimeSpan();
+ DateTime debutlocal = System.DateTime.Now;
+ DateTime finlocal = System.DateTime.Now;
+ for (int i = 0; i < n; i++)
+ {
+ try
+ {
+ // System.out.println("sending msg");
+ debutlocal = System.DateTime.Now;
+ bus.SendMsg("GetDummy message");
+ finlocal = System.DateTime.Now;
+ total += finlocal - debutlocal;
+ Thread.Sleep( t );
+ }
+ catch (IvyException )
+ {
+ System.Environment.Exit(-1);
+ }
+ catch (ThreadInterruptedException )
+ {
+ }
+ }
+ System.Console.Out.WriteLine(((f) ? "[filtered] " : "[non filtered] ") + total.TotalMilliseconds + "ms elapsed, " + (finlocal - debut).TotalMilliseconds + " ms total out of " + n * t);
+ bus.Stop();
+ if (f == true)
+ new Filter(domain, n, t, false); // relance le même test sans filtre
+ System.Console.ReadLine();
+ }
+
+ void bus_BindingFilter(object sender, IvyEventArgs e)
+ {
+ unbounded++;
+ }
+
+ void bus_BindingRemove(object sender, IvyEventArgs e)
+ {
+ bounded--;
+ }
+
+ void bus_BindingAdd(object sender, IvyEventArgs e)
+ {
+ bounded++;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/IvyFilter/IvyFilter.csproj b/IvyFilter/IvyFilter.csproj
new file mode 100644
index 0000000..1d3c263
--- /dev/null
+++ b/IvyFilter/IvyFilter.csproj
@@ -0,0 +1,61 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{151B7DDB-279B-4E1E-903B-E09B079FA0A5}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>IvyFilter</RootNamespace>
+ <AssemblyName>IvyFilter</AssemblyName>
+ <SccProjectName>SAK</SccProjectName>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccProvider>SAK</SccProvider>
+ </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="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Filter.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\getopt\getopt.csproj">
+ <Project>{228B5F0B-31AE-488F-A916-B7CBB269D25F}</Project>
+ <Name>getopt</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Ivy\Ivy.csproj">
+ <Project>{F2F03CF7-0087-4EDB-AD15-80C9E8DA2617}</Project>
+ <Name>Ivy</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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/IvyFilter/IvyFilter.csproj.vspscc b/IvyFilter/IvyFilter.csproj.vspscc
new file mode 100644
index 0000000..353c834
--- /dev/null
+++ b/IvyFilter/IvyFilter.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:IvyFilter"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/IvyFilter/Properties/AssemblyInfo.cs b/IvyFilter/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..723881f
--- /dev/null
+++ b/IvyFilter/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("IvyFilter")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("DTI/SDER")]
+[assembly: AssemblyProduct("IvyFilter")]
+[assembly: AssemblyCopyright("Copyright © DTI/SDER 2006")]
+[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("7d041760-bc83-40d7-a534-b90993c58737")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]