/// <summary>
        /// Switch target thread to <see cref="Thread.CurrentThread"/>.
        /// </summary>
        public void MakeCurrent()
        {
            var current = Thread.CurrentThread;

            if (current == thread)
            {
                return;
            }

            thread = Thread.CurrentThread;

            traceCollector?.Dispose();
            traceCollector = new BackgroundStackTraceCollector(thread, ourClock, threadName);
            updateEnabledState();
        }
        internal PerformanceMonitor(ThrottledFrameClock clock, Thread thread, IEnumerable <StatisticsCounterType> counters)
        {
            Clock        = clock;
            currentFrame = FramesHeap.ReserveObject();

            foreach (var c in counters)
            {
                activeCounters[(int)c] = true;
            }

            for (int i = 0; i < FrameStatistics.NUM_PERFORMANCE_COLLECTION_TYPES; i++)
            {
                var t = (PerformanceCollectionType)i;
                endCollectionDelegates[i] = new InvokeOnDisposal(() => endCollecting(t));
            }

            traceCollector = new BackgroundStackTraceCollector(thread, ourClock);
        }