public void TestEventInheritanceRun() { var tcs = new TaskCompletionSource <bool>(); var runtime = new ProductionRuntime(); var a = runtime.CreateMachine(typeof(A), null, new A.Configure(tcs), null); runtime.SendEvent(a, new A.E3()); runtime.SendEvent(a, new E1()); runtime.SendEvent(a, new E2()); Assert.True(tcs.Task.Wait(2000), "Test timed out"); }
public void SendMessages() { var tcs = new TaskCompletionSource <bool>(); var runtime = new ProductionRuntime(); runtime.CreateMachine(typeof(Server), null, new Server.Configure(tcs, this.Clients, this.EventsPerClient), null); tcs.Task.Wait(); }
public void MeasureMessagingLatency() { var tcs = new TaskCompletionSource <bool>(); var runtime = new ProductionRuntime(); runtime.CreateMachine(typeof(Master), null, new SetupMasterEvent(tcs, this.NumMessages), null); tcs.Task.Wait(); }
public void MeasureLatencyExchangeEventViaReceive() { var tcs = new TaskCompletionSource <bool>(); var configuration = Configuration.Create(); var runtime = new ProductionRuntime(configuration); runtime.CreateMachine(typeof(M3), null, new SetupTcsEvent(tcs, this.NumMessages)); tcs.Task.Wait(); }
public void MeasureMachineCreation() { var runtime = new ProductionRuntime(); var tcs = new TaskCompletionSource <bool>(); var e = new SetupEvent(tcs, NumMachines, DoHalt); for (int idx = 0; idx < NumMachines; idx++) { runtime.CreateMachine(typeof(M), null, e, null); } tcs.Task.Wait(); }
public void CreateMachines() { var runtime = new ProductionRuntime(); var tcs = new TaskCompletionSource <bool>(); Node.Configure evt = new Node.Configure(tcs, Size); for (int idx = 0; idx < Size; idx++) { runtime.CreateMachine(typeof(Node), null, evt, null); } tcs.Task.Wait(); }
public void MeasureThroughputMachineCreation() { var configuration = Configuration.Create(); var runtime = new ProductionRuntime(configuration); var tcs = new TaskCompletionSource <bool>(); var e = new SetupEvent(tcs, this.NumMachines, this.DoHalt); for (int idx = 0; idx < this.NumMachines; idx++) { runtime.CreateMachine(typeof(M), null, e); } tcs.Task.Wait(); }
public void RunWithLogger() { var configuration = PSharp.Configuration.Create().WithVerbosityEnabled(0); var runtime = new ProductionRuntime(configuration); ConcurrentQueue <MachineId> machines = new ConcurrentQueue <MachineId>(); Parallel.For(0, Clients, index => { machines.Enqueue(runtime.CreateMachine(typeof(SimpleMachine), new SetContextMessage(runtime))); }); foreach (var machine in machines) { runtime.SendEvent(machine, new Halt()); } }