public void RegisterProfiler(DebugProfiler profiler)
 {
     foreach (DebugProfiler item in profilers)
         if (item == profiler)
             return;
     profilers.Add(profiler);
 }
Example #2
0
        public void Run()
        {
            var sw = new Stopwatch();

            sw.Start();

            IntMath.Sqrt(0); // init static

            while (true)
            {
                if (GameTimeService.Ticks >= GameTimeService.TicksPerSecond * 20)
                {
                    Console.WriteLine($"Done! {sw.Elapsed.TotalSeconds} at tick {GameTimeService.Ticks}");
                    break;
                }
                Tick();
            }

            var latch = new CountdownEvent(1);

            new Thread(() => {
                DebugProfiler.DumpToClipboard();
                latch.Signal();
            })
            {
                ApartmentState = ApartmentState.STA
            }.Start();
            latch.Wait();
        }
Example #3
0
        public void Tick()
        {
            DebugProfiler.EnterTick(GameTimeService.Ticks);

            GameEventQueueService.ProcessPendingGameEvents(out var eventsProcessed);

            EntityService.ProcessSystems();

            DebugProfiler.LeaveTick();

            foreach (var debugger in Debuggers)
            {
                debugger.HandleFrameEnd(new FrameEndStatistics {
                    EventsProcessed = eventsProcessed
                });
            }

            GameTimeService.IncrementTicks();
        }