+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>lsdc</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
-encoding//src/test/java=UTF-8
-encoding//src/test/resources=UTF-8
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.7
+++ /dev/null
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project name="lsdc" default="compile" basedir=".">\r
+\r
+ <property name="src.dir" value="src" />\r
+ <property name="lib.dir" value="lib" />\r
+ <property name="build.dir" value="bin" />\r
+\r
+ <path id="project.classpath">\r
+ <dirset dir="${build.dir}" />\r
+ <fileset dir="${lib.dir}">\r
+ <include name="*.jar" />\r
+ </fileset>\r
+ </path>\r
+\r
+ <assertions id="project.assertions">\r
+ <enable />\r
+ <!-- <disable/> -->\r
+ </assertions>\r
+\r
+ <target name="compile" description="Compile project.">\r
+ <mkdir dir="${build.dir}" />\r
+ <javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="project.classpath" debug="true" deprecation="true" includeantruntime="false" />\r
+ </target>\r
+\r
+ <target name="run-generator-A" depends="compile" description="Run Group GUI (JMS).">\r
+ <java classname="at.ac.tuwien.lsdc.JobGenerator" fork="true" classpathref="project.classpath">\r
+ <assertions refid="project.assertions" />\r
+ <arg value="A" />\r
+ <arg value="100" />\r
+ <arg value="scenarios/scenarioA.csv" />\r
+ </java>\r
+ </target>\r
+\r
+ <target name="run-scheduler-A-A" depends="compile" description="Run Group GUI (JMS).">\r
+ <java classname="at.ac.tuwien.lsdc.JobGenerator" fork="true" classpathref="project.classpath">\r
+ <assertions refid="project.assertions" />\r
+ <arg value="A" />\r
+ <arg value="scenarios/scenarioA.csv" />\r
+ <arg value="logs/all.csv" />\r
+ <arg value="logs/scenarioA_schedulerA.csv" />\r
+ </java>\r
+ </target>\r
+\r
+ <target name="run-scheduler-A-B" depends="compile" description="Run Group GUI (JMS).">\r
+ <java classname="at.ac.tuwien.lsdc.JobGenerator" fork="true" classpathref="project.classpath">\r
+ <assertions refid="project.assertions" />\r
+ <arg value="B" />\r
+ <arg value="scenarios/scenarioA.csv" />\r
+ <arg value="logs/all.csv" />\r
+ <arg value="logs/scenarioA_schedulerB.csv" />\r
+ </java>\r
+ </target>\r
+ \r
+ <target name="run-scheduler-A-C" depends="compile" description="Run Group GUI (JMS).">\r
+ <java classname="at.ac.tuwien.lsdc.JobGenerator" fork="true" classpathref="project.classpath">\r
+ <assertions refid="project.assertions" />\r
+ <arg value="C" />\r
+ <arg value="scenarios/scenarioA.csv" />\r
+ <arg value="logs/all.csv" />\r
+ <arg value="logs/scenarioA_schedulerB.csv" />\r
+ </java>\r
+ </target>\r
+\r
+ <target name="clean" description="Clean build products.">\r
+ <delete dir="${build.dir}" />\r
+ </target>\r
+\r
+ <target name="rebuild" depends="clean, compile" description="Clean and build products." />\r
+</project>
\ No newline at end of file
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>at.ac.tuwien.lsdc</groupId>
- <artifactId>lsdc</artifactId>
- <version>0.0.1-SNAPSHOT</version>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.6</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.7</version>
- </dependency>
- <dependency>
- <groupId>net.sf.opencsv</groupId>
- <artifactId>opencsv</artifactId>
- <version>2.0</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
-<stringAttribute key="M2_GOALS" value="exec:java"/>
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
-<booleanAttribute key="M2_OFFLINE" value="false"/>
-<stringAttribute key="M2_PROFILES" value=""/>
-<listAttribute key="M2_PROPERTIES"/>
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
-<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
-<stringAttribute key="bad_container_name" value="/vales-riegler/group"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dexec.mainClass="at.ac.tuwien.lsdc.SchedSimulator""/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lsdc}"/>
-</launchConfiguration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
-<stringAttribute key="M2_GOALS" value="exec:java"/>
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
-<booleanAttribute key="M2_OFFLINE" value="false"/>
-<stringAttribute key="M2_PROFILES" value=""/>
-<listAttribute key="M2_PROPERTIES"/>
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
-<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
-<stringAttribute key="bad_container_name" value="/vales-riegler/group"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dexec.mainClass="at.ac.tuwien.lsdc.SchedSimulator""/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/lsdc}"/>
-</launchConfiguration>
import org.slf4j.LoggerFactory;
/**
- * Read config (.properties-file) and start Scheduler-Simulation.
+ * Read config (command line properties) and start Scheduler-Simulation.
*/
public class SchedSimulator {
private static final Logger log = LoggerFactory.getLogger(SchedSimulator.class);
--- /dev/null
+package at.ac.tuwien.lsdc.sched;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import at.ac.tuwien.lsdc.types.Application;
+import at.ac.tuwien.lsdc.types.SchedulerEvent;
+
+public abstract class AbstractScheduler {
+
+ // should move to SchedulerType Class later on
+
+
+ // the following types are only needed for correct
+ // log output
+ protected String schedulerName;
+ protected String scenario;
+ protected int numInSourced;
+ protected int numOutSourced;
+
+ // this map saves the following Type of Events:
+ // start of an Application, end of an Application
+ // (start outSourced, end outSourced, start inSourced, end inSourced)
+ protected Map<Long, LinkedList<SchedulerEvent>> eventMap;
+
+ // Scheduler has an internal Time "Abstraction"
+ // at every point in time it checks for Events in his "EventList"
+ // and handles them (via the individual scheduling algorithm)
+ protected long currTime;
+
+ // the timestamp at which the Scheduler is finished
+ // it is updated with every added "EndEvent"
+ protected long endTime;
+
+ // Initialize Scheduler with Data from CSV
+ // CSV will be parsed and sent as List<Application> to Scheduler
+ public String initAndStart(List<Application> apps) {
+ for (Application a : apps) {
+ // read start timestamp
+ // save as Event in Map
+ }
+ startScheduling();
+ return doEndLogging();
+ }
+
+ protected void startScheduling() {
+ while (true) {
+ LinkedList<SchedulerEvent> events = eventMap.get(currTime);
+ handleEvents(events);
+ doStateLogging();
+ //advance Time to next Event
+ if (currTime == endTime) {
+ // reached last Event, Scheduler will shut down
+ break;
+ }
+ }
+ }
+
+ // this method is where the Scheduling Algorithm resides
+ // it reads the Events (start & stop of applications)
+ protected abstract void handleEvents(LinkedList<SchedulerEvent> events);
+
+ protected void doStateLogging() {
+ // at every timestamp (after handle Event)
+ }
+
+ // this creates the total summary which should be written to a CSV at the
+ // end
+ protected String doEndLogging() {
+ return "CSV-String";
+ }
+}
--- /dev/null
+package at.ac.tuwien.lsdc.sched;
+
+import java.util.LinkedList;
+
+import at.ac.tuwien.lsdc.types.SchedulerEvent;
+
+
+public class SchedulerA extends AbstractScheduler {
+
+ @Override
+ protected void handleEvents(LinkedList<SchedulerEvent> events) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package at.ac.tuwien.lsdc.sched;
+
+import java.util.LinkedList;
+
+import at.ac.tuwien.lsdc.types.SchedulerEvent;
+
+
+public class SchedulerB extends AbstractScheduler {
+
+ @Override
+ protected void handleEvents(LinkedList<SchedulerEvent> events) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package at.ac.tuwien.lsdc.sched;
+
+import java.util.LinkedList;
+
+import at.ac.tuwien.lsdc.types.SchedulerEvent;
+
+
+public class SchedulerC extends AbstractScheduler {
+
+ @Override
+ protected void handleEvents(LinkedList<SchedulerEvent> events) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package at.ac.tuwien.lsdc.types;
+
+public class Application {
+
+ private long timestamp;
+ private int size;
+ private int ram;
+ private int cpu;
+ private int duration;
+
+ public Application(long timestamp, int size, int ram, int cpu, int duration) {
+ super();
+ this.timestamp = timestamp;
+ this.size = size;
+ this.ram = ram;
+ this.cpu = cpu;
+ this.duration = duration;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public int getRam() {
+ return ram;
+ }
+
+ public int getCpu() {
+ return cpu;
+ }
+
+ public int getDuration() {
+ return duration;
+ }
+
+}
--- /dev/null
+package at.ac.tuwien.lsdc.types;
+
+public class SchedulerEvent {
+
+ public enum EventType {
+ startApplication, endApplication
+ };
+
+ final private long timestamp;
+ final private EventType type;
+ final private Application app;
+
+ public SchedulerEvent(long timestamp, EventType type, Application app) {
+ this.timestamp = timestamp;
+ this.type = type;
+ this.app = app;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public EventType getType() {
+ return type;
+ }
+
+ public Application getApp() {
+ return app;
+ }
+
+
+}
\ No newline at end of file
package at.ac.tuwien.lsdc.util;
-import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
-import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
-public class CSVHandler {
+public class CSVLogger {
+
private final String filename;
- public CSVHandler(String filename) {
+ public CSVLogger(String filename) {
this.filename = filename;
}
- public List readFile() throws IOException {
- CSVReader reader = new CSVReader(new FileReader(filename));
- return reader.readAll();
- }
-
public void writeFile(List data) throws IOException {
CSVWriter writer = new CSVWriter(new FileWriter(filename), '\t');
writer.writeAll(data);
--- /dev/null
+package at.ac.tuwien.lsdc.util;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+
+import au.com.bytecode.opencsv.CSVReader;
+
+public class CSVParser {
+ private final String filename;
+
+ public CSVParser(String filename) {
+ this.filename = filename;
+ }
+
+ public List readFile() throws IOException {
+ CSVReader reader = new CSVReader(new FileReader(filename));
+ return reader.readAll();
+ }
+
+
+}
+++ /dev/null
-package at.ac.tuwien.lsdc.sched;
-
-public abstract class AbstractScheduler {
-
-}
+++ /dev/null
-package at.ac.tuwien.lsdc.sched.sched1;
-
-import at.ac.tuwien.lsdc.sched.AbstractScheduler;
-
-public class Scheduler1 extends AbstractScheduler {
-
-}
+++ /dev/null
-package at.ac.tuwien.lsdc.sched.sched2;
-
-import at.ac.tuwien.lsdc.sched.AbstractScheduler;
-
-public class Scheduler2 extends AbstractScheduler {
-
-}
+++ /dev/null
-package at.ac.tuwien.lsdc.sched.sched3;
-
-import at.ac.tuwien.lsdc.sched.AbstractScheduler;
-
-public class Scheduler3 extends AbstractScheduler {
-
-}
+++ /dev/null
-package at.ac.tuwien.lsdc.types;
-
-public class Application {
-
-}
+++ /dev/null
-package at.ac.tuwien.lsdc.types;
-
-// one line of a CSV-File. Convert to APP or try to outsource.
-public class Task {
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<configuration>
- <appender name="STDOUT2" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
- </layout>
- </appender>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%-30(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{32} - %msg%n</pattern>
- </layout>
- </appender>
-
- <logger name="at.ac.tuwien">
- <level value="debug" />
- </logger>
-
- <root>
- <level value="warn" />
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
\ No newline at end of file
+++ /dev/null
-just a dummy such that git can maintain the directory structure needed by maven
\ No newline at end of file
+++ /dev/null
-just a dummy such that git can maintain the directory structure needed by maven
\ No newline at end of file