Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. static void LinearMaxTime()
  2. {
  3. double ElapsedSeconds;
  4. long ElapsedTime = 0, MinTime = long.MaxValue, MaxTime = long.MinValue, IterationElapsedTime;
  5. for (int n = 0; n < (NIter + 1 + 1); ++n)
  6. {
  7. long StartingTime = Stopwatch.GetTimestamp();
  8. bool Present = IsPresent_LinearTime(TestVector, TestVector.Length - 1);
  9. long EndingTime = Stopwatch.GetTimestamp();
  10. IterationElapsedTime = EndingTime - StartingTime;
  11. ElapsedTime += IterationElapsedTime;
  12. if (IterationElapsedTime < MinTime) MinTime = IterationElapsedTime;
  13. if (IterationElapsedTime > MaxTime) MaxTime = IterationElapsedTime;
  14. }
  15. ElapsedTime -= (MinTime + MaxTime);
  16. ElapsedSeconds = ElapsedTime * (1.0 / (NIter * Stopwatch.Frequency));
  17. Console.Write("\t" + ElapsedSeconds.ToString("F4"));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement