Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Combine approach 1 by Gabor Kecskemeti ([email protected])
*/
package hu.mta.sztaki.lpds.cloud.simulator.combineazuredataset;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class CombineFilesGabor {
public static class StringPair {
public final String hashes;
public final String rest;

public StringPair(String h, String r) {
hashes = h;
rest = r;
}
}

public static TreeMap<String, String> execution = new TreeMap<>();
public static TreeMap<String, String> memory = new TreeMap<>();

public static void readAllLines(String file, Consumer<String> singleLineProcessor) throws IOException {
try (Stream<String> lineStream = Files.lines(new File(file).toPath())) {
lineStream.forEach(singleLineProcessor);
}
}

public static StringPair splitToPair(String line, int commasForSplit) {
int split = -1;
for (int commas = 0; commas < commasForSplit; commas++) {
split = line.indexOf(',', split + 1);
}
return new StringPair(line.substring(0, split), line.substring(split));
}

public static void splitPut(String line, TreeMap<String, String> container, int commasForSplit) {
StringPair pair = splitToPair(line, commasForSplit);
container.put(pair.hashes, pair.rest);
}

public static void mergeLine(String line, BufferedWriter bw) {
StringPair execPair = splitToPair(line, 3);
StringPair memPair = splitToPair(line, 2);
String execRest = execution.get(execPair.hashes);
String memRest = memory.get(memPair.hashes);
if (execRest != null && memRest != null) {
try {
bw.write(line);
bw.write(execRest);
bw.write(memRest);
bw.write("\n");
} catch (IOException ioex) {
throw new RuntimeException(ioex);
}
}
}

public static void main(String[] args) throws Exception {
long currTime = System.currentTimeMillis();
readAllLines("../execution.csv", s -> splitPut(s, execution, 3));
readAllLines("../memory.csv", s -> splitPut(s, memory, 2));
try (BufferedWriter bw = new BufferedWriter(new FileWriter("../merged.csv"))) {
readAllLines("../invocation.csv", s -> mergeLine(s, bw));
}
System.out.println((System.currentTimeMillis() - currTime) + "ms");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Combine approach 2 by Dilshad H. Sallo ([email protected])
*/
package hu.mta.sztaki.lpds.cloud.simulator.combineazuredataset;

public class MainCombCSVFiles {
CombineFiles cf;

public MainCombCSVFiles(String invocationFile, String exeTimeFile, String memoryFile) {
if (invocationFile.endsWith(".csv") && exeTimeFile.endsWith(".csv") && memoryFile.endsWith(".csv")) {
cf = new CombineFiles(invocationFile, exeTimeFile, memoryFile);
long before = System.currentTimeMillis();
cf.combine();
cf.generatedirectly();
System.err.println("Files are combined successfully");
long after = System.currentTimeMillis();
System.err.println("Combined time is " + (after - before) / 1000 + " s");
}else {
System.out.println("The files are not in csv formats");
}
}
public static void main(String[] args) {
//path
String fileInvocation = "E:\\Bitbucket\\experiments\\invocation.csv";
String fileExecution = "E:\\Bitbucket\\experiments\\execution.csv";
String filememory = "E:\\Bitbucket\\experiments\\memory.csv";

new MainCombCSVFiles(fileInvocation, fileExecution, filememory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,18 @@ public abstract class Job {
* Shows if this job has already been executed by the simulator.
*/
private boolean ran = false;

/**
* This job caused cold-start
*/
public boolean is_cold = false;
/**
* Time job start simulated in instance
*/
private long client_start_time = 0;
/**
* Time job end simulated in instance
*/
private long client_end_time = 0;
/**
* The generic constructor to be used by most of the trace generators and in
* most of the use cases.
Expand Down Expand Up @@ -152,8 +163,8 @@ public Job(String id, long submit, long queue, long exec, int nprocs, double ppC
submittimeSecs = submit;
queuetimeSecs = queue;
exectimeSecs = exec;
stoptimeSecs = queuetimeSecs + exectimeSecs + submittimeSecs;
starttimeSecs = submittimeSecs + queuetimeSecs;
stoptimeSecs = client_end_time = queuetimeSecs + exectimeSecs + submittimeSecs;
starttimeSecs = client_start_time = submittimeSecs + queuetimeSecs;
midExecInstanceSecs = starttimeSecs + exectimeSecs / 2;
this.nprocs = nprocs;
// Assumes full CPU utilization for every processor for the complete
Expand Down Expand Up @@ -266,7 +277,22 @@ public long getStartTimeInstance() {
public long getMidExecInstanceSecs() {
return midExecInstanceSecs;
}

/**
* Determines the time instance start to simulate this job
*
* @return time of job start simulated
*/
public long get_client_start_time() {
return this.client_start_time;
}
/**
* Determines the time instance end to simulate this job
*
* @return time of job end simulated
*/
public long get_client_end_time() {
return this.client_end_time;
}
/**
* Simulator specific implementation that can set the real start time
* (allows the query of the current simulated time instance independent from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,18 @@ public int compare(Job o1, Job o2) {
return Long.signum(o1.getStartTimeInstance() - o2.getStartTimeInstance());
}
};
/**
* A job comparator that allows the ordering of jobs based on their
* client start time instance.
*/
public static final Comparator<Job> clientStartTimeComparator = new Comparator<Job>() {
@Override
public int compare(Job o1, Job o2) {
return Long.signum(o1.get_client_start_time() - o2.get_client_start_time());
//see it later

}
};


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* ========================================================================
* Helper classes to support simulations of large scale distributed systems
* ========================================================================
*
* This file is part of DistSysJavaHelpers.
*
* DistSysJavaHelpers is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DistSysJavaHelpers is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* (C) Copyright 2022, Gabor Kecskemeti ([email protected])
* (C) Copyright 2022, Dilshad H. Sallo ([email protected])
*/
package hu.mta.sztaki.lpds.cloud.simulator.helpers.serverless.workload.generator;

import hu.mta.sztaki.lpds.cloud.simulator.helpers.job.Job;

public class FaaSJob extends Job{

public FaaSJob(String id, long submit, long queue, long exec, int nprocs, double ppCpu, long ppMem, String user,
String group, String executable, Job preceding, long delayAfter) {
super(id, submit, queue, exec, nprocs, ppCpu, ppMem, user, group, executable, preceding, delayAfter);
}

@Override
public void started() {
// TODO Auto-generated method stub

}

@Override
public void completed() {
// TODO Auto-generated method stub

}

}
Loading