/
IPerformanceCounter.cs
68 lines (58 loc) · 1.95 KB
/
IPerformanceCounter.cs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
namespace JetBlack.Diagnostics.Monitoring
{
/// <summary>
/// An interface describing a performance counter.
///
/// We provide this interface in order to mock counters. If an actual performance counter
/// is used it must be installed. This is inconvenient for development and testing.
/// </summary>
public interface IPerformanceCounter : IDisposable
{
/// <summary>
/// The category name.
/// </summary>
string CategoryName { get; set; }
/// <summary>
/// The counter name.
/// </summary>
string CounterName { get; set; }
/// <summary>
/// This instance name of a multi instance counter, otherwise null.
/// </summary>
string InstanceName { get; set; }
/// <summary>
/// The machine name.
/// </summary>
string MachineName { get; set; }
/// <summary>
/// If true, the counter is read only, otherwise it may be written to.
/// </summary>
bool ReadOnly { get; set; }
/// <summary>
/// The raw value of the counter.
/// </summary>
long RawValue { get; set; }
/// <summary>
/// Increment the counter by 1.
/// </summary>
/// <returns></returns>
long Increment();
/// <summary>
/// Decrement the counter by 1.
/// </summary>
/// <returns></returns>
long Decrement();
/// <summary>
/// Increment the counter by a signed amount.
/// </summary>
/// <param name="value">The (possibly negative) amount by which the counter should be incremented.</param>
/// <returns>The new raw value of the counter.</returns>
long IncrementBy(long value);
/// <summary>
/// Sample the counter.
/// </summary>
/// <returns>The calculated value of the next sample.</returns>
float NextValue();
}
}