CpuGpuTime RunScenario(IScenarioRunner runner, CanvasRenderTarget rt)
            {
                while (true)
                {
                    Stopwatch stopWatch = new Stopwatch();

                    using (GpuStopWatch gpuStopWatch = new GpuStopWatch(rt.Device))
                    {
                        gpuStopWatch.Start();
                        stopWatch.Start();

                        using (var ds = rt.CreateDrawingSession())
                        {
                            ds.Clear(Colors.Black);
                            runner.RunScenario(ds, SortMode);
                        }

                        stopWatch.Stop();
                        gpuStopWatch.Stop();

                        var gpuTime = gpuStopWatch.GetGpuTimeInMs();
                        if (gpuTime < 0)
                        {
                            // try again until we get a time that isn't disjoint
                            continue;
                        }

                        return(new CpuGpuTime
                        {
                            CpuTimeInMs = stopWatch.Elapsed.TotalMilliseconds,
                            GpuTimeInMs = gpuTime
                        });
                    }
                }
            }
            CpuGpuTime RunScenario(IScenarioRunner runner, CanvasRenderTarget rt)
            {
                while (true)
                {
                    Stopwatch stopWatch = new Stopwatch();

                    using (GpuStopWatch gpuStopWatch = new GpuStopWatch(rt.Device))
                    {

                        gpuStopWatch.Start();
                        stopWatch.Start();

                        using (var ds = rt.CreateDrawingSession())
                        {
                            ds.Clear(Colors.Black);
                            runner.RunScenario(ds, SortMode);
                        }

                        stopWatch.Stop();
                        gpuStopWatch.Stop();

                        var gpuTime = gpuStopWatch.GetGpuTimeInMs();
                        if (gpuTime < 0)
                        {
                            // try again until we get a time that isn't disjoint
                            continue;
                        }

                        return new CpuGpuTime
                        {
                            CpuTimeInMs = stopWatch.Elapsed.TotalMilliseconds,
                            GpuTimeInMs = gpuTime
                        };
                    }
                }
            }