private void ProfileLoop() { using (_window = new ProfileWindow()) { // Create thread for render loop _renderThread = new Thread(RenderLoop); _renderThread.Start(); while (_profilerRunning) { double time = (double)PerformanceCounter.ElapsedTicks / PerformanceCounter.TicksPerSecond; _window.Update(new FrameEventArgs(time - _prevTime)); _prevTime = time; // Sleep to be less taxing, update usually does very little Thread.Sleep(1); } } }