-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathTestUtilities.cs
More file actions
28 lines (26 loc) · 867 Bytes
/
TestUtilities.cs
File metadata and controls
28 lines (26 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MicrobenchmarkGui
{
public static class TestUtilities
{
/// <summary>
/// Scale iterations to reach target time.
/// </summary>
/// <param name="lastRunIterations">Last iteration count</param>
/// <param name="targetTimeMs">Desired run time</param>
/// <param name="lastTimeMs">Last run time</param>
/// <returns></returns>
public static ulong ScaleIterations(ulong lastRunIterations, float targetTimeMs, float lastTimeMs)
{
if (lastTimeMs < 100)
{
return lastRunIterations * 5;
}
return (ulong)(lastRunIterations * (targetTimeMs / lastTimeMs));
}
}
}