Esempio n. 1
0
        /// <summary>
        /// Returns the current nondeterministic choice as a program trace step.
        /// </summary>
        /// <param name="uniqueId">Unique nondet id</param>
        /// <param name="choice">Choice</param>
        /// <param name="enabledMachines">Enabled machines</param>
        /// <returns>TraceStep</returns>
        private TraceStep GetNondeterministicChoiceTraceStep(string uniqueId, bool choice,
                                                             HashSet <Machine> enabledMachines)
        {
            var fingerprint = PSharpRuntime.CaptureProgramState();
            var traceStep   = TraceStep.CreateNondeterministicChoice(fingerprint, uniqueId,
                                                                     choice, enabledMachines, PSharpRuntime.LivenessChecker.GetMonitorStatus());

            Output.Debug(DebugType.Liveness, "<LivenessDebug> Captured program state '{0}' at " +
                         "nondeterministic choice '{1}-{2}'.", fingerprint.GetHashCode(), uniqueId, choice);

            return(traceStep);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the current scheduling choice as a program trace step.
        /// </summary>
        /// <param name="scheduledMachine">Scheduled machine</param>
        /// <param name="enabledMachines">Enabled machines</param>
        /// <returns>TraceStep</returns>
        private TraceStep GetSchedulingChoiceTraceStep(Machine scheduledMachine,
                                                       HashSet <Machine> enabledMachines)
        {
            var fingerprint = PSharpRuntime.CaptureProgramState();
            var traceStep   = TraceStep.CreateSchedulingChoice(fingerprint, scheduledMachine,
                                                               enabledMachines, PSharpRuntime.LivenessChecker.GetMonitorStatus());

            Output.Debug(DebugType.Liveness, "<LivenessDebug> Captured program state '{0}' at " +
                         "scheduling choice.", fingerprint.GetHashCode());

            return(traceStep);
        }