8287761: Make the logging of J2DBench stable

Reviewed-by: aghaisas, prr
This commit is contained in:
Sergey Bylokhov 2022-06-06 21:25:14 +00:00
parent 5264881a15
commit a277590c89
2 changed files with 23 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -40,11 +40,11 @@
package j2dbench; package j2dbench;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Vector;
public class Result { public class Result {
public static final int RATE_UNKNOWN = 0; public static final int RATE_UNKNOWN = 0;
@ -243,7 +243,7 @@ public class Result {
int repsPerRun; int repsPerRun;
int unitsPerRep; int unitsPerRep;
Vector times; Vector times;
Hashtable modifiers; LinkedHashMap modifiers;
Throwable error; Throwable error;
public Result(Test test) { public Result(Test test) {
@ -277,7 +277,7 @@ public class Result {
this.error = t; this.error = t;
} }
public void setModifiers(Hashtable modifiers) { public void setModifiers(LinkedHashMap modifiers) {
this.modifiers = modifiers; this.modifiers = modifiers;
} }
@ -297,7 +297,7 @@ public class Result {
return ((long) getRepsPerRun()) * ((long) getUnitsPerRep()); return ((long) getRepsPerRun()) * ((long) getUnitsPerRep());
} }
public Hashtable getModifiers() { public LinkedHashMap getModifiers() {
return modifiers; return modifiers;
} }
@ -423,11 +423,11 @@ public class Result {
System.out.println(test+" averaged "+getAverageString()); System.out.println(test+" averaged "+getAverageString());
} }
if (true) { if (true) {
Enumeration enum_ = modifiers.keys(); Iterator iter_ = modifiers.keySet().iterator();
System.out.print(" with"); System.out.print(" with");
String sep = " "; String sep = " ";
while (enum_.hasMoreElements()) { while (iter_.hasNext()) {
Modifier mod = (Modifier) enum_.nextElement(); Modifier mod = (Modifier) iter_.next();
Object v = modifiers.get(mod); Object v = modifiers.get(mod);
System.out.print(sep); System.out.print(sep);
System.out.print(mod.getAbbreviatedModifierDescription(v)); System.out.print(mod.getAbbreviatedModifierDescription(v));
@ -442,9 +442,9 @@ public class Result {
"num-reps=\""+getRepsPerRun()+"\" "+ "num-reps=\""+getRepsPerRun()+"\" "+
"num-units=\""+getUnitsPerRep()+"\" "+ "num-units=\""+getUnitsPerRep()+"\" "+
"name=\""+test.getTreeName()+"\">"); "name=\""+test.getTreeName()+"\">");
Enumeration enum_ = modifiers.keys(); Iterator iter_ = modifiers.keySet().iterator();
while (enum_.hasMoreElements()) { while (iter_.hasNext()) {
Modifier mod = (Modifier) enum_.nextElement(); Modifier mod = (Modifier) iter_.next();
Object v = modifiers.get(mod); Object v = modifiers.get(mod);
String val = mod.getModifierValueName(v); String val = mod.getModifierValueName(v);
pw.println(" <option "+ pw.println(" <option "+

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -40,15 +40,15 @@
package j2dbench; package j2dbench;
import java.awt.AlphaComposite;
import java.awt.Canvas; import java.awt.Canvas;
import java.awt.Image; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Dimension; import java.awt.Image;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.util.Hashtable; import java.util.LinkedHashMap;
import j2dbench.tests.GraphicsTests; import j2dbench.tests.GraphicsTests;
@ -105,12 +105,12 @@ public class TestEnvironment implements Node.Visitor {
Image srcImage; Image srcImage;
boolean stopped; boolean stopped;
ResultSet results; ResultSet results;
Hashtable modifiers; LinkedHashMap modifiers;
Timer timer; Timer timer;
public TestEnvironment() { public TestEnvironment() {
results = new ResultSet(); results = new ResultSet();
modifiers = new Hashtable(); modifiers = new LinkedHashMap();
timer = Timer.getImpl(); timer = Timer.getImpl();
} }
@ -246,8 +246,8 @@ public class TestEnvironment implements Node.Visitor {
modifiers.remove(o); modifiers.remove(o);
} }
public Hashtable getModifiers() { public LinkedHashMap getModifiers() {
return (Hashtable) modifiers.clone(); return (LinkedHashMap) modifiers.clone();
} }
public void record(Result result) { public void record(Result result) {