To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit add023eb authored by Andreas Sewe's avatar Andreas Sewe
Browse files

Moved time-taking out of Callback into Benchmark. (A callback shouldn't be able to screw this up.)

parent a24b5766
...@@ -83,6 +83,7 @@ public class DelayCallback extends Callback { ...@@ -83,6 +83,7 @@ public class DelayCallback extends Callback {
super(args); super(args);
} }
@Override
protected void start(String benchmark, boolean warmup) { protected void start(String benchmark, boolean warmup) {
if (!warmup) { if (!warmup) {
if (sleepTimeVerbose) if (sleepTimeVerbose)
...@@ -96,8 +97,9 @@ public class DelayCallback extends Callback { ...@@ -96,8 +97,9 @@ public class DelayCallback extends Callback {
super.start(benchmark,warmup); super.start(benchmark,warmup);
} }
public void stop(boolean warmup) { @Override
super.stop(warmup); public void stop(long duration, boolean warmup) {
super.stop(duration, warmup);
if (!warmup) { if (!warmup) {
try { try {
Thread.currentThread().sleep(sleepTime*1000); Thread.currentThread().sleep(sleepTime*1000);
......
...@@ -22,6 +22,7 @@ public class MMTkCallback extends Callback { ...@@ -22,6 +22,7 @@ public class MMTkCallback extends Callback {
} }
/* Immediately prior to start of the benchmark */ /* Immediately prior to start of the benchmark */
@Override
public void start(String benchmark) { public void start(String benchmark) {
if (!isWarmup()) if (!isWarmup())
harness.harnessBegin(); harness.harnessBegin();
...@@ -29,8 +30,9 @@ public class MMTkCallback extends Callback { ...@@ -29,8 +30,9 @@ public class MMTkCallback extends Callback {
}; };
/* Immediately after the end of the benchmark */ /* Immediately after the end of the benchmark */
public void stop() { @Override
super.stop(); public void stop(long duration) {
super.stop(duration);
if (!isWarmup()) if (!isWarmup())
harness.harnessEnd(); harness.harnessEnd();
} }
......
...@@ -20,18 +20,21 @@ public class MyCallback extends Callback { ...@@ -20,18 +20,21 @@ public class MyCallback extends Callback {
} }
/* Immediately prior to start of the benchmark */ /* Immediately prior to start of the benchmark */
@Override
public void start(String benchmark) { public void start(String benchmark) {
System.err.println("my hook starting " + (isWarmup() ? "warmup " : "") + benchmark); System.err.println("my hook starting " + (isWarmup() ? "warmup " : "") + benchmark);
super.start(benchmark); super.start(benchmark);
}; };
/* Immediately after the end of the benchmark */ /* Immediately after the end of the benchmark */
public void stop() { @Override
super.stop(); public void stop(long duration) {
super.stop(duration);
System.err.println("my hook stopped " + (isWarmup() ? "warmup" : "")); System.err.println("my hook stopped " + (isWarmup() ? "warmup" : ""));
System.err.flush(); System.err.flush();
}; };
@Override
public void complete(String benchmark, boolean valid) { public void complete(String benchmark, boolean valid) {
super.complete(benchmark, valid); super.complete(benchmark, valid);
System.err.println("my hook " + (valid ? "PASSED " : "FAILED ") + (isWarmup() ? "warmup " : "") + benchmark); System.err.println("my hook " + (valid ? "PASSED " : "FAILED ") + (isWarmup() ? "warmup " : "") + benchmark);
......
...@@ -174,6 +174,8 @@ public abstract class Benchmark { ...@@ -174,6 +174,8 @@ public abstract class Benchmark {
callback.start(config.name); callback.start(config.name);
final long start = System.currentTimeMillis();
startIteration(); startIteration();
try { try {
iterate(size); iterate(size);
...@@ -181,7 +183,9 @@ public abstract class Benchmark { ...@@ -181,7 +183,9 @@ public abstract class Benchmark {
stopIteration(); stopIteration();
} }
callback.stop(); final long duration = System.currentTimeMillis() - start;
callback.stop(duration);
boolean valid = validate(size); boolean valid = validate(size);
callback.complete(config.name, valid); callback.complete(config.name, valid);
......
...@@ -41,11 +41,6 @@ public class Callback { ...@@ -41,11 +41,6 @@ public class Callback {
*/ */
protected long[] times; protected long[] times;
/**
* The start time of the most recent benchmark run.
*/
protected long timer;
/** /**
* *
*/ */
...@@ -163,19 +158,17 @@ public class Callback { ...@@ -163,19 +158,17 @@ public class Callback {
}; };
protected void start(String benchmark, boolean warmup) { protected void start(String benchmark, boolean warmup) {
timer = System.currentTimeMillis();
System.err.print("===== DaCapo " + TestHarness.getBuildVersion() + " " + benchmark + " starting "); System.err.print("===== DaCapo " + TestHarness.getBuildVersion() + " " + benchmark + " starting ");
System.err.println((warmup ? ("warmup " + (iterations + 1) + " ") : "") + "====="); System.err.println((warmup ? ("warmup " + (iterations + 1) + " ") : "") + "=====");
System.err.flush(); System.err.flush();
} }
/* Stop the timer */ public void stop(long duration) {
public void stop() { stop(duration, mode == Mode.WARMUP);
stop(mode == Mode.WARMUP);
} }
public void stop(boolean warmup) { public void stop(long duration, boolean warmup) {
elapsed = System.currentTimeMillis() - timer; elapsed = duration;
} }
/* Announce completion of the benchmark (pass or fail) */ /* Announce completion of the benchmark (pass or fail) */
......
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 to comment