- Timestamp:
- 12/30/11 02:38:12 (12 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Linpack.cs
r7246 r7247 22 22 using System; 23 23 using System.Diagnostics; 24 using System.Drawing;25 24 using System.Threading; 26 25 using HeuristicLab.Common; … … 31 30 32 31 namespace HeuristicLab.Algorithms.Benchmarks { 33 [Item("Linpack Benchmark", "Linpack performance benchmark algorithm.")]32 [Item("Linpack", "Linpack performance benchmark.")] 34 33 [StorableClass] 35 public class LinpackBenchmark : IBenchmark { 36 [Storable] 37 private byte[][] chunk; 38 public byte[][] ChunkData { 39 get { return chunk; } 40 set { chunk = value; } 41 } 42 43 [Storable] 44 private TimeSpan timeLimit; 45 public TimeSpan TimeLimit { 46 get { return timeLimit; } 47 set { timeLimit = value; } 48 } 49 50 private bool stopBenchmark; 51 52 private CancellationToken cancellationToken; 53 54 public string ItemName { 55 get { return ItemAttribute.GetName(this.GetType()); } 56 } 57 58 public string ItemDescription { 59 get { return ItemAttribute.GetDescription(this.GetType()); } 60 } 61 62 public Version ItemVersion { 63 get { return ItemAttribute.GetVersion(this.GetType()); } 64 } 65 66 public static Image StaticItemImage { 67 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 68 } 69 public Image ItemImage { 70 get { return ItemAttribute.GetImage(this.GetType()); } 71 } 72 73 #region Benchmark Fields 74 34 public sealed class Linpack : Benchmark { 75 35 private const int DEFAULT_PSIZE = 1500; 76 36 … … 81 41 private double total = 0.0; 82 42 43 private CancellationToken cancellationToken; 83 44 private Stopwatch sw = new Stopwatch(); 84 45 85 #endregion86 87 #region Costructors88 89 46 [StorableConstructor] 90 public LinpackBenchmark(bool deserializing) { } 91 92 public LinpackBenchmark() { } 93 94 public LinpackBenchmark(LinpackBenchmark original, Cloner cloner) { 95 cloner.RegisterClonedObject(original, this); 96 } 97 98 #endregion 99 100 #region Linpack Benchmark 47 private Linpack(bool deserializing) : base(deserializing) { } 48 private Linpack(Linpack original, Cloner cloner) : base(original, cloner) { } 49 public Linpack() { } 50 51 public override IDeepCloneable Clone(Cloner cloner) { 52 return new Linpack(this, cloner); 53 } 54 101 55 // implementation based on Java version: http://www.netlib.org/benchmark/linpackjava/ 102 103 public void Run(CancellationToken token, ResultCollection results) { 56 public override void Run(CancellationToken token, ResultCollection results) { 104 57 cancellationToken = token; 105 stopBenchmark = false;58 bool stopBenchmark = false; 106 59 TimeSpan executionTime = new TimeSpan(); 107 60 bool resultAchieved = false; … … 197 150 198 151 executionTime += sw.Elapsed; 199 if (( timeLimit == null) || (timeLimit.TotalMilliseconds == 0))152 if ((TimeLimit == null) || (TimeLimit.TotalMilliseconds == 0)) 200 153 stopBenchmark = true; 201 else if (executionTime > timeLimit)154 else if (executionTime > TimeLimit) 202 155 stopBenchmark = true; 203 156 } while (!stopBenchmark); … … 534 487 } 535 488 } 536 537 #endregion538 539 #region Clone540 541 public IDeepCloneable Clone(Cloner cloner) {542 return new LinpackBenchmark(this, cloner);543 }544 545 public object Clone() {546 return Clone(new Cloner());547 }548 549 #endregion550 551 #region Events552 553 public event EventHandler ItemImageChanged;554 protected virtual void OnItemImageChanged() {555 EventHandler handler = ItemImageChanged;556 if (handler != null) handler(this, EventArgs.Empty);557 }558 559 public event EventHandler ToStringChanged;560 protected virtual void OnToStringChanged() {561 EventHandler handler = ToStringChanged;562 if (handler != null) handler(this, EventArgs.Empty);563 }564 565 #endregion566 489 } 567 490 }
Note: See TracChangeset
for help on using the changeset viewer.