Ejemplo n.º 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,
                }
            });
        }
Ejemplo n.º 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);
        }
        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);
        }
        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));
            }
        }
Ejemplo n.º 5
0
 public FpsDisplay(string name, ThrottledFrameClock clock)
 {
     this.name  = name;
     this.clock = clock;
 }