Commit 578e6395 by Michael Schmid

Changes in Testenvironment

parent 31cab85d
...@@ -17,28 +17,39 @@ import mvd.jester.tests.SchmidMottok; ...@@ -17,28 +17,39 @@ import mvd.jester.tests.SchmidMottok;
*/ */
public class App { public class App {
public static void main(String[] args) { public static void main(String[] args) {
{ // {
SystemManager manager = new SystemManager(8); // SystemManager manager = new SystemManager(8);
DagTaskBuilder builder = new DagTaskBuilder(); // DagTaskBuilder builder = new DagTaskBuilder();
TestEnvironment te = new TestEnvironment(); // TestEnvironment te = new TestEnvironment();
List<AbstractTest<DagTask>> tests = // List<AbstractTest<DagTask>> tests =
te.registerTests(Arrays.asList(new SchmidMottok(manager), // te.registerTests(Arrays.asList(new SchmidMottok(manager),
new MelaniButtazzo(manager), new FonsecaNelis(manager))); // new MelaniButtazzo(manager), new FonsecaNelis(manager)));
te.varyUtilization(builder, tests, 8, 500); // te.varyUtilization(builder, tests, 8, 500);
} // }
{ // {
SystemManager manager = new SystemManager(8); // SystemManager manager = new SystemManager(8);
DagTaskBuilder builder = new DagTaskBuilder(); // DagTaskBuilder builder = new DagTaskBuilder();
TestEnvironment te = new TestEnvironment(); // TestEnvironment te = new TestEnvironment();
List<AbstractTest<DagTask>> tests = // List<AbstractTest<DagTask>> tests =
te.registerTests(Arrays.asList(new SchmidMottok(manager), // te.registerTests(Arrays.asList(new SchmidMottok(manager),
new MelaniButtazzo(manager), new FonsecaNelis(manager))); // new MelaniButtazzo(manager), new FonsecaNelis(manager)));
te.varyNumberOfProcessors(builder, tests, manager, 500); // te.varyNumberOfProcessors(builder, tests, manager, 500);
} // }
// {
// SystemManager manager = new SystemManager(8);
// DagTaskBuilder builder = new DagTaskBuilder();
// TestEnvironment te = new TestEnvironment();
// List<AbstractTest<DagTask>> tests =
// te.registerTests(Arrays.asList(new SchmidMottok(manager),
// new MelaniButtazzo(manager), new FonsecaNelis(manager)));
// te.varyNumberOfTasks(builder, tests, 8, 500);
// }
{ {
SystemManager manager = new SystemManager(8); SystemManager manager = new SystemManager(8);
DagTaskBuilder builder = new DagTaskBuilder(); DagTaskBuilder builder = new DagTaskBuilder();
...@@ -48,7 +59,7 @@ public class App { ...@@ -48,7 +59,7 @@ public class App {
te.registerTests(Arrays.asList(new SchmidMottok(manager), te.registerTests(Arrays.asList(new SchmidMottok(manager),
new MelaniButtazzo(manager), new FonsecaNelis(manager))); new MelaniButtazzo(manager), new FonsecaNelis(manager)));
te.varyNumberOfTasks(builder, tests, 8, 500); te.measureExecutionTimes(builder, tests, manager, 500);
} }
} }
} }
package mvd.jester; package mvd.jester;
import java.lang.management.ManagementFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -7,8 +8,6 @@ import java.util.Map; ...@@ -7,8 +8,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch;
import mvd.jester.info.SchedulingInfo; import mvd.jester.info.SchedulingInfo;
import mvd.jester.info.SchedulingInfo.Feasiblity; import mvd.jester.info.SchedulingInfo.Feasiblity;
import mvd.jester.model.DagTask; import mvd.jester.model.DagTask;
...@@ -81,21 +80,21 @@ public class TestEnvironment { ...@@ -81,21 +80,21 @@ public class TestEnvironment {
public void measureExecutionTimes(final DagTaskBuilder builder, public void measureExecutionTimes(final DagTaskBuilder builder,
final List<AbstractTest<DagTask>> abstractTestInstances, final List<AbstractTest<DagTask>> abstractTestInstances,
final long numberOfMeasurements) { SystemManager manager, final long numberOfMeasurements) {
Map<AbstractTest<DagTask>, List<Long>> results = new LinkedHashMap<>(); Map<AbstractTest<DagTask>, List<Long>> results = new LinkedHashMap<>();
abstractTestInstances.forEach(t -> results.put(t, new ArrayList<>())); abstractTestInstances.forEach(t -> results.put(t, new ArrayList<>()));
for (int i = 0; i < numberOfMeasurements; ++i) { for (int i = 0; i < numberOfMeasurements; ++i) {
double utilization = ThreadLocalRandom.current().nextDouble(1, 7); double utilization = ThreadLocalRandom.current().nextDouble(1, manager.getNumberOfProcessors());
Set<DagTask> taskSet = builder.generateTaskSet(utilization); Set<DagTask> taskSet = builder.generateTaskSet(utilization);
for (AbstractTest<DagTask> testInstance : abstractTestInstances) { for (AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager(); final PriorityManager priorityManager = testInstance.getPriorityManager();
final SortedTaskSet<DagTask> sortedTaskSet = new SortedTaskSet<>(priorityManager); final SortedTaskSet<DagTask> sortedTaskSet = new SortedTaskSet<>(priorityManager);
sortedTaskSet.addAll(taskSet); sortedTaskSet.addAll(taskSet);
Stopwatch w = Stopwatch.createStarted(); long timeBefore = ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();
testInstance.runSchedulabilityCheck(sortedTaskSet); testInstance.runSchedulabilityCheck(sortedTaskSet);
w.stop(); long timeAfter = ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();
long micros = w.elapsed(TimeUnit.MICROSECONDS); long micros = (timeAfter-timeBefore)/1000;
results.get(testInstance).add(micros); results.get(testInstance).add(micros);
} }
} }
...@@ -126,8 +125,7 @@ public class TestEnvironment { ...@@ -126,8 +125,7 @@ public class TestEnvironment {
final Set<DagTask> taskSet = builder.generateUUnifastTaskSet( final Set<DagTask> taskSet = builder.generateUUnifastTaskSet(
(long) (1.5 * numberOfProcessors), (double) numberOfProcessors * 0.5); (long) (1.5 * numberOfProcessors), (double) numberOfProcessors * 0.5);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100) System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) { for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager(); final PriorityManager priorityManager = testInstance.getPriorityManager();
...@@ -168,8 +166,7 @@ public class TestEnvironment { ...@@ -168,8 +166,7 @@ public class TestEnvironment {
final Set<DagTask> taskSet = builder.generateUUnifastTaskSet(numberOfTasks, final Set<DagTask> taskSet = builder.generateUUnifastTaskSet(numberOfTasks,
(double) numberOfProcessors * 0.5); (double) numberOfProcessors * 0.5);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100) System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) { for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager(); final PriorityManager priorityManager = testInstance.getPriorityManager();
...@@ -209,8 +206,7 @@ public class TestEnvironment { ...@@ -209,8 +206,7 @@ public class TestEnvironment {
for (int i = 0; i < numberOfTaskSetsPerUtil; ++i) { for (int i = 0; i < numberOfTaskSetsPerUtil; ++i) {
final Set<DagTask> taskSet = builder.generateTaskSet(util); final Set<DagTask> taskSet = builder.generateTaskSet(util);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100) System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) { for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager(); final PriorityManager priorityManager = testInstance.getPriorityManager();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment