- Timestamp:
- 06/28/12 14:57:20 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r7576 r8149 81 81 82 82 [Storable] 83 private TimeSpan runsExecutionTime; 84 85 [Storable] 83 86 private IOptimizer optimizer; 84 87 public IOptimizer Optimizer { … … 160 163 executionState = ExecutionState.Stopped; 161 164 executionTime = TimeSpan.Zero; 165 runsExecutionTime = TimeSpan.Zero; 162 166 repetitions = 10; 163 167 repetitionsCounter = 0; … … 169 173 executionState = ExecutionState.Stopped; 170 174 executionTime = TimeSpan.Zero; 175 runsExecutionTime = TimeSpan.Zero; 171 176 repetitions = 10; 172 177 repetitionsCounter = 0; … … 177 182 executionState = ExecutionState.Stopped; 178 183 executionTime = TimeSpan.Zero; 184 runsExecutionTime = TimeSpan.Zero; 179 185 repetitions = 10; 180 186 repetitionsCounter = 0; … … 192 198 executionState = original.executionState; 193 199 executionTime = original.executionTime; 200 runsExecutionTime = original.runsExecutionTime; 194 201 optimizer = cloner.Clone(original.optimizer); 195 202 repetitions = original.repetitions; … … 218 225 throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState)); 219 226 if (Optimizer != null) { 227 ExecutionTime = TimeSpan.Zero; 220 228 repetitionsCounter = 0; 221 229 if (clearRuns) runs.Clear(); … … 353 361 private void Optimizer_Stopped(object sender, EventArgs e) { 354 362 repetitionsCounter++; 363 ExecutionTime += runsExecutionTime; 364 runsExecutionTime = TimeSpan.Zero; 355 365 356 366 if (batchRunStopped) OnStopped(); … … 385 395 } 386 396 private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 387 foreach (IRun run in e.OldItems) {388 IItem item;389 run.Results.TryGetValue("Execution Time", out item);390 TimeSpanValue executionTime = item as TimeSpanValue;391 if (executionTime != null) ExecutionTime -= executionTime.Value;392 }393 397 if (Optimizer != null) Optimizer.Runs.RemoveRange(e.OldItems); 394 398 foreach (IRun run in e.Items) { … … 404 408 run.Results.TryGetValue("Execution Time", out item); 405 409 TimeSpanValue executionTime = item as TimeSpanValue; 406 if (executionTime != null) ExecutionTime += executionTime.Value; 410 if (executionTime != null) { 411 if (Optimizer.ExecutionState == ExecutionState.Started) 412 runsExecutionTime += executionTime.Value; 413 else 414 ExecutionTime += executionTime.Value; 415 } 407 416 } 408 417 } 409 418 private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { 410 foreach (IRun run in e.Items) {411 IItem item;412 run.Results.TryGetValue("Execution Time", out item);413 TimeSpanValue executionTime = item as TimeSpanValue;414 if (executionTime != null) ExecutionTime -= executionTime.Value;415 }416 419 if (Optimizer != null) Optimizer.Runs.RemoveRange(e.Items); 417 420 }
Note: See TracChangeset
for help on using the changeset viewer.