< Summary

Information
Class: Hertzole.ScriptableValues.Debugging.StackTraceEntry
Assembly: Hertzole.ScriptableValues
File(s): ./Packages/se.hertzole.scriptable-values/Runtime/Debugging/StackTraceEntry.cs
Tag: 52_28197466029
Line coverage
100%
Covered lines: 27
Uncovered lines: 0
Coverable lines: 27
Total lines: 64
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
StackTraceEntry(...)0%110100%
Equals(...)0%440100%
Equals(...)0%220100%
GetHashCode()0%330100%
operator==(...)0%110100%
operator!=(...)0%110100%

File(s)

./Packages/se.hertzole.scriptable-values/Runtime/Debugging/StackTraceEntry.cs

#LineLine coverage
 1#if UNITY_EDITOR
 2using System;
 3using System.Collections.Generic;
 4using System.Diagnostics;
 5
 6namespace Hertzole.ScriptableValues.Debugging
 7{
 8    /// <summary>
 9    ///     Represents a stack trace entry with a time stamp.
 10    /// </summary>
 11    public readonly struct StackTraceEntry : IEquatable<StackTraceEntry>
 12    {
 13        // Use bytes to use as little memory as possible.
 14        // It's way more efficient than using DateTime.
 15        // We need to be efficient because these stack traces can easily stack up to 1000s of entries.
 16        public readonly byte hour;
 17        public readonly byte minute;
 18        public readonly byte second;
 19
 20        public readonly StackTrace trace;
 21
 22        public StackTraceEntry(StackTrace trace)
 294023        {
 294024            this.trace = trace;
 294025            DateTimeOffset time = DateTimeOffset.Now;
 294026            hour = (byte) time.Hour;
 294027            minute = (byte) time.Minute;
 294028            second = (byte) time.Second;
 294029        }
 30
 31        public bool Equals(StackTraceEntry other)
 4832        {
 4833            return hour == other.hour && minute == other.minute && second == other.second && EqualityComparer<StackTrace
 4834        }
 35
 36        public override bool Equals(object obj)
 1237        {
 1238            return obj is StackTraceEntry other && Equals(other);
 1239        }
 40
 41        public override int GetHashCode()
 2442        {
 43            unchecked
 2444            {
 2445                int hashCode = hour.GetHashCode();
 2446                hashCode = (hashCode * 397) ^ minute.GetHashCode();
 2447                hashCode = (hashCode * 397) ^ second.GetHashCode();
 2448                hashCode = (hashCode * 397) ^ (trace != null ? trace.GetHashCode() : 0);
 2449                return hashCode;
 50            }
 2451        }
 52
 53        public static bool operator ==(StackTraceEntry left, StackTraceEntry right)
 1254        {
 1255            return left.Equals(right);
 1256        }
 57
 58        public static bool operator !=(StackTraceEntry left, StackTraceEntry right)
 1259        {
 1260            return !left.Equals(right);
 1261        }
 62    }
 63}
 64#endif