private void UpdateRouteData(StormancerClientViewModel clientVM, StormancerRouteViewModel route) { if (route.dataChart.Count >= 3600) { route.dataChart.RemoveAt(0); } if (route.messageNbrChart.Count >= 3600) { route.messageNbrChart.RemoveAt(0); } if (route.averageSizeChart.Count >= 3600) { route.averageSizeChart.RemoveAt(0); } route.debit = route.sizeStack; route.curve.AddKey(clientVM.client.Clock, route.sizeStack); route.dataChart.Add(route.sizeStack); route.messageNbrChart.Add(route.messageNbr); route.averageSizeChart.Add(route.averageSize); route.messageNbr = 0; route.sizeStack = 0; }
private void ShowChart() { GUILayout.BeginHorizontal(GUILayout.Width(200), GUILayout.Height(20), GUILayout.MinWidth(100), GUILayout.MaxWidth(300)); if (GUILayout.Button("back", GUILayout.Width(80), GUILayout.Height(20), GUILayout.MinWidth(40), GUILayout.MaxWidth(160))) { routeToShow = null; return; } if (GUILayout.Button("clear", GUILayout.Width(80), GUILayout.Height(20), GUILayout.MinWidth(40), GUILayout.MaxWidth(160))) { while (routeToShow.averageSizeChart.Count > 0) { routeToShow.dataChart.RemoveAt(0); routeToShow.averageSizeChart.RemoveAt(0); routeToShow.messageNbrChart.RemoveAt(0); } } if (GUILayout.Button("Export", GUILayout.Width(80), GUILayout.Height(20), GUILayout.MinWidth(40), GUILayout.MaxWidth(160))) { int i = 0; while (System.IO.File.Exists("Export" + i.ToString() + ".csv")) { i++; } var file = System.IO.File.CreateText("Export" + i.ToString() + ".csv"); i = 0; while (i < routeToShow.averageSizeChart.Count) { file.WriteLine(string.Join(";", new string[] { routeToShow.dataChart[i].ToString(), routeToShow.averageSizeChart[i].ToString(), routeToShow.messageNbrChart[i].ToString() })); i++; } } GUILayout.EndHorizontal(); ChartSlider = GUILayout.HorizontalSlider(ChartSlider, 0, routeToShow.dataChart.Count - 1); if (ChartSlider >= routeToShow.dataChart.Count - 2) { ChartSlider = routeToShow.dataChart.Count - 1; } if (routeToShow.dataChart.Count > 0) { int count = 60; int pos = (int)ChartSlider; calcRange(routeToShow.dataChart.Count - 1, ref pos, ref count); if (chart == null) { chart = new LineChart(window, window.position.height - window.position.height / 10); } chart.data = new List <float> [3]; chart.data[0] = routeToShow.dataChart.GetRange(pos, count); chart.data[1] = routeToShow.averageSizeChart.GetRange(pos, count); chart.data[2] = routeToShow.messageNbrChart.GetRange(pos, count); chart.dataLabels = new List <string> { "bytes per seconds", "average packet size", "number of messages" }; chart.axisLabels = new List <string> { "0" }; chart.DrawChart(); } }
private void ShowScene(int i, StormancerClientViewModel c) { int j = 0; folds[i].scene = EditorGUILayout.Foldout(folds[i].scene, "scenes"); if (folds[i].scene) { EditorGUI.indentLevel++; foreach (StormancerSceneViewModel v in c.scenes.Values) { if (folds[i].scenes.Count - 1 < j) { folds[i].scenes.Add(new SceneFolds()); } EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(GUILayout.Width(200), GUILayout.Height(20), GUILayout.MinWidth(100), GUILayout.MaxWidth(300)); folds[i].scenes[j].routes = EditorGUILayout.Foldout(folds[i].scenes[j].routes, v.scene.Id); //EditorGUILayout.Toggle(" ", v.connected); if (GUILayout.Button("show logs", GUILayout.Width(100)) && logsToShow == null) { logsToShow = v.log; log_scroll = Vector2.zero; } EditorGUILayout.EndHorizontal(); if (folds[i].scenes[j].routes == true) { EditorGUI.indentLevel++; folds[i].scenes[j].serverRoutes = EditorGUILayout.Foldout(folds[i].scenes[j].serverRoutes, "server routes"); if (folds[i].scenes[j].serverRoutes == true) { EditorGUI.indentLevel++; foreach (StormancerRouteViewModel route in v.remotes.Values.OrderBy(r => r.Name)) { GUILayout.BeginHorizontal(GUILayout.Width(400), GUILayout.Height(20), GUILayout.MinWidth(400), GUILayout.MaxWidth(window.position.width / 4)); EditorGUILayout.LabelField(route.Name + " " + route.debit.ToString() + " b/s"); if (GUILayout.Button("Show Chart", GUILayout.Width(90))) { routeToShow = route; } //EditorGUILayout.CurveField(route.curve); GUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } folds[i].scenes[j].localRoutes = EditorGUILayout.Foldout(folds[i].scenes[j].localRoutes, "local routes"); if (folds[i].scenes[j].localRoutes == true) { EditorGUI.indentLevel++; foreach (StormancerRouteViewModel route in v.routes.Values.OrderBy(r => r.Name)) { GUILayout.BeginHorizontal(GUILayout.Width(300), GUILayout.Height(20), GUILayout.MinWidth(150), GUILayout.MaxWidth(400)); EditorGUILayout.LabelField(route.Name + " " + route.debit.ToString() + " b/s"); if (GUILayout.Button("Show Chart", GUILayout.Width(90))) { routeToShow = route; } //EditorGUILayout.CurveField(route.curve); GUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; j++; } EditorGUI.indentLevel--; } }