/// <summary> /// Testing Requests without response /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { //sm.RemoteRequestWithoutResponse(null); var res = sm.RemoteRequest(new byte[] { 9 }); return; //var res = sm.RemoteRequest(new byte[546], // (par) => // { // Console.WriteLine(par.Item1); // } // ,10000); //return; System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); for (int i = 0; i < 10000; i++) { //sm.RemoteRequestWithoutResponse(new byte[1]); sm.RemoteRequestWithoutResponse(new byte[512]); //sm.RemoteRequestWithoutResponse(new byte[10000]); } sw.Stop(); Console.WriteLine(sw.ElapsedMilliseconds); }
/// <summary> ///Test of RemoteRequest with answer (Process 2 must receive request in its RemoteCall and return back Response). ///Here we calcualte the speed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { //var res222 = sm.RemoteRequest(new byte[1700]); //return; //var res1 = sm.RemoteRequest(new byte[546], // (par) => // { // Console.WriteLine(par.Item1); // } // , 10000); //var res1 = sm.RemoteRequest(new byte[546],null, 10000); //return; byte[] data = new byte[1]; //byte[] data = new byte[512]; //byte[] data = new byte[10000]; int iter = 100000; System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); for (int i = 0; i < iter; i++) { // var res = sm.RemoteRequest(new byte[512], (par) => { }); //var res = sm.RemoteRequest(null); //var res = sm.RemoteRequest(data, (par) => { },30000); //sm.RemoteRequestWithoutResponse(new byte[512]); //sm.RemoteRequestWithoutResponse(new byte[1]); var res = sm.RemoteRequest(data); } sw.Stop(); Console.WriteLine("Speed: {0} MB/s, Finished in ms {1}", Math.Round((decimal)data.Length * (decimal)iter * (decimal)1000 / ((decimal)sw.ElapsedMilliseconds * 1000000m) , 2), sw.ElapsedMilliseconds ); // Console.WriteLine(sw.ElapsedMilliseconds); }
/// <summary> ///Test of RemoteRequest with answer (Process 2 must receive request in its RemoteCall and return back Response). ///Here we calcualte the speed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void button2_Click(object sender, EventArgs e) { //tiesky.com.SharmIpc.AsyncManualResetEvent mre = new tiesky.com.SharmIpc.AsyncManualResetEvent(); //Task.Run(() => //{ // System.Threading.Thread.Sleep(3000); // mre.Set(); //}); //mre.Set(); //var trtz = await Task.WhenAny(mre.WaitAsync(), Task.Delay(10000)); //return; //var uzuz = await sm.RemoteRequestAsync(new byte[1700]); //return; t001_TestIntensiveParallel(); return; var x = new DateTime(636282847257956630, DateTimeKind.Utc); var x1 = new DateTime(636282847236855000, DateTimeKind.Utc); var dfr41 = sm.RemoteRequest(new byte[1700]); return; byte[] here = new byte[2500]; Action <int> a1 = (id) => { //Console.WriteLine("YAHOO " + id); //DBreeze.Diagnostic.SpeedStatistic.StartCounter("a"+id); int tt = 0; for (int i = 0; i < 1000; i++) { var xr = sm.RemoteRequest(new byte[1700]); tt += xr.Item2.Length; } Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.ms") + "> DONE " + tt); //DBreeze.Diagnostic.SpeedStatistic.PrintOut("a" + id); //Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.ms") + "> DONE " + tt); }; Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.ms") + "> START"); for (int j = 0; j < 40; j++) { //((Action)(() => { a1(); })).DoAsync(); System.Threading.Tasks.Task.Run(() => { // Console.WriteLine("Running " + j.ToString()); a1(j); }); //new System.Threading.Thread(() => { a1(); }).Start(); } return; var res222 = sm.RemoteRequest(new byte[1700]); Console.WriteLine("Received " + res222.Item2.Length + " bytes"); return; //var res1 = sm.RemoteRequest(new byte[546], // (par) => // { // Console.WriteLine(par.Item1); // } // , 10000); //var res1 = sm.RemoteRequest(new byte[546],null, 10000); //return; byte[] data = new byte[1]; //byte[] data = new byte[512]; //byte[] data = new byte[10000]; int iter = 100000; System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); for (int i = 0; i < iter; i++) { // var res = sm.RemoteRequest(new byte[512], (par) => { }); //var res = sm.RemoteRequest(null); //var res = sm.RemoteRequest(data, (par) => { },30000); //sm.RemoteRequestWithoutResponse(new byte[512]); //sm.RemoteRequestWithoutResponse(new byte[1]); var res = sm.RemoteRequest(data); } sw.Stop(); Console.WriteLine("Speed: {0} MB/s, Finished in ms {1}", Math.Round((decimal)data.Length * (decimal)iter * (decimal)1000 / ((decimal)sw.ElapsedMilliseconds * 1000000m) , 2), sw.ElapsedMilliseconds ); // Console.WriteLine(sw.ElapsedMilliseconds); }