9 package javolution.test;
61 public String getName() {
62 return this.getClass().getEnclosingClass().
getName()
67 protected Integer getDefault() {
81 public String getName() {
82 return this.getClass().getEnclosingClass().
getName() +
"#SKIP";
86 protected Boolean getDefault() {
108 if (
times ==
null)
return Double.NaN;
110 for (
long time :
times) {
113 return sum / 1e9 /
times.length;
141 if (
times ==
null)
return new double[0];
142 double[] timesSec =
new double[
times.length];
143 for (
int i=0; i <
times.length; i++) {
144 timesSec[i] =
times[i] / 1e9;
159 this.times =
new long[nbrOfIterations];
160 long[] calibrations =
longArray(nbrOfIterations, Long.MAX_VALUE);
161 long[] measures =
longArray(nbrOfIterations, Long.MAX_VALUE);
167 for (
int i = 0; i < nbrOfIterations; i++) {
168 long start = System.nanoTime();
170 long time = System.nanoTime() - start;
171 calibrations[i] =
MathLib.
min(calibrations[i], time);
175 for (
int i = 0; i < nbrOfIterations; i++) {
176 long start = System.nanoTime();
178 long time = System.nanoTime() - start;
181 }
while (System.currentTimeMillis() < exitTime);
182 for (
int i = 0; i < nbrOfIterations; i++) {
183 times[i] = measures[i] - calibrations[i];
187 throw new RuntimeException(
"Perfometer Exception", error);
202 txt.
append(
" ns (avg), ");
214 for (
long time :
times)
215 measurements.
add(time);
223 if (
times ==
null)
return Double.NaN;
225 for (
long time :
times) {
226 if (time > wcet) wcet = time;
235 if (
times ==
null)
return -1;
238 for (
int i=0; i <
times.length; i++) {
239 if (
times[i] > wcet) {
265 private long[]
longArray(
int length,
long initialValue) {
266 long[] array =
new long[length];
267 for (
int i = 0; i < length; i++)
268 array[i] = initialValue;