Commit 578e6395 by Michael Schmid

Changes in Testenvironment

parent 31cab85d
......@@ -17,28 +17,39 @@ import mvd.jester.tests.SchmidMottok;
*/
public class App {
public static void main(String[] args) {
{
SystemManager manager = new SystemManager(8);
DagTaskBuilder builder = new DagTaskBuilder();
TestEnvironment te = new TestEnvironment();
// {
// 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)));
// List<AbstractTest<DagTask>> tests =
// te.registerTests(Arrays.asList(new SchmidMottok(manager),
// new MelaniButtazzo(manager), new FonsecaNelis(manager)));
te.varyUtilization(builder, tests, 8, 500);
}
{
SystemManager manager = new SystemManager(8);
DagTaskBuilder builder = new DagTaskBuilder();
TestEnvironment te = new TestEnvironment();
// te.varyUtilization(builder, tests, 8, 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)));
// List<AbstractTest<DagTask>> tests =
// te.registerTests(Arrays.asList(new SchmidMottok(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);
DagTaskBuilder builder = new DagTaskBuilder();
......@@ -48,7 +59,7 @@ public class App {
te.registerTests(Arrays.asList(new SchmidMottok(manager),
new MelaniButtazzo(manager), new FonsecaNelis(manager)));
te.varyNumberOfTasks(builder, tests, 8, 500);
te.measureExecutionTimes(builder, tests, manager, 500);
}
}
}
package mvd.jester;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -7,8 +8,6 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
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.Feasiblity;
import mvd.jester.model.DagTask;
......@@ -81,21 +80,21 @@ public class TestEnvironment {
public void measureExecutionTimes(final DagTaskBuilder builder,
final List<AbstractTest<DagTask>> abstractTestInstances,
final long numberOfMeasurements) {
SystemManager manager, final long numberOfMeasurements) {
Map<AbstractTest<DagTask>, List<Long>> results = new LinkedHashMap<>();
abstractTestInstances.forEach(t -> results.put(t, new ArrayList<>()));
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);
for (AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager();
final SortedTaskSet<DagTask> sortedTaskSet = new SortedTaskSet<>(priorityManager);
sortedTaskSet.addAll(taskSet);
Stopwatch w = Stopwatch.createStarted();
long timeBefore = ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();
testInstance.runSchedulabilityCheck(sortedTaskSet);
w.stop();
long micros = w.elapsed(TimeUnit.MICROSECONDS);
long timeAfter = ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();
long micros = (timeAfter-timeBefore)/1000;
results.get(testInstance).add(micros);
}
}
......@@ -126,8 +125,7 @@ public class TestEnvironment {
final Set<DagTask> taskSet = builder.generateUUnifastTaskSet(
(long) (1.5 * numberOfProcessors), (double) numberOfProcessors * 0.5);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100)
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager();
......@@ -168,8 +166,7 @@ public class TestEnvironment {
final Set<DagTask> taskSet = builder.generateUUnifastTaskSet(numberOfTasks,
(double) numberOfProcessors * 0.5);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100)
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
final PriorityManager priorityManager = testInstance.getPriorityManager();
......@@ -209,8 +206,7 @@ public class TestEnvironment {
for (int i = 0; i < numberOfTaskSetsPerUtil; ++i) {
final Set<DagTask> taskSet = builder.generateTaskSet(util);
System.out.print(Math.round((double) checkedTasksets / numberOfTaskSets * 100)
+ "% of " + numberOfTaskSets + " tasksets tested!\r");
System.out.print(checkedTasksets +"/"+ numberOfTaskSets + " tasksets tested!\r");
for (final AbstractTest<DagTask> testInstance : abstractTestInstances) {
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