Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/rmi/reliability/benchmark/bench/XmlReporter.java
41161 views
1
/*
2
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
*
26
*/
27
28
package bench;
29
30
import java.awt.Toolkit;
31
import java.io.OutputStream;
32
import java.io.PrintStream;
33
import java.io.IOException;
34
import java.util.Arrays;
35
import java.util.Date;
36
import java.util.Properties;
37
38
/**
39
* Benchmark XML report generator. Uses XML format used by other JDK
40
* benchmarks.
41
*/
42
public class XmlReporter implements Reporter {
43
44
OutputStream out;
45
String title;
46
47
/**
48
* Create XmlReporter which writes to the given stream.
49
*/
50
public XmlReporter(OutputStream out, String title) {
51
this.out = out;
52
this.title = title;
53
}
54
55
/**
56
* Generate text report.
57
*/
58
public void writeReport(BenchInfo[] binfo, Properties props)
59
throws IOException
60
{
61
PrintStream p = new PrintStream(out);
62
63
p.println("<REPORT>");
64
p.println("<NAME>" + title + "</NAME>");
65
p.println("<DATE>" + new Date() + "</DATE>");
66
p.println("<VERSION>" + props.getProperty("java.version") +
67
"</VERSION>");
68
p.println("<VENDOR>" + props.getProperty("java.vendor") + "</VENDOR>");
69
p.println("<DIRECTORY>" + props.getProperty("java.home") +
70
"</DIRECTORY>");
71
String vmName = props.getProperty("java.vm.name");
72
String vmInfo = props.getProperty("java.vm.info");
73
String vmString = (vmName != null && vmInfo != null) ?
74
vmName + " " + vmInfo : "Undefined";
75
p.println("<VM_INFO>" + vmString + "</VM_INFO>");
76
p.println("<OS>" + props.getProperty("os.name") +
77
" version " + props.getProperty("os.version") + "</OS>");
78
p.println("<BIT_DEPTH>" +
79
Toolkit.getDefaultToolkit().getColorModel().getPixelSize() +
80
"</BIT_DEPTH>");
81
p.println();
82
83
p.println("<DATA RUNS=\"" + 1 + "\" TESTS=\"" + binfo.length + "\">");
84
for (int i = 0; i < binfo.length; i++) {
85
BenchInfo b = binfo[i];
86
String score = (b.getTime() != -1) ?
87
Double.toString(b.getTime() * b.getWeight()) : "-1";
88
p.println(b.getName() + "\t" + score);
89
}
90
91
p.println("</DATA>");
92
p.println("</REPORT>");
93
}
94
}
95
96