Skip to content
Snippets Groups Projects
Commit 61ba4f42 authored by Marc Adolf's avatar Marc Adolf
Browse files

added std deviation

parent d6ea8374
No related branches found
No related tags found
No related merge requests found
...@@ -80,6 +80,24 @@ public class MeasureCollection { ...@@ -80,6 +80,24 @@ public class MeasureCollection {
return result; return result;
} }
public double activationVariance() {
double expectedValue = averageActivationTime();
double result = 0;
double count = 0;
double temp = 0;
for (AbstractStage stage : activationEntries.keySet()) {
for (ActivationEntry entry : activationEntries.get(stage)) {
temp = entry.getEndTime() - entry.getStartTime() - expectedValue;
result += temp * temp;
count++;
}
}
if (count != 0) {
result = result / count;
}
return result;
}
public long averageDeactivationTime() { public long averageDeactivationTime() {
long result = 0; long result = 0;
long count = 0; long count = 0;
...@@ -97,6 +115,24 @@ public class MeasureCollection { ...@@ -97,6 +115,24 @@ public class MeasureCollection {
return result; return result;
} }
public double deactivationVariance() {
double expectedValue = averageDeactivationTime();
double result = 0;
double count = 0;
double temp = 0;
for (AbstractStage stage : deactivationEntries.keySet()) {
for (DeactivationEntry entry : deactivationEntries.get(stage)) {
temp = entry.getEndTime() - entry.getStartTime() - expectedValue;
result += temp * temp;
count++;
}
}
if (count != 0) {
result = result / count;
}
return result;
}
public long averageThreadStopTime() { public long averageThreadStopTime() {
long result = 0; long result = 0;
long count = 0; long count = 0;
...@@ -114,16 +150,41 @@ public class MeasureCollection { ...@@ -114,16 +150,41 @@ public class MeasureCollection {
return result; return result;
} }
public double threadStopTimeVariance() {
double expectedValue = averageThreadStopTime();
double result = 0;
double count = 0;
double temp = 0;
for (AbstractStage stage : deactivationEntries.keySet()) {
for (DeactivationEntry entry : deactivationEntries.get(stage)) {
temp = entry.getEndTime() - entry.getThreadTerminationTime() - expectedValue;
result += temp * temp;
count++;
}
}
if (count != 0) {
result = result / count;
}
return result;
}
@Override @Override
public String toString() { public String toString() {
String result = "All values are given in nanoseconds \n"; String result = "All values are given in nanoseconds \n";
String avAT = "Average Activation Time"; String avAT = "Average Activation Time";
String aTV = "Activation Time Standard Deviation";
String avDT = "Average Deactivation Time"; String avDT = "Average Deactivation Time";
String dTV = "Deactivation Time Standard Deviation";
String avTT = "Average Time Thread Termination"; String avTT = "Average Time Thread Termination";
int n = Math.max(avAT.length(), Math.max(avDT.length(), avTT.length())); String tTV = "Time Thread Termination Standard Deviation";
int n = Math.max(avAT.length(), Math.max(avDT.length(), Math.max(avTT.length(), Math.max(aTV.length(), Math.max(dTV.length(), tTV.length())))));
result += avAT + spaces(n - avAT.length() + 1) + ": " + averageActivationTime() + "\n"; result += avAT + spaces(n - avAT.length() + 1) + ": " + averageActivationTime() + "\n";
result += aTV + spaces(n - aTV.length() + 1) + ": " + Math.sqrt(activationVariance()) + "\n";
result += avDT + spaces(n - avDT.length() + 1) + ": " + averageDeactivationTime() + "\n"; result += avDT + spaces(n - avDT.length() + 1) + ": " + averageDeactivationTime() + "\n";
result += avTT + spaces(n - avTT.length() + 1) + ": " + averageThreadStopTime(); result += dTV + spaces(n - dTV.length() + 1) + ": " + Math.sqrt(deactivationVariance()) + "\n";
result += avTT + spaces(n - avTT.length() + 1) + ": " + averageThreadStopTime() + "\n";
result += tTV + spaces(n - tTV.length() + 1) + ": " + Math.sqrt(threadStopTimeVariance());
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment