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 ce71c314 authored by Andreas Sewe's avatar Andreas Sewe
Browse files

Added a template method with which to augment the system properties during the...

Added a template method with which to augment the system properties during the actual benchmark iteration.
parent 23b7f214
...@@ -11,6 +11,7 @@ package org.dacapo.harness; ...@@ -11,6 +11,7 @@ package org.dacapo.harness;
import java.io.*; import java.io.*;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
import java.util.Properties;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
...@@ -124,6 +125,13 @@ public abstract class Benchmark { ...@@ -124,6 +125,13 @@ public abstract class Benchmark {
/** Saved classloader across iterations */ /** Saved classloader across iterations */
private ClassLoader savedClassLoader; private ClassLoader savedClassLoader;
/**
* The system properties that were in effect when the harness was started.
*
* @see System#getProperties()
*/
private Properties savedSystemProperties;
/** /**
* Output stream for validating System.err * Output stream for validating System.err
*/ */
...@@ -212,6 +220,8 @@ public abstract class Benchmark { ...@@ -212,6 +220,8 @@ public abstract class Benchmark {
} }
protected void initialize() throws Exception { protected void initialize() throws Exception {
savedSystemProperties = System.getProperties();
System.setProperty("java.util.logging.config.file", fileIn(scratch, config.name + ".log")); System.setProperty("java.util.logging.config.file", fileIn(scratch, config.name + ".log"));
synchronized (System.out) { synchronized (System.out) {
if (out == null) { if (out == null) {
...@@ -299,6 +309,11 @@ public abstract class Benchmark { ...@@ -299,6 +309,11 @@ public abstract class Benchmark {
System.out.println("startIteration()"); System.out.println("startIteration()");
} }
System.setProperty(TIMEOUT_DIALATION_PROPERTY, Benchmark.timeoutDialation); System.setProperty(TIMEOUT_DIALATION_PROPERTY, Benchmark.timeoutDialation);
final Properties augmentedSystemProperties = new Properties(savedSystemProperties);
augmentSystemProperties(augmentedSystemProperties);
System.setProperties(augmentedSystemProperties);
if (validateOutput) { if (validateOutput) {
System.setOut(out); System.setOut(out);
System.setErr(err); System.setErr(err);
...@@ -312,6 +327,15 @@ public abstract class Benchmark { ...@@ -312,6 +327,15 @@ public abstract class Benchmark {
useBenchmarkClassLoader(); useBenchmarkClassLoader();
} }
/**
* Augments the system properties in case additional properties need to be in
* effect during the actual benchmark iteration.
*
* @param systemProperties the system properties that need to be augmented.
* (They may be modified freely.)
*/
public void augmentSystemProperties(Properties systemProperties) { }
/** /**
* An actual iteration of the benchmark. This is what is timed. * An actual iteration of the benchmark. This is what is timed.
* *
...@@ -332,6 +356,9 @@ public abstract class Benchmark { ...@@ -332,6 +356,9 @@ public abstract class Benchmark {
System.setOut(savedOut); System.setOut(savedOut);
System.setErr(savedErr); System.setErr(savedErr);
} }
System.setProperties(savedSystemProperties);
if (verbose) { if (verbose) {
System.out.println("stopIteration()"); System.out.println("stopIteration()");
} }
......
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