- Timestamp:
- 12/30/11 02:38:12 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3
- Files:
-
- 1 added
- 1 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Dhrystone.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("Dhrystone Benchmark", "Dhrystone performance benchmark algorithm.")]32 [Item("Dhrystone", "Dhrystone performance benchmark.")] 34 33 [StorableClass] 35 public class DhrystoneBenchmark : IBenchmark { 36 private bool stopBenchmark; 37 private CancellationToken cancellationToken; 38 39 public string ItemName { 40 get { return ItemAttribute.GetName(this.GetType()); } 41 } 42 public string ItemDescription { 43 get { return ItemAttribute.GetDescription(this.GetType()); } 44 } 45 public Version ItemVersion { 46 get { return ItemAttribute.GetVersion(this.GetType()); } 47 } 48 public static Image StaticItemImage { 49 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 50 } 51 public Image ItemImage { 52 get { return ItemAttribute.GetImage(this.GetType()); } 53 } 54 55 [Storable] 56 private byte[][] chunk; 57 public byte[][] ChunkData { 58 get { return chunk; } 59 set { chunk = value; } 60 } 61 62 [Storable] 63 private TimeSpan timeLimit; 64 public TimeSpan TimeLimit { 65 get { return timeLimit; } 66 set { timeLimit = value; } 67 } 68 69 70 #region Benchmark Fields 71 34 public sealed class Dhrystone : Benchmark { 72 35 private const int Ident_1 = 0; 73 36 private const int Ident_2 = 1; … … 93 56 private long Default_Number_Of_Runs = 10000000; 94 57 95 #endregion96 97 #region Costructors98 99 58 [StorableConstructor] 100 public DhrystoneBenchmark(bool deserializing) { } 101 102 public DhrystoneBenchmark() { } 103 104 protected DhrystoneBenchmark(DhrystoneBenchmark original, Cloner cloner) { 105 cloner.RegisterClonedObject(original, this); 106 } 107 108 #endregion 109 110 #region Benchmark Methods 59 private Dhrystone(bool deserializing) : base(deserializing) { } 60 private Dhrystone(Dhrystone original, Cloner cloner) : base(original, cloner) { } 61 public Dhrystone() { } 62 63 public override IDeepCloneable Clone(Cloner cloner) { 64 return new Dhrystone(this, cloner); 65 } 66 67 private class Record_Type { 68 public Record_Type Record_Comp; 69 public int Discr; 70 public int Enum_Comp; 71 public int Int_Comp; 72 public string String_Comp; 73 } 74 111 75 // implementation based on Java version: http://www.okayan.jp/DhrystoneApplet/dhry_src.jar 112 113 public void Run(CancellationToken token, ResultCollection results) { 114 cancellationToken = token; 115 stopBenchmark = false; 76 public override void Run(CancellationToken cancellationToken, ResultCollection results) { 77 bool stopBenchmark = false; 116 78 117 79 int Int_Loc_1; … … 189 151 } 190 152 191 if (( timeLimit == null) || (timeLimit.TotalMilliseconds == 0)) {153 if ((TimeLimit == null) || (TimeLimit.TotalMilliseconds == 0)) { 192 154 if (Run_Index > Default_Number_Of_Runs) { 193 155 stopBenchmark = true; 194 156 } 195 } else if (sw.Elapsed > timeLimit) {157 } else if (sw.Elapsed > TimeLimit) { 196 158 stopBenchmark = true; 197 159 } … … 374 336 Int_Glob = 5; 375 337 } 376 377 #endregion378 379 #region Private Class380 381 private class Record_Type {382 public Record_Type Record_Comp;383 public int Discr;384 public int Enum_Comp;385 public int Int_Comp;386 public string String_Comp;387 }388 389 #endregion390 391 #region Clone392 393 public IDeepCloneable Clone(Cloner cloner) {394 return new DhrystoneBenchmark(this, cloner);395 }396 397 public object Clone() {398 return Clone(new Cloner());399 }400 401 #endregion402 403 #region Events404 405 public event EventHandler ItemImageChanged;406 protected virtual void OnItemImageChanged() {407 EventHandler handler = ItemImageChanged;408 if (handler != null) handler(this, EventArgs.Empty);409 }410 411 public event EventHandler ToStringChanged;412 protected virtual void OnToStringChanged() {413 EventHandler handler = ToStringChanged;414 if (handler != null) handler(this, EventArgs.Empty);415 }416 417 #endregion418 419 420 338 } 421 339 } -
trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/HeuristicLab.Algorithms.Benchmarks-3.3.csproj
r7246 r7247 89 89 </ItemGroup> 90 90 <ItemGroup> 91 <Compile Include="Benchmark.cs" /> 91 92 <Compile Include="BenchmarkAlgorithm.cs" /> 92 <Compile Include="Dhrystone Benchmark.cs" />93 <Compile Include="Dhrystone.cs" /> 93 94 <Compile Include="IBenchmark.cs" /> 94 <Compile Include="Linpack Benchmark.cs" />95 <Compile Include="Linpack.cs" /> 95 96 <Compile Include="Plugin.cs" /> 96 97 <Compile Include="Properties\AssemblyInfo.cs" /> 97 <Compile Include="Whetstone Benchmark.cs" />98 <Compile Include="Whetstone.cs" /> 98 99 </ItemGroup> 99 100 <ItemGroup> -
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 } -
trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Whetstone.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("Whetstone Benchmark", "Whetstone performance benchmark algorithm.")]32 [Item("Whetstone", "Whetstone performance benchmark.")] 34 33 [StorableClass] 35 public class WhetstoneBenchmark : 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 Whetstone : Benchmark { 75 35 private long begin_time; 76 36 private long end_time; … … 84 44 private int i, j, k, l, n1, n2, n3, n4, n6, n7, n8, n9, n10, n11; 85 45 86 #endregion87 88 #region Costructors89 90 46 [StorableConstructor] 91 public WhetstoneBenchmark(bool deserializing) { } 92 93 public WhetstoneBenchmark() { } 94 95 protected WhetstoneBenchmark(WhetstoneBenchmark original, Cloner cloner) { 96 cloner.RegisterClonedObject(original, this); 97 } 98 99 #endregion 100 101 #region Whetstone Benchmark 47 private Whetstone(bool deserializing) : base(deserializing) { } 48 private Whetstone(Whetstone original, Cloner cloner) : base(original, cloner) { } 49 public Whetstone() { } 50 51 public override IDeepCloneable Clone(Cloner cloner) { 52 return new Whetstone(this, cloner); 53 } 54 102 55 // implementation based on Java version: www.aicas.com/download/Whetstone.java 103 104 public void Run(CancellationToken token, ResultCollection results) { 105 cancellationToken = token; 106 stopBenchmark = false; 56 public override void Run(CancellationToken cancellationToken, ResultCollection results) { 57 bool stopBenchmark = false; 107 58 108 59 ITERATIONS = 100; // ITERATIONS / 10 = Millions Whetstone instructions … … 132 83 } 133 84 134 if (( timeLimit == null) || (timeLimit.TotalMilliseconds == 0)) {85 if ((TimeLimit == null) || (TimeLimit.TotalMilliseconds == 0)) { 135 86 if (runNumber > defaultNumberOfRuns) { 136 87 stopBenchmark = true; 137 88 } 138 } else if (sw.Elapsed > timeLimit) {89 } else if (sw.Elapsed > TimeLimit) { 139 90 stopBenchmark = true; 140 91 } … … 293 244 e1[l] = e1[j]; 294 245 } 295 296 #endregion297 298 #region Clone299 300 public IDeepCloneable Clone(Cloner cloner) {301 return new WhetstoneBenchmark(this, cloner);302 }303 304 public object Clone() {305 return Clone(new Cloner());306 }307 308 #endregion309 310 #region Events311 312 public event EventHandler ItemImageChanged;313 protected virtual void OnItemImageChanged() {314 EventHandler handler = ItemImageChanged;315 if (handler != null) handler(this, EventArgs.Empty);316 }317 318 public event EventHandler ToStringChanged;319 protected virtual void OnToStringChanged() {320 EventHandler handler = ToStringChanged;321 if (handler != null) handler(this, EventArgs.Empty);322 }323 324 #endregion325 246 } 326 247 }
Note: See TracChangeset
for help on using the changeset viewer.