コード例 #1
0
        public FrameTimeDisplay(ThrottledFrameClock clock)
        {
            this.clock = clock;

            Masking      = true;
            CornerRadius = 5;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.75f
                },
                counter = new SpriteText
                {
                    Anchor     = Anchor.TopRight,
                    Origin     = Anchor.TopRight,
                    Spacing    = new Vector2(-1, 0),
                    Text       = @"...",
                    FixedWidth = true,
                }
            });
        }
コード例 #2
0
        public GameThread(Action onNewFrame, string threadName)
        {
            this.onNewFrame = onNewFrame;
            Thread          = new Thread(runWork)
            {
                Name         = threadName,
                IsBackground = true,
            };

            Clock     = new ThrottledFrameClock();
            Monitor   = new PerformanceMonitor(Clock, Thread, StatisticsCounters);
            Scheduler = new Scheduler(null, Clock);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
 public FpsDisplay(string name, ThrottledFrameClock clock)
 {
     this.name  = name;
     this.clock = clock;
 }