public FrameMonitor(ApplicationWorker worker) { listeners = ArrayPool <IFrameListener> .Shared.Rent(worker.FrameListener.Count); worker.FrameListener.CopyTo(listeners, 0); this.worker = worker; this.worker.frameDeltaStopwatch.Restart(); }
public WorkerMonitor(ApplicationWorker worker, TimeSpan targetFrameRate) { this.worker = worker; lock (this.worker.synchronizationObject) { this.worker.targetFrameRate = targetFrameRate; this.worker.Delta = TimeSpan.Zero; } if (!this.worker.elapsedStopwatch.IsRunning) { this.worker.elapsedStopwatch.Start(); } this.worker.deltaStopwatch.Restart(); }