-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathBenchmarking.cs
More file actions
42 lines (39 loc) · 1.14 KB
/
Benchmarking.cs
File metadata and controls
42 lines (39 loc) · 1.14 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
namespace Waher.Runtime.Profiling
{
/// <summary>
/// Class that keeps track of benchmarking results and timing.
/// </summary>
public class Benchmarking : IDisposable
{
private readonly IBenchmarker benchmarker;
private readonly string name;
private readonly long m;
private readonly long n;
private readonly long startTicks;
/// <summary>
/// Class that keeps track of benchmarking results and timing.
/// </summary>
/// <param name="Benchmarker">Benchmarker object.</param>
/// <param name="Name">Name of benchmark.</param>
/// <param name="N">Complexity of benchmark (N).</param>
/// <param name="M">Complexity of benchmark (M).</param>
/// <param name="StartTicks">Start ticks.</param>
internal Benchmarking(IBenchmarker Benchmarker, string Name, long N, long M,
long StartTicks)
{
this.benchmarker = Benchmarker;
this.name = Name;
this.n = N;
this.m = M;
this.startTicks = StartTicks;
}
/// <summary>
/// Stops the benchmarking test and disposes the object.
/// </summary>
public void Dispose()
{
this.benchmarker.Stop(this.name, this.n, this.m, this.startTicks);
}
}
}