From 98ab5d0164040427f7c554febae125686284e2a7 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 12:03:55 +0000 Subject: modification structure svn --- IvyToDel/IvyFilter/Filter.cs | 119 ++++++++++++++++++++++++++ IvyToDel/IvyFilter/IvyFilter.csproj | 61 +++++++++++++ IvyToDel/IvyFilter/IvyFilter.csproj.vspscc | 10 +++ IvyToDel/IvyFilter/Properties/AssemblyInfo.cs | 33 +++++++ 4 files changed, 223 insertions(+) create mode 100644 IvyToDel/IvyFilter/Filter.cs create mode 100644 IvyToDel/IvyFilter/IvyFilter.csproj create mode 100644 IvyToDel/IvyFilter/IvyFilter.csproj.vspscc create mode 100644 IvyToDel/IvyFilter/Properties/AssemblyInfo.cs (limited to 'IvyToDel/IvyFilter') diff --git a/IvyToDel/IvyFilter/Filter.cs b/IvyToDel/IvyFilter/Filter.cs new file mode 100644 index 0000000..03e2435 --- /dev/null +++ b/IvyToDel/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(bus_BindingAdd); + bus.BindingRemove += new EventHandler(bus_BindingRemove); + bus.BindingFilter += new EventHandler(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/IvyToDel/IvyFilter/IvyFilter.csproj b/IvyToDel/IvyFilter/IvyFilter.csproj new file mode 100644 index 0000000..1d3c263 --- /dev/null +++ b/IvyToDel/IvyFilter/IvyFilter.csproj @@ -0,0 +1,61 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {151B7DDB-279B-4E1E-903B-E09B079FA0A5} + Exe + Properties + IvyFilter + IvyFilter + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {228B5F0B-31AE-488F-A916-B7CBB269D25F} + getopt + + + {F2F03CF7-0087-4EDB-AD15-80C9E8DA2617} + Ivy + + + + + \ No newline at end of file diff --git a/IvyToDel/IvyFilter/IvyFilter.csproj.vspscc b/IvyToDel/IvyFilter/IvyFilter.csproj.vspscc new file mode 100644 index 0000000..353c834 --- /dev/null +++ b/IvyToDel/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/IvyToDel/IvyFilter/Properties/AssemblyInfo.cs b/IvyToDel/IvyFilter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..723881f --- /dev/null +++ b/IvyToDel/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")] -- cgit v1.1