public PerformanceMonitor(IFrameBasedClock clock)
        {
            Clock = clock;

            for (int i = 0; i < (int)PerformanceCollectionType.AmountTypes; i++)
            {
                var t = (PerformanceCollectionType)i;
                endCollectionDelegates[i] = new InvokeOnDisposal(() => endCollecting(t));
            }
        }
        internal PerformanceMonitor(IFrameBasedClock clock, 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));
            }
        }
        internal PerformanceMonitor(GameThread thread, IEnumerable <StatisticsCounterType> counters)
        {
            Clock      = thread.Clock;
            threadName = thread.Name;

            isActive = thread.IsActive.GetBoundCopy();
            isActive.BindValueChanged(_ => updateEnabledState());

            currentFrame = FramesPool.Get();

            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));
            }
        }