Beispiel #1
0
        public static void Inject(Program program, IEnumerable <Implementation> implementations, string requestId,
                                  string programId, out long[] cachingActionCounts)
        {
            var eai = new CachedVerificationResultInjector(program);

            cachingActionCounts = new long[Enum.GetNames(typeof(VC.ConditionGeneration.CachingAction)).Length];
            var run = new CachedVerificationResultInjectorRun
            {
                Start = DateTime.UtcNow, ImplementationCount = implementations.Count(),
                CachingActionCounts = cachingActionCounts
            };

            foreach (var impl in implementations)
            {
                int priority;
                var vr = ExecutionEngine.Cache.Lookup(impl, out priority);
                if (vr != null && vr.ProgramId == programId)
                {
                    if (priority == Priority.LOW)
                    {
                        run.LowPriorityImplementationCount++;
                    }
                    else if (priority == Priority.MEDIUM)
                    {
                        run.MediumPriorityImplementationCount++;
                    }
                    else if (priority == Priority.HIGH)
                    {
                        run.HighPriorityImplementationCount++;
                    }
                    else if (priority == Priority.SKIP)
                    {
                        run.SkippedImplementationCount++;
                    }

                    if (priority == Priority.LOW || priority == Priority.MEDIUM || CommandLineOptions.Clo.VerifySnapshots >= 3)
                    {
                        if (TimeThreshold < vr.End.Subtract(vr.Start).TotalMilliseconds)
                        {
                            SetErrorAndAssertionChecksumsInCachedSnapshot(impl, vr);
                            if (vr.ProgramId != null)
                            {
                                var p = ExecutionEngine.CachedProgram(vr.ProgramId);
                                if (p != null)
                                {
                                    eai.Inject(impl, p);
                                    run.TransformedImplementationCount++;
                                }
                            }
                        }
                    }
                }
            }

            run.End = DateTime.UtcNow;
            Statistics.AddRun(requestId, run);
        }
Beispiel #2
0
 public bool AddRun(string requestId, CachedVerificationResultInjectorRun run)
 {
     return(runs.TryAdd(requestId, run));
 }
 public bool AddRun(string requestId, CachedVerificationResultInjectorRun run)
 {
   return runs.TryAdd(requestId, run);
 }
    public static void Inject(Program program, IEnumerable<Implementation> implementations, string requestId, string programId, out long[] cachingActionCounts)
    {
      var eai = new CachedVerificationResultInjector(program, implementations);

      cachingActionCounts = new long[Enum.GetNames(typeof(VC.ConditionGeneration.CachingAction)).Length];
      var run = new CachedVerificationResultInjectorRun { Start = DateTime.UtcNow, ImplementationCount = implementations.Count(), CachingActionCounts = cachingActionCounts };
      foreach (var impl in implementations)
      {
        int priority;
        var vr = ExecutionEngine.Cache.Lookup(impl, out priority);
        if (vr != null && vr.ProgramId == programId)
        {
          if (priority == Priority.LOW) {
            run.LowPriorityImplementationCount++;
          } else if (priority == Priority.MEDIUM) {
            run.MediumPriorityImplementationCount++;
          } else if (priority == Priority.HIGH) {
            run.HighPriorityImplementationCount++;
          } else if (priority == Priority.SKIP) {
            run.SkippedImplementationCount++;
          }

          if (priority == Priority.LOW || priority == Priority.MEDIUM || 3 <= CommandLineOptions.Clo.VerifySnapshots) {
            if (TimeThreshold < vr.End.Subtract(vr.Start).TotalMilliseconds) {
              SetErrorAndAssertionChecksumsInCachedSnapshot(impl, vr);
              if (vr.ProgramId != null) {
                var p = ExecutionEngine.CachedProgram(vr.ProgramId);
                if (p != null) {
                  eai.Inject(impl, p);
                  run.TransformedImplementationCount++;
                }
              }
            }
          }
        }
      }
      run.End = DateTime.UtcNow;
      Statistics.AddRun(requestId, run);
    }