+delay
This commit is contained in:
parent
a7f93da59a
commit
2c5d1d2e94
@ -58,7 +58,7 @@ public class AccessPoint {
|
||||
Files.deleteIfExists(Paths.get("export", this.users.size() + ".csv"));
|
||||
new File("export").mkdir();
|
||||
this.outputDataFile = new FileOutputStream("export" + File.separator + this.users.size() + ".csv", true);
|
||||
outputDataFile.write("tick;x;y;user;bandwidth;\n".getBytes());
|
||||
outputDataFile.write("tick;x;y;user;bandwidth;delay\n".getBytes());
|
||||
} catch(IOException e) {
|
||||
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
|
||||
System.exit(1);
|
||||
@ -102,11 +102,20 @@ public class AccessPoint {
|
||||
}
|
||||
|
||||
private void analyseData(int tick) throws IOException {
|
||||
double delayAverrage = 0.0;
|
||||
double total = 0.0;
|
||||
for(User u: this.users){
|
||||
List<Packets> packets = u.getPacketsSent();
|
||||
for (Packets p: packets){
|
||||
total += p.getDurationSending();
|
||||
}
|
||||
}
|
||||
delayAverrage = total/this.users.size();
|
||||
for(int i = 0; i < frame.length; i++) {
|
||||
for(int j = 0; j < frame[i].length; j++) {
|
||||
ResourceBlock ur = frame[i][j];
|
||||
if(ur.getUser() != null) {
|
||||
String data = (tick + ";" + i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n");
|
||||
String data = (tick + ";" + i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";" + delayAverrage +";\n");
|
||||
try{
|
||||
outputDataFile.write(data.getBytes());
|
||||
}catch(IOException e){
|
||||
|
Reference in New Issue
Block a user