summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/PerformanceCounter/AlertContext.cs
blob: 63f0a5edfb3a7f54b3ebf1395e6b1119c5b33dda (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
namespace StardewModdingAPI.Framework.PerformanceCounter
{
    /// <summary>The context for an alert.</summary>
    internal struct AlertContext
    {
        /// <summary>The source which triggered the alert.</summary>
        public readonly string Source;

        /// <summary>The elapsed milliseconds.</summary>
        public readonly double Elapsed;

        /// <summary>Creates a new alert context.</summary>
        /// <param name="source">The source which triggered the alert.</param>
        /// <param name="elapsed">The elapsed milliseconds.</param>
        public AlertContext(string source, double elapsed)
        {
            this.Source = source;
            this.Elapsed = elapsed;
        }

        public override string ToString()
        {
            return $"{this.Source}: {this.Elapsed:F2}ms";
        }
    }
}