当前位置: 首页>>代码示例>>C#>>正文


C# ErrorHandler.OnResourceExceeded方法代码示例

本文整理汇总了C#中ErrorHandler.OnResourceExceeded方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler.OnResourceExceeded方法的具体用法?C# ErrorHandler.OnResourceExceeded怎么用?C# ErrorHandler.OnResourceExceeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


在下文中一共展示了ErrorHandler.OnResourceExceeded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckOutcomeCore


//.........这里部分代码省略.........

              if (CommandLineOptions.Clo.TraceDiagnosticsOnTimeout)
              {
                Console.Out.WriteLine("Starting timeout diagnostics with initial time limit {0}.", options.TimeLimit);
              }

              SendThisVC("; begin timeout diagnostics");

              var start = DateTime.UtcNow;
              var unverified = new SortedSet<int>(ctx.TimeoutDiagnosticIDToAssertion.Keys);
              var timedOut = new SortedSet<int>();
              int frac = 2;
              int queries = 0;
              int timeLimitPerAssertion = 0 < options.TimeLimit ? (options.TimeLimit / 100) * CommandLineOptions.Clo.TimeLimitPerAssertionInPercent : 1000;
              while (true)
              {
                int rem = unverified.Count;
                if (rem == 0)
                {
                  if (0 < timedOut.Count)
                  {
                    result = CheckSplit(timedOut, ref popLater, options.TimeLimit, timeLimitPerAssertion, ref queries);
                    if (result == Outcome.Valid)
                    {
                      timedOut.Clear();
                    }
                    else if (result == Outcome.TimeOut)
                    {
                      // Give up and report which assertions were not verified.
                      var cmds = timedOut.Select(id => ctx.TimeoutDiagnosticIDToAssertion[id]);

                      if (cmds.Any())
                      {
                        handler.OnResourceExceeded("timeout after running diagnostics", cmds);
                      }
                    }
                  }
                  else
                  {
                    result = Outcome.Valid;
                  }
                  break;
                }

                // TODO(wuestholz): Try out different ways for splitting up the work (e.g., randomly).
                var cnt = Math.Max(1, rem / frac);
                // It seems like assertions later in the control flow have smaller indexes.
                var split = new SortedSet<int>(unverified.Where((val, idx) => (rem - idx - 1) < cnt));
                Contract.Assert(0 < split.Count);
                var splitRes = CheckSplit(split, ref popLater, timeLimitPerAssertion, timeLimitPerAssertion, ref queries);
                if (splitRes == Outcome.Valid)
                {
                  unverified.ExceptWith(split);
                  frac = 1;
                }
                else if (splitRes == Outcome.Invalid)
                {
                  result = splitRes;
                  break;
                }
                else if (splitRes == Outcome.TimeOut)
                {
                  if (2 <= frac && (4 <= (rem / frac)))
                  {
                    frac *= 4;
                  }
开发者ID:qunyanm,项目名称:boogie,代码行数:67,代码来源:ProverInterface.cs


注:本文中的ErrorHandler.OnResourceExceeded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。