summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/PerformanceMonitoring/AlertEntry.cs
blob: d5a0b34323a125c66b21810611be59cf1a8ba631 (plain)
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
namespace StardewModdingAPI.Framework.PerformanceMonitoring
{
    /// <summary>A single alert entry.</summary>
    internal readonly struct AlertEntry
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The collection in which the alert occurred.</summary>
        public PerformanceCounterCollection Collection { get; }

        /// <summary>The actual execution time in milliseconds.</summary>
        public double ExecutionTimeMilliseconds { get; }

        /// <summary>The configured alert threshold in milliseconds.</summary>
        public double ThresholdMilliseconds { get; }

        /// <summary>The sources involved in exceeding the threshold.</summary>
        public AlertContext[] Context { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="collection">The collection in which the alert occurred.</param>
        /// <param name="executionTimeMilliseconds">The actual execution time in milliseconds.</param>
        /// <param name="thresholdMilliseconds">The configured alert threshold in milliseconds.</param>
        /// <param name="context">The sources involved in exceeding the threshold.</param>
        public AlertEntry(PerformanceCounterCollection collection, double executionTimeMilliseconds, double thresholdMilliseconds, AlertContext[] context)
        {
            this.Collection = collection;
            this.ExecutionTimeMilliseconds = executionTimeMilliseconds;
            this.ThresholdMilliseconds = thresholdMilliseconds;
            this.Context = context;
        }
    }
}