diff options
Diffstat (limited to 'src/com/jogamp/opencl/demos/info/CLInfo.java')
-rw-r--r-- | src/com/jogamp/opencl/demos/info/CLInfo.java | 79 |
1 files changed, 5 insertions, 74 deletions
diff --git a/src/com/jogamp/opencl/demos/info/CLInfo.java b/src/com/jogamp/opencl/demos/info/CLInfo.java index cfd4c43..85edc0f 100644 --- a/src/com/jogamp/opencl/demos/info/CLInfo.java +++ b/src/com/jogamp/opencl/demos/info/CLInfo.java @@ -5,14 +5,10 @@ package com.jogamp.opencl.demos.info; import com.jogamp.common.JogampRuntimeException; -import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLPlatform; +import com.jogamp.opencl.JoclVersion; import com.jogamp.opencl.util.ExceptionReporter; -import com.jogamp.opencl.util.JOCLVersion; import java.awt.Container; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JEditorPane; @@ -27,7 +23,7 @@ import javax.swing.UIManager; public class CLInfo { public static void main(String[] args) { - + Logger logger = Logger.getLogger(CLInfo.class.getName()); try { @@ -36,7 +32,8 @@ public class CLInfo { logger.log(Level.INFO, null, ex); } - logger.info("\n" + JOCLVersion.getAllVersions()); + final JoclVersion joclVersion = JoclVersion.getInstance(); + logger.info("\n" + joclVersion.getAllVersions(null).toString()); try{ CLPlatform.initialize(); @@ -56,77 +53,11 @@ public class CLInfo { contentPane.add(new JScrollPane(area)); - String html = createOpenCLInfoHTML(); - - area.setText(html.toString()); + area.setText(joclVersion.getOpenCLHtmlInfo(null).toString()); frame.setSize(800, 600); frame.setVisible(true); } - private static String createOpenCLInfoHTML() { - - StringBuilder html = new StringBuilder(); - - html.append("<table border=\"1\">"); - CLPlatform[] platforms = CLPlatform.listCLPlatforms(); - - // platforms - List<Map<String, String>> platProps = new ArrayList<Map<String, String>>(); - List<Integer> spans = new ArrayList<Integer>(); - for (CLPlatform p : platforms) { - platProps.add(p.getProperties()); - spans.add(p.listCLDevices().length); - } - fillTable(platProps, spans, html); - - // devices - ArrayList<Map<String, String>> devProps = new ArrayList<Map<String, String>>(); - for (CLPlatform p : platforms) { - CLDevice[] devices = p.listCLDevices(); - for (CLDevice d : devices) { - devProps.add(d.getProperties()); - } - } - fillTable(devProps, html); - html.append("</table>"); - - return html.toString(); - } - - private static void fillTable(List<Map<String, String>> properties, StringBuilder sb) { - ArrayList<Integer> spans = new ArrayList<Integer>(properties.size()); - for (int i = 0; i < properties.size(); i++) { - spans.add(1); - } - fillTable(properties, spans, sb); - } - - private static void fillTable(List<Map<String, String>> properties, List<Integer> spans, StringBuilder sb) { - boolean header = true; - for (String key : properties.get(0).keySet()) { - sb.append("<tr>"); - cell(sb, key); - int i = 0; - for (Map<String, String> map : properties) { - cell(sb, spans.get(i), map.get(key), header); - i++; - } - sb.append("</tr>"); - header = false; - } - } - - private static void cell(StringBuilder sb, String value) { - sb.append("<td>").append(value).append("</td>"); - } - - private static void cell(StringBuilder sb, int span, String value, boolean header) { - if(header) { - sb.append("<th colspan=\"").append(span).append("\">").append(value).append("</th>"); - }else{ - sb.append("<td colspan=\"").append(span).append("\">").append(value).append("</td>"); - } - } } |