66using UnityEditor.IMGUI.Controls;
77using System.IO;
88using System.Linq;
9- using Newtonsoft.Json;
109using Unity.PerformanceTesting.Data;
1110using Unity.PerformanceTesting.Runtime;
1211
13- namespace Unity.PerformanceTesting
12+ namespace Unity.PerformanceTesting.Editor
1413{
1514 public class TestReportWindow : EditorWindow
1615 {
@@ -57,6 +56,8 @@ public class TestReportWindow : EditorWindow
5756 Vector2 m_sampleGroupScroll = new Vector2(0, 0);
5857 List<SampleGroupAdditionalData> m_sampleGroupAdditionalData = new List<SampleGroupAdditionalData>();
5958
59+ private const int m_chartLimit = 1000;
60+
6061 private void CreateTestListTable()
6162 {
6263 if (m_testListTreeViewState == null)
@@ -97,7 +98,7 @@ public void SelectTest(string name)
9798 }
9899 }
99100
100- public void SelectTest(TestResult result)
101+ public void SelectTest(PerformanceTestResult result)
101102 {
102103 m_selectedTest = result.Name;
103104
@@ -173,7 +174,7 @@ private void LoadData()
173174 if (!File.Exists(filePath)) return;
174175
175176 string json = File.ReadAllText(filePath);
176- m_resultsData = JsonConvert.DeserializeObject <Run>(json);
177+ m_resultsData = JsonUtility.FromJson <Run>(json);
177178 ResetFileCheck();
178179
179180 List<SamplePoint> samplePoints = new List<SamplePoint>();
@@ -304,7 +305,6 @@ private void Refresh()
304305 SelectTest(m_selectedTest);
305306 else
306307 SelectTest(0);
307-
308308 Repaint();
309309 }
310310
@@ -446,7 +446,7 @@ private void Draw()
446446 {
447447 var data = m_sampleGroupAdditionalData[dataIndex];
448448 dataIndex++;
449-
449+ var samplesToDraw = sampleGroup.Samples;
450450 float min = data.min;
451451 float lowerQuartile = data.lowerQuartile;
452452 float median = data.median;
@@ -461,7 +461,12 @@ private void Draw()
461461 GUILayout.ExpandHeight(false));
462462 EditorGUILayout.LabelField(sampleGroup.Name, m_boldStyle);
463463 EditorGUILayout.LabelField("Sample Unit: " + sampleGroup.Unit.ToString());
464-
464+ if (samplesToDraw.Count > m_chartLimit)
465+ {
466+ string message = string.Format("Sample Group has more than {0} Samples. The first {0} Samples will be displayed. However, calculations are done according to the all samples received from the test run.", m_chartLimit);
467+ EditorGUILayout.HelpBox(message, MessageType.Warning, true);
468+ samplesToDraw = samplesToDraw.Take(m_chartLimit).ToList();
469+ }
465470 EditorGUILayout.BeginHorizontal(GUILayout.Height(100), GUILayout.ExpandHeight(false));
466471
467472 EditorGUILayout.BeginVertical(GUILayout.Width(100), GUILayout.ExpandHeight(true));
@@ -480,7 +485,7 @@ private void Draw()
480485 GUILayout.FlexibleSpace();
481486 Draw2Column("Min", min);
482487 EditorGUILayout.EndVertical();
483- DrawBarGraph(position.width - 200, 100, sampleGroup.Samples , graphMin, max, median);
488+ DrawBarGraph(position.width - 200, 100, samplesToDraw , graphMin, max, median);
484489 DrawBoxAndWhiskerPlot(50, 100, min, lowerQuartile, median, upperQuartile, max, min, max,
485490 (float)sampleGroup.StandardDeviation, m_colorWhite, m_colorBoxAndWhiskerBackground);
486491 EditorGUILayout.EndHorizontal();
0 commit comments