- Timestamp:
- 04/03/09 14:35:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs
r1509 r1512 79 79 } 80 80 81 82 private int CapacityRam(int noCores, int freeCores) { 83 return (((noCores - freeCores) / noCores) * 100); 84 } 85 81 86 /// <summary> 82 87 /// Adds clients to ListView and TreeView … … 91 96 clients = clientManager.GetAllClientGroups(); 92 97 lvClientControl.Items.Clear(); 93 int count = 0;94 98 List<Guid> inGroup = new List<Guid>(); 95 99 foreach (ClientGroup cg in clients.List) { … … 100 104 item = new ListViewItem(ci.Name, 3, lvg); 101 105 } else { 102 item = new ListViewItem(ci.Name, count, lvg); 106 int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores); 107 int usage = 0; 108 if ((percentageUsage >= 0) && (percentageUsage <= 25)) { 109 usage = 0; 110 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) { 111 usage = 1; 112 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) { 113 usage = 2; 114 } 115 116 item = new ListViewItem(ci.Name, usage, lvg); 103 117 } 104 118 item.Tag = ci.Id; 105 119 lvClientControl.Items.Add(item); 106 120 clientInfoObjects.Add(ci.Id, item); 107 count = (count + 1) % 3;108 121 inGroup.Add(ci.Id); 109 122 … … 130 143 item = new ListViewItem(ci.Name, 3, lvunsorted); 131 144 } else { 132 item = new ListViewItem(ci.Name, count, lvunsorted); 145 int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores); 146 int usage = 0; 147 if ((percentageUsage >= 0) && (percentageUsage <= 25)) { 148 usage = 0; 149 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) { 150 usage = 1; 151 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) { 152 usage = 2; 153 } 154 item = new ListViewItem(ci.Name, usage, lvunsorted); 133 155 } 134 156 item.Tag = ci.Id; 135 157 lvClientControl.Items.Add(item); 136 count = (count + 1) % 3;137 158 } 138 159 } … … 213 234 /// </summary> 214 235 private void ClientClicked() { 236 plClientDetails.Visible = true; 215 237 int i = 0; 216 238 while (clientInfo.List[i].Id.ToString() != nameCurrentClient) { … … 218 240 } 219 241 currentClient = clientInfo.List[i]; 220 pbClientControl.Image = ilClientControl.Images[0]; 242 int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores); 243 int usage = 3; 244 if ((currentClient.State != State.offline) && (currentClient.State != State.nullState)) { 245 if ((percentageUsage >= 0) && (percentageUsage <= 25)) { 246 usage = 0; 247 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) { 248 usage = 1; 249 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) { 250 usage = 2; 251 } 252 } 253 pbClientControl.Image = ilClientControl.Images[usage]; 221 254 lblClientName.Text = currentClient.Name; 222 255 lblLogin.Text = currentClient.Login.ToString(); … … 228 261 /// </summary> 229 262 private void JobClicked() { 263 plJobDetails.Visible = true; 230 264 int i = 0; 231 265 while (jobs.List[i].Id.ToString() != nameCurrentJob) { 232 266 i++; 233 267 } 234 lvSnapshots.Enabled = false;268 lvSnapshots.Enabled = true; 235 269 currentJob = jobs.List[i]; 236 270 pbJobControl.Image = ilJobControl.Images[0]; … … 262 296 } 263 297 if (currentJob.State != State.offline) { 264 lvSnapshots. Enabled= true;298 lvSnapshots.Visible = true; 265 299 } else { 266 lvSnapshots. Enabled= false;300 lvSnapshots.Visible = false; 267 301 } 268 302 } … … 329 363 State state = clientInfo.List[change.Position].State; 330 364 System.Diagnostics.Debug.WriteLine(lvClientControl.Items[i].Text.ToString()); 365 int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores); 331 366 if ((state == State.offline) || (state == State.nullState)) { 332 367 lvClientControl.Items[i].ImageIndex = 3; 333 368 } else { 334 lvClientControl.Items[i].ImageIndex = 1; 369 if ((percentageUsage >= 0) && (percentageUsage <= 25)) { 370 lvClientControl.Items[i].ImageIndex = 0; 371 } else if ((percentageUsage > 25) && (percentageUsage <= 75)) { 372 lvClientControl.Items[i].ImageIndex = 1; 373 } else if ((percentageUsage > 75) && (percentageUsage <= 100)) { 374 lvClientControl.Items[i].ImageIndex = 2; 375 } 376 335 377 } 336 378 lvClientControl.Refresh(); … … 497 539 if (ci.Id.Equals(cio.Id)) { 498 540 found = true; 499 if ( ci.State != cio.State) {541 if ((ci.State != cio.State) || (ci.NrOfFreeCores != ci.NrOfFreeCores)) { 500 542 changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Update, Position = i }); 501 543 } … … 573 615 found = true; 574 616 if (job.State != State.offline) { 575 if (!IsEqual(job.Client, jobold.Client)) { 576 changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i }); 577 } else if (job.State != jobold.State) { 617 if ((!IsEqual(job.Client, jobold.Client)) || (job.State != jobold.State) 618 || (job.Percentage != jobold.Percentage)) { 578 619 changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i }); 579 620 }
Note: See TracChangeset
for help on using the changeset viewer.