コード例 #1
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
 public void IpcCallbackLoop()
 {
     var binding = new LocalBinding { MaxConnections = 5 };
     var path = "ipc:///" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name;
     var reportWatch = new NStopwatch.Reportwatch();
     for (int i = 0; i < 1000; i++)
     {
         DoHostWithCallbackInternal(reportWatch, binding, path);
     }
     reportWatch.ReportAll();
 }
コード例 #2
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
 public void NamedPipeCallbackLoop()
 {
     var binding = new NetNamedPipeBinding() { MaxConnections = 5 };
     var path = "net.pipe://127.0.0.1/" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name;
     var reportWatch = new NStopwatch.Reportwatch();
     for (int i = 0; i < 1000; i++)
     {
         DoHostWithCallbackInternal(reportWatch, binding, path);
     }
     reportWatch.ReportAll();
 }
コード例 #3
0
        private static void DoWcfHost2()
        {
            var reportWatch = new NStopwatch.Reportwatch();

            DoWcfHost2Internal(reportWatch);
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }
コード例 #4
0
        private static void DoHostWithCallback(Binding binding, string path)
        {
            var reportWatch = new NStopwatch.Reportwatch();

            DoHostWithCallbackInternal(reportWatch, binding, path);
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
            reportWatch.ReportAll();
        }
コード例 #5
0
        public void IpcCallbackLoop()
        {
            var binding = new LocalBinding {
                MaxConnections = 5
            };
            var path        = "ipc:///" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name;
            var reportWatch = new NStopwatch.Reportwatch();

            for (int i = 0; i < 1000; i++)
            {
                DoHostWithCallbackInternal(reportWatch, binding, path);
            }
            reportWatch.ReportAll();
        }
コード例 #6
0
        public void NamedPipeCallbackLoop()
        {
            var binding = new NetNamedPipeBinding()
            {
                MaxConnections = 5
            };
            var path        = "net.pipe://127.0.0.1/" + this.GetType().Name + "_" + MethodBase.GetCurrentMethod().Name;
            var reportWatch = new NStopwatch.Reportwatch();

            for (int i = 0; i < 1000; i++)
            {
                DoHostWithCallbackInternal(reportWatch, binding, path);
            }
            reportWatch.ReportAll();
        }
コード例 #7
0
        private static void DoWcfHost()
        {
            var reportWatch = new NStopwatch.Reportwatch();

            reportWatch.Start("ServiceHost ctor");
            using (var server = new ServiceHost(new Service(), new Uri("net.pipe://127.0.0.1/testpipename")))
            {
                reportWatch.Stop("ServiceHost ctor");

                reportWatch.Start("AddServiceEndpoint");
                var binding = new NetNamedPipeBinding {
                    MaxConnections = 5
                };
                server.AddServiceEndpoint(typeof(IService), binding, "net.pipe://127.0.0.1/testpipename");
                reportWatch.Stop("AddServiceEndpoint");

                reportWatch.Start("Open");
                server.Open();
                reportWatch.Stop("Open");

                reportWatch.Start("ChannelFactory ctor");
                using (var channelFactory = new ChannelFactory <IService>(binding))
                {
                    reportWatch.Stop("ChannelFactory ctor");

                    reportWatch.Start("CreateChannel");
                    var client = channelFactory.CreateChannel(new EndpointAddress("net.pipe://127.0.0.1/testpipename"));
                    reportWatch.Stop("CreateChannel");

                    reportWatch.Start("Execute");
                    client.Execute(new byte[0]);
                    reportWatch.Stop("Execute");
                }
            }
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }
コード例 #8
0
        private static void DoWcfHost(Binding binding, string path)
        {
            var reportWatch = new NStopwatch.Reportwatch();

            reportWatch.Start("ServiceHost ctor");
            using (var server = new ServiceHost(new Service(), new Uri(path)))
            {
                reportWatch.Stop("ServiceHost ctor");

                reportWatch.Start("AddServiceEndpoint");
                server.AddServiceEndpoint(typeof(IService), binding, path);
                reportWatch.Stop("AddServiceEndpoint");

                reportWatch.Start("Open");
                server.Open();
                reportWatch.Stop("Open");

                reportWatch.Start("ChannelFactory ctor");
                using (var channelFactory = new ChannelFactory <IService>(binding))
                {
                    reportWatch.Stop("ChannelFactory ctor");

                    reportWatch.Start("CreateChannel");
                    var client = channelFactory.CreateChannel(new EndpointAddress(path));
                    reportWatch.Stop("CreateChannel");

                    reportWatch.Start("Execute");
                    client.Execute(new byte[0]);
                    reportWatch.Stop("Execute");
                }
            }
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }
コード例 #9
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
        private static void DoHostWithCallback(Binding binding, string path)
        {
            var reportWatch = new NStopwatch.Reportwatch();

            DoHostWithCallbackInternal(reportWatch, binding, path);
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
            reportWatch.ReportAll();
        }
