From dc751bd15979b641e05ea6d47a3f980fa0c23955 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 26 Jan 2014 02:18:19 +0100 Subject: CLInfo: Use JoclVersion --- src/com/jogamp/opencl/demos/info/CLInfo.java | 79 ++-------------------------- 1 file 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(""); - CLPlatform[] platforms = CLPlatform.listCLPlatforms(); - - // platforms - List> platProps = new ArrayList>(); - List spans = new ArrayList(); - for (CLPlatform p : platforms) { - platProps.add(p.getProperties()); - spans.add(p.listCLDevices().length); - } - fillTable(platProps, spans, html); - - // devices - ArrayList> devProps = new ArrayList>(); - for (CLPlatform p : platforms) { - CLDevice[] devices = p.listCLDevices(); - for (CLDevice d : devices) { - devProps.add(d.getProperties()); - } - } - fillTable(devProps, html); - html.append("
"); - - return html.toString(); - } - - private static void fillTable(List> properties, StringBuilder sb) { - ArrayList spans = new ArrayList(properties.size()); - for (int i = 0; i < properties.size(); i++) { - spans.add(1); - } - fillTable(properties, spans, sb); - } - - private static void fillTable(List> properties, List spans, StringBuilder sb) { - boolean header = true; - for (String key : properties.get(0).keySet()) { - sb.append(""); - cell(sb, key); - int i = 0; - for (Map map : properties) { - cell(sb, spans.get(i), map.get(key), header); - i++; - } - sb.append(""); - header = false; - } - } - - private static void cell(StringBuilder sb, String value) { - sb.append("").append(value).append(""); - } - - private static void cell(StringBuilder sb, int span, String value, boolean header) { - if(header) { - sb.append("").append(value).append(""); - }else{ - sb.append("").append(value).append(""); - } - } } -- cgit v1.2.3