Changeset 7215 for branches/HeuristicLab.Hive.Azure/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs
- Timestamp:
- 12/20/11 13:54:57 (12 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs
r6983 r7215 32 32 using System.Web.UI.DataVisualization.Charting; 33 33 using DA = HeuristicLab.Services.Hive.DataAccess; 34 using DT = HeuristicLab.Services.Hive.DataTransfer; 34 35 35 36 public partial class Status : System.Web.UI.Page { 36 37 protected void Page_Load(object sender, EventArgs e) { 37 38 var dao = ServiceLocator.Instance.HiveDao; 39 var transactionManager = ServiceLocator.Instance.TransactionManager; 38 40 var resourceName = Request.QueryString["resource"]; 39 IEnumerable<Guid> resourceIds; 41 IEnumerable<Guid> resourceIds = new List<Guid>(); 42 IEnumerable<DT.Slave> onlineSlaves = new List<DT.Slave>(); 43 int currentlyJobsWaiting = 0; 44 40 45 if (!string.IsNullOrEmpty(resourceName)) { 41 var resId = dao.GetResources(x => x.Name == resourceName).Single().Id; 42 resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId }); 43 speedupChartHours.Visible = false; 44 speedupChartMinutes.Visible = false; 46 transactionManager.UseTransaction(() => 47 { 48 var resId = dao.GetResources(x => x.Name == resourceName).Single().Id; 49 resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId }); 50 }, false, false); 45 51 } else { 46 resourceIds = dao.GetResources(x => true).Select(y => y.Id); 47 speedupChartHours.Visible = true; 48 speedupChartMinutes.Visible = true; 49 } 50 51 var onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId)); 52 transactionManager.UseTransaction(() => 53 { 54 resourceIds = dao.GetResources(x => true).Select(y => y.Id); 55 }, false, false); 56 } 57 58 transactionManager.UseTransaction(() => 59 { 60 onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId)); 61 currentlyJobsWaiting = dao.GetTasks(x => x.State == DA.TaskState.Waiting).Count(); 62 }, false, false); 52 63 53 64 int currentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue).Sum(s => s.Cores.Value); 54 65 int currentlyUsedCores = currentlyAvailableCores - onlineSlaves.Where(s => s.FreeCores.HasValue).Sum(s => s.FreeCores.Value); 55 int currentlyJobsWaiting = ServiceLocator.Instance.HiveDao.GetTasks(x => x.State == DA.TaskState.Waiting).Count(); 56 66 57 67 this.availableCoresLabel.Text = currentlyAvailableCores.ToString(); 58 68 this.usedCoresLabel.Text = currentlyUsedCores.ToString(); … … 63 73 cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %"; 64 74 65 HeuristicLab.Services.Hive.DataTransfer.Statistics[] stats; 66 if (daysDropDownList.SelectedValue == "All") { 67 stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray(); 68 } else { 69 stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray(); 70 } 71 72 if (stats.Length != 0) { 73 var firstStatisticsDate = stats.OrderBy(x => x.TimeStamp).First().TimeStamp; 74 var statisticsSince = DateTime.Now - firstStatisticsDate; 75 totalExecutionTimeLabel.Text = new TimeSpan(stats.Last().UserStatistics.Sum(x => x.ExecutionTime.Ticks)).ToString() + " (since " + Math.Round(statisticsSince.TotalDays, 2) + " days)"; 76 } else { 77 totalExecutionTimeLabel.Text = "00:00:00.00"; 78 } 75 DT.Statistics[] stats = new DT.Statistics[0]; 76 transactionManager.UseTransaction(() => 77 { 78 if (daysDropDownList.SelectedValue == "All") { 79 stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray(); 80 } else { 81 stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray(); 82 } 83 }, false, false); 79 84 80 85 for (int i = 0; i < stats.Length; i++) { … … 95 100 memoryChart.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), memory / 1024.0); 96 101 memoryChart.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), usedMemory / 1024.0); 97 98 if (i > 0) {99 var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));100 var execTimePrev = new TimeSpan(stats[i - 1].UserStatistics.Sum(x => x.ExecutionTime.Ticks));101 var execTimeDifference = execTimePrev - execTime;102 103 var timeDifference = stats[i - 1].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute104 var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;105 speedupChartMinutes.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);106 speedupChartMinutes.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);107 }108 if (i - 60 >= 0) {109 var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));110 var execTimePrev = new TimeSpan(stats[i - 60].UserStatistics.Sum(x => x.ExecutionTime.Ticks));111 var execTimeDifference = execTimePrev - execTime;112 113 var timeDifference = stats[i - 60].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute114 var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;115 speedupChartHours.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);116 speedupChartHours.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);117 }118 102 } 119 103 } 120 121 protected void daysDropDownList_SelectedIndexChanged(object sender, EventArgs e) {122 123 }124 104 }
Note: See TracChangeset
for help on using the changeset viewer.