Changeset 7047
- Timestamp:
- 11/22/11 21:27:07 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.Hive.Web/Hive-3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx
r6993 r7047 7 7 <head runat="server"> 8 8 <title>HeuristicLab Hive Status Monitor</title> 9 <link rel="icon" type="image/ico" href="HeuristicLab.ico" >9 <link rel="icon" type="image/ico" href="HeuristicLab.ico" /> 10 10 </head> 11 11 <body> … … 24 24 <asp:Label ID="waitingJobsLabel" runat="server" /> 25 25 <br /> 26 Avg. CPU Utilization: 27 <asp:Label ID="cpuUtilizationLabel" runat="server" /> 28 <br /> 26 29 Slaves (CPU Utilization): 27 30 <asp:Label ID="slavesLabel" runat="server" /> 28 <br /> 29 Avg. CPU Utilization: 30 <asp:Label ID="cpuUtilizationLabel" runat="server" /> 31 <br /> 31 <br /> 32 32 <br /> 33 33 Days: 34 <asp:DropDownList ID="daysDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="daysDropDownList_SelectedIndexChanged">34 <asp:DropDownList ID="daysDropDownList" runat="server" AutoPostBack="True"> 35 35 <asp:ListItem Value="1"></asp:ListItem> 36 36 <asp:ListItem Value="2"></asp:ListItem> … … 122 122 </asp:Chart> 123 123 <br /> 124 Speedup (ComputedMinutes/Minute)<br /> 125 <asp:Chart ID="speedupChartMinutes" runat="server" Palette="None" Width="1900px" 126 PaletteCustomColors="79, 129, 189"> 127 <Series> 128 <asp:Series ChartType="Area" Name="Speedup" XValueType="DateTime" YValueType="Double"> 129 </asp:Series> 130 <asp:Series BorderWidth="2" ChartArea="ChartArea1" 131 ChartType="Line" Color="185, 205, 150" Name="Cores"> 132 </asp:Series> 133 </Series> 134 <ChartAreas> 135 <asp:ChartArea BackColor="Black" BackHatchStyle="DottedGrid" BackSecondaryColor="0, 96, 43" 136 BorderColor="DarkGreen" BorderDashStyle="Dot" Name="ChartArea1"> 137 <AxisY Minimum="-5"> 138 <MajorGrid Enabled="False" /> 139 </AxisY> 140 <AxisX IntervalAutoMode="VariableCount" IntervalOffset="1" IntervalOffsetType="Hours" 141 IntervalType="Hours" IsLabelAutoFit="False" > 142 <MajorGrid Enabled="False" /> 143 <LabelStyle Format="d/M/yyyy HH:mm" IsStaggered="True" /> 144 </AxisX> 145 </asp:ChartArea> 146 </ChartAreas> 147 </asp:Chart> 148 <br /> 149 Speedup (ComputedHours/Hour)<br /> 150 <br /> 151 <asp:Chart ID="speedupChartHours" runat="server" Palette="None" Width="1900px" PaletteCustomColors="79, 129, 189"> 152 <Series> 153 <asp:Series ChartType="Area" Name="Speedup" XValueType="DateTime" 154 YValueType="Double"> 155 </asp:Series> 156 <asp:Series BorderWidth="2" ChartArea="ChartArea1" 157 ChartType="Line" Color="185, 205, 150" Name="Cores"> 158 </asp:Series> 159 </Series> 160 <ChartAreas> 161 <asp:ChartArea BackColor="Black" BackHatchStyle="DottedGrid" BackSecondaryColor="0, 96, 43" 162 BorderColor="DarkGreen" BorderDashStyle="Dot" Name="ChartArea1"> 163 <AxisY> 164 <MajorGrid Enabled="False" /> 165 </AxisY> 166 <AxisX IntervalAutoMode="VariableCount" IntervalOffset="1" IntervalOffsetType="Hours" 167 IntervalType="Hours" IsLabelAutoFit="False"> 168 <MajorGrid Enabled="False" /> 169 <LabelStyle Format="d/M/yyyy HH:mm" IsStaggered="True" /> 170 </AxisX> 171 </asp:ChartArea> 172 </ChartAreas> 173 </asp:Chart> 174 <br /> 124 <br /> 175 125 </div> 176 126 </form> -
trunk/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs
r6993 r7047 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 } 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); 71 84 72 85 for (int i = 0; i < stats.Length; i++) { … … 87 100 memoryChart.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), memory / 1024.0); 88 101 memoryChart.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), usedMemory / 1024.0); 89 90 if (i > 0) {91 var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));92 var execTimePrev = new TimeSpan(stats[i - 1].UserStatistics.Sum(x => x.ExecutionTime.Ticks));93 var execTimeDifference = execTimePrev - execTime;94 95 var timeDifference = stats[i - 1].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute96 var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;97 speedupChartMinutes.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);98 speedupChartMinutes.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);99 }100 if (i - 60 >= 0) {101 var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));102 var execTimePrev = new TimeSpan(stats[i - 60].UserStatistics.Sum(x => x.ExecutionTime.Ticks));103 var execTimeDifference = execTimePrev - execTime;104 105 var timeDifference = stats[i - 60].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute106 var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;107 speedupChartHours.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);108 speedupChartHours.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);109 }110 102 } 111 103 } 112 113 protected void daysDropDownList_SelectedIndexChanged(object sender, EventArgs e) {114 115 }116 104 }
Note: See TracChangeset
for help on using the changeset viewer.