Exemplo n.º 1
0
        public TestListTableItem(int id, int depth, string displayName, PerformanceTestResult performanceTest)
            : base(id, depth,
                   displayName)
        {
            this.performanceTest = performanceTest;

            index     = id;
            deviation = 0f;
            if (performanceTest != null)
            {
                foreach (var sample in performanceTest.SampleGroups)
                {
                    if (sample.Name == "Time")
                    {
                        standardDeviation = sample.StandardDeviation;
                        median            = sample.Median;
                        min = sample.Min;
                        max = sample.Max;

                        deviation = standardDeviation / median;
                        break;
                    }

                    if (sample.Samples.Count <= 1)
                    {
                        standardDeviation = sample.StandardDeviation;
                        median            = sample.Median;
                        min = sample.Min;
                        max = sample.Max;

                        deviation = standardDeviation / median;
                        break;
                    }

                    double thisDeviation = sample.StandardDeviation / sample.Median;
                    if (thisDeviation > deviation)
                    {
                        standardDeviation = sample.StandardDeviation;
                        median            = sample.Median;
                        min = sample.Min;
                        max = sample.Max;

                        deviation = thisDeviation;
                    }
                }
            }
        }
        private static void DeserializeTestResultsV2(IEnumerable <XElement> output, PerformanceTestRun run)
        {
            foreach (var element in output)
            {
                foreach (var line in element.Value.Split('\n'))
                {
                    var json = GetJsonFromHashtag("performancetestresult2", line);
                    if (json == null)
                    {
                        continue;
                    }

                    var result = TryDeserializePerformanceTestResultJsonObject(json);
                    if (result != null)
                    {
                        var pt = new PerformanceTestResult()
                        {
                            TestCategories = result.Categories,
                            TestName       = result.Name,
                            TestVersion    = result.Version,
                            SampleGroups   = result.SampleGroups.Select(sg => new Entities.SampleGroup
                            {
                                Samples           = sg.Samples,
                                Average           = sg.Average,
                                Max               = sg.Max,
                                Median            = sg.Median,
                                Min               = sg.Min,
                                Sum               = sg.Sum,
                                StandardDeviation = sg.StandardDeviation,
                                SampleCount       = sg.Samples.Count,

                                Definition = new SampleGroupDefinition()
                                {
                                    Name             = sg.Name,
                                    SampleUnit       = (Entities.SampleUnit)sg.Unit,
                                    IncreaseIsBetter = sg.IncreaseIsBetter,
                                    Threshold        = sg.Threshold
                                }
                            }).ToList()
                        };
                        run.Results.Add(pt);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private async Task OnRunTestsExecuteAsync(string numberOfFramesAsString)
        {
            var numberOfFrames = int.Parse(numberOfFramesAsString);

            foreach (var performanceTest in PerformanceTests)
            {
                var skiaElement           = performanceTest.CanvasElement;
                var skiaFxElement         = (FrameworkElement)skiaElement;
                var performanceTestResult = new PerformanceTestResult();

                skiaElement.Rendering += OnSkiaRendering;

                for (var i = 0; i < numberOfFrames; i++)
                {
                    var tsc = new TaskCompletionSource();

                    EventHandler <CanvasRenderingEventArgs> handler = null;
                    handler = (sender, e) =>
                    {
                        skiaElement.Rendered -= handler;
                        tsc.SetResult();
                    };

                    skiaElement.Rendered += handler;

                    var stopwatch = Stopwatch.StartNew();

                    // Instead of calling Update, call InvalidateRect for fair comparison
                    skiaFxElement.InvalidateVisual();
                    //skiaElement.Update();

                    await tsc.Task;

                    stopwatch.Stop();

                    performanceTestResult.RegisterFrame((int)stopwatch.ElapsedMilliseconds);
                }

                skiaElement.Rendering -= OnSkiaRendering;

                performanceTest.Result = performanceTestResult;
            }
        }
Exemplo n.º 4
0
        private static PerformanceTestRun ParseJsonV2(string json)
        {
            Run run = null;

            try
            {
                run = JsonConvert.DeserializeObject <Run>(json);
            }
            catch (System.Exception)
            {
                throw;
            }

            if (run != null)
            {
                var testRun = new PerformanceTestRun()
                {
                    BuildSettings = new BuildSettings()
                    {
                        Platform           = run.Player.Platform,
                        BuildTarget        = run.Player.BuildTarget,
                        DevelopmentPlayer  = true,
                        AndroidBuildSystem = run.Player.AndroidBuildSystem
                    },
                    EditorVersion = new EditorVersion()
                    {
                        Branch        = run.Editor.Branch,
                        DateSeconds   = run.Editor.Date,
                        FullVersion   = $"{run.Editor.Version} ({run.Editor.Changeset})",
                        RevisionValue = 0
                    },
                    PlayerSettings = new PlayerSettings()
                    {
                        GpuSkinning             = run.Player.GpuSkinning,
                        GraphicsApi             = run.Player.GraphicsApi,
                        RenderThreadingMode     = run.Player.RenderThreadingMode,
                        ScriptingBackend        = run.Player.ScriptingBackend,
                        AndroidTargetSdkVersion = run.Player.AndroidTargetSdkVersion,
                        EnabledXrTargets        = new List <string>(),
                        ScriptingRuntimeVersion = "",
                        StereoRenderingPath     = GetStereoPath(run.Player.StereoRenderingPath, run.Player.AndroidTargetSdkVersion)
                    },
                    QualitySettings = new QualitySettings()
                    {
                        Vsync                = run.Player.Vsync,
                        AntiAliasing         = run.Player.AntiAliasing,
                        AnisotropicFiltering = run.Player.AnisotropicFiltering,
                        BlendWeights         = run.Player.BlendWeights,
                        ColorSpace           = run.Player.ColorSpace
                    },
                    ScreenSettings = new ScreenSettings()
                    {
                        Fullscreen        = run.Player.Fullscreen,
                        ScreenHeight      = run.Player.ScreenHeight,
                        ScreenWidth       = run.Player.ScreenWidth,
                        ScreenRefreshRate = run.Player.ScreenRefreshRate
                    },
                    PlayerSystemInfo = new Entities.PlayerSystemInfo()
                    {
                        DeviceModel        = run.Hardware.DeviceModel,
                        DeviceName         = run.Hardware.DeviceName,
                        OperatingSystem    = run.Hardware.OperatingSystem,
                        ProcessorCount     = run.Hardware.ProcessorCount,
                        ProcessorType      = run.Hardware.ProcessorType,
                        GraphicsDeviceName = run.Hardware.GraphicsDeviceName,
                        SystemMemorySize   = run.Hardware.SystemMemorySizeMB,
                        XrDevice           = run.Hardware.XrDevice,
                        XrModel            = run.Hardware.XrModel
                    },
                    StartTime = run.Date,
                    TestSuite = run.TestSuite,
                    Results   = new List <PerformanceTestResult>()
                };

                testRun.EndTime = DateTime.Now.ToUniversalTime()
                                  .Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))
                                  .TotalMilliseconds;

                foreach (var res in run.Results)
                {
                    var pt = new PerformanceTestResult()
                    {
                        TestCategories = res.Categories,
                        TestName       = res.Name,
                        TestVersion    = res.Version,
                        SampleGroups   = res.SampleGroups.Select(sg => new Entities.SampleGroup
                        {
                            Samples           = sg.Samples,
                            Average           = sg.Average,
                            Max               = sg.Max,
                            Median            = sg.Median,
                            Min               = sg.Min,
                            Sum               = sg.Sum,
                            StandardDeviation = sg.StandardDeviation,
                            SampleCount       = sg.Samples.Count,
                            Definition        = new SampleGroupDefinition()
                            {
                                Name             = sg.Name,
                                SampleUnit       = (Entities.SampleUnit)sg.Unit,
                                IncreaseIsBetter = sg.IncreaseIsBetter,
                                Threshold        = sg.Threshold
                            }
                        }).ToList()
                    };
                    testRun.Results.Add(pt);
                }

                return(testRun);
            }

            return(null);
        }