コード例 #10
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
        private static void DoWcfHost2()
        {
            var reportWatch = new NStopwatch.Reportwatch();

            DoWcfHost2Internal(reportWatch);
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }
コード例 #11
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
        private static void DoWcfHost()
        {
            var reportWatch = new NStopwatch.Reportwatch();

            reportWatch.Start("ServiceHost ctor");
            using (var server = new ServiceHost(new Service(), new Uri("net.pipe://127.0.0.1/testpipename")))
            {
                reportWatch.Stop("ServiceHost ctor");

                reportWatch.Start("AddServiceEndpoint");
                var binding = new NetNamedPipeBinding { MaxConnections = 5 };
                server.AddServiceEndpoint(typeof(IService), binding, "net.pipe://127.0.0.1/testpipename");
                reportWatch.Stop("AddServiceEndpoint");

                reportWatch.Start("Open");
                server.Open();
                reportWatch.Stop("Open");

                reportWatch.Start("ChannelFactory ctor");
                using (var channelFactory = new ChannelFactory<IService>(binding))
                {
                    reportWatch.Stop("ChannelFactory ctor");

                    reportWatch.Start("CreateChannel");
                    var client = channelFactory.CreateChannel(new EndpointAddress("net.pipe://127.0.0.1/testpipename"));
                    reportWatch.Stop("CreateChannel");

                    reportWatch.Start("Execute");
                    client.Execute(new byte[0]);
                    reportWatch.Stop("Execute");
                }
            }
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }
コード例 #12
0
ファイル: StartupTimeTests.cs プロジェクト: OpenSharp/NDceRpc
        private static void DoWcfHost(Binding binding, string path)
        {
            var reportWatch = new NStopwatch.Reportwatch();

            reportWatch.Start("ServiceHost ctor");
            using (var server = new ServiceHost(new Service(), new Uri(path)))
            {
                reportWatch.Stop("ServiceHost ctor");

                reportWatch.Start("AddServiceEndpoint");
                server.AddServiceEndpoint(typeof(IService), binding, path);
                reportWatch.Stop("AddServiceEndpoint");

                reportWatch.Start("Open");
                server.Open();
                reportWatch.Stop("Open");

                reportWatch.Start("ChannelFactory ctor");
                using (var channelFactory = new ChannelFactory<IService>(binding))
                {
                    reportWatch.Stop("ChannelFactory ctor");

                    reportWatch.Start("CreateChannel");
                    var client = channelFactory.CreateChannel(new EndpointAddress(path));
                    reportWatch.Stop("CreateChannel");

                    reportWatch.Start("Execute");
                    client.Execute(new byte[0]);
                    reportWatch.Stop("Execute");
                }
            }
            reportWatch.Report("ServiceHost ctor");
            reportWatch.Report("AddServiceEndpoint");
            reportWatch.Report("Open");
            reportWatch.Report("ChannelFactory ctor");
            reportWatch.Report("CreateChannel");
            reportWatch.Report("Execute");
        }