Преглед изворни кода

benchmarks: remove caliper

Ranides Atterwim пре 10 година
родитељ
комит
3e5e76fbf8

+ 230 - 235
assira.common/pom.xml

@@ -1,236 +1,231 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    
-    <groupId>net.ranides</groupId>
-    <artifactId>assira.common</artifactId>
-    <version>2.0.1</version>
-    <packaging>pom</packaging>
-    
-    <url>http://ranides.net/projects/assira</url>
-    
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
-        <netbeans.hint.license>WTFPL</netbeans.hint.license>
-        <project.argLine></project.argLine>
-        <project.test.memory>512m</project.test.memory>
-        <assira.junit.debug>false</assira.junit.debug>
-        
-        <org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
-        <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
-        <org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
-        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
-        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
-        <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
-        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
-    </properties>
-    
-    <distributionManagement>
-        <repository>
-            <id>maven.ranides.net</id>
-            <name>maven.ranides.net</name>
-            <url>ftp://maven.ranides.net/</url>
-        </repository>
-    </distributionManagement>
-    
-    <repositories>
-        <repository>
-            <id>ranides.net</id>
-            <name>ranides.net</name>
-            <url>http://maven.ranides.net</url>
-        </repository>
-    </repositories>
-    
-    <build>
-        <extensions>
-            <extension>
-                <groupId>org.apache.maven.wagon</groupId>
-                <artifactId>wagon-ftp</artifactId>
-                <version>1.0</version>
-            </extension>
-        </extensions>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>${maven.compiler.source}</source>
-                    <target>${maven.compiler.target}</target>
-                    <compilerArgument>-Xlint:unchecked</compilerArgument>
-                    <compilerArgument>-parameters</compilerArgument>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-                <version>2.2.1</version>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <goals>
-                            <goal>jar-no-fork</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9</version>
-                <executions>
-                    <execution>
-                        <id>javadocs-site</id>
-                        <phase>site</phase>
-                        <goals>
-                            <goal>javadoc</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <links>
-                        <link>http://docs.oracle.com/javase/7/docs/api/</link>
-                    </links>
-                    <version>true</version>
-                    <show>public</show>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-pmd-plugin</artifactId>
-                <version>3.5</version>
-                <configuration>
-                    <rulesets>
-                        <ruleset>rulesets/java/assira.xml</ruleset>
-                    </rulesets>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>net.ranides</groupId>
-                        <artifactId>assira.rules</artifactId>
-                        <version>2.0.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <version>0.7.5.201505241946</version>
-                <configuration>
-                    <propertyName>project.argLine</propertyName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>report</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>report</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.18.1</version>
-                <configuration>
-                    <argLine>-Dassira.junit.debug=@{assira.junit.debug} -Dfile.encoding=${project.build.sourceEncoding} @{project.argLine} -Xmx@{project.test.memory}</argLine>
-                    <testFailureIgnore>false</testFailureIgnore>
-                    <skip>false</skip>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jxr-plugin</artifactId>
-                <version>2.3</version>
-            </plugin>
-        </plugins>
-    </build>
-
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9</version>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jxr-plugin</artifactId>
-                <version>2.3</version>
-            </plugin>
-        </plugins>
-    </reporting>
-    
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>net.ranides</groupId>
-                <artifactId>assira</artifactId>
-                <version>2.0.1</version>
-            </dependency>
-            <dependency>
-                <groupId>net.ranides</groupId>
-                <artifactId>assira.asm</artifactId>
-                <version>5.0.4</version>
-            </dependency>
-            <dependency>
-                <groupId>net.ranides</groupId>
-                <artifactId>assira.junit</artifactId>
-                <version>2.0.1</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-                <version>4.12</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>net.ranides</groupId>
-                <artifactId>caliper</artifactId>
-                <version>1.0L</version>
-            </dependency>
-            <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-api</artifactId>
-                <version>1.7.13</version>
-            </dependency>
-            <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-simple</artifactId>
-                <version>1.7.13</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>net.sourceforge.pmd</groupId>
-                <artifactId>pmd-java</artifactId>
-                <version>5.3.3</version>
-            </dependency>
-            <dependency>
-                <groupId>com.google.code.findbugs</groupId>
-                <artifactId>annotations</artifactId>
-                <version>3.0.1u2</version>
-                <scope>provided</scope>
-            </dependency>
-            <dependency>
-                <groupId>com.fasterxml.jackson.core</groupId>
-                <artifactId>jackson-core</artifactId>
-                <version>2.0.1</version>
-            </dependency>
-            <dependency>
-                <groupId>com.fasterxml.jackson.datatype</groupId>
-                <artifactId>jackson-datatype-json-org</artifactId>
-                <version>2.0.0</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <groupId>net.ranides</groupId>
+    <artifactId>assira.common</artifactId>
+    <version>2.0.1</version>
+    <packaging>pom</packaging>
+    
+    <url>http://ranides.net/projects/assira</url>
+    
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <netbeans.hint.license>WTFPL</netbeans.hint.license>
+        <project.argLine></project.argLine>
+        <project.test.memory>512m</project.test.memory>
+        <assira.junit.debug>false</assira.junit.debug>
+        
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
+        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
+    </properties>
+    
+    <distributionManagement>
+        <repository>
+            <id>maven.ranides.net</id>
+            <name>maven.ranides.net</name>
+            <url>ftp://maven.ranides.net/</url>
+        </repository>
+    </distributionManagement>
+    
+    <repositories>
+        <repository>
+            <id>ranides.net</id>
+            <name>ranides.net</name>
+            <url>http://maven.ranides.net</url>
+        </repository>
+    </repositories>
+    
+    <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ftp</artifactId>
+                <version>1.0</version>
+            </extension>
+        </extensions>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>${maven.compiler.source}</source>
+                    <target>${maven.compiler.target}</target>
+                    <compilerArgument>-Xlint:unchecked</compilerArgument>
+                    <compilerArgument>-parameters</compilerArgument>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.2.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.9</version>
+                <executions>
+                    <execution>
+                        <id>javadocs-site</id>
+                        <phase>site</phase>
+                        <goals>
+                            <goal>javadoc</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <links>
+                        <link>http://docs.oracle.com/javase/7/docs/api/</link>
+                    </links>
+                    <version>true</version>
+                    <show>public</show>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <version>3.5</version>
+                <configuration>
+                    <rulesets>
+                        <ruleset>rulesets/java/assira.xml</ruleset>
+                    </rulesets>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>net.ranides</groupId>
+                        <artifactId>assira.rules</artifactId>
+                        <version>2.0.1</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.7.5.201505241946</version>
+                <configuration>
+                    <propertyName>project.argLine</propertyName>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>report</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <argLine>-Dassira.junit.debug=@{assira.junit.debug} -Dfile.encoding=${project.build.sourceEncoding} @{project.argLine} -Xmx@{project.test.memory}</argLine>
+                    <testFailureIgnore>false</testFailureIgnore>
+                    <skip>false</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jxr-plugin</artifactId>
+                <version>2.3</version>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.9</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jxr-plugin</artifactId>
+                <version>2.3</version>
+            </plugin>
+        </plugins>
+    </reporting>
+    
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>net.ranides</groupId>
+                <artifactId>assira</artifactId>
+                <version>2.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>net.ranides</groupId>
+                <artifactId>assira.asm</artifactId>
+                <version>5.0.4</version>
+            </dependency>
+            <dependency>
+                <groupId>net.ranides</groupId>
+                <artifactId>assira.junit</artifactId>
+                <version>2.0.1</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.12</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>1.7.13</version>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-simple</artifactId>
+                <version>1.7.13</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>net.sourceforge.pmd</groupId>
+                <artifactId>pmd-java</artifactId>
+                <version>5.3.3</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.code.findbugs</groupId>
+                <artifactId>annotations</artifactId>
+                <version>3.0.1u2</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.core</groupId>
+                <artifactId>jackson-core</artifactId>
+                <version>2.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.datatype</groupId>
+                <artifactId>jackson-datatype-json-org</artifactId>
+                <version>2.0.0</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
 </project>

+ 42 - 46
assira.junit/pom.xml

@@ -1,47 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>net.ranides</groupId>
-        <artifactId>assira.common</artifactId>
-        <version>2.0.1</version>
-    </parent>
-    
-    <name>assira.junit</name>
-    <groupId>net.ranides</groupId>
-    <artifactId>assira.junit</artifactId>
-    <version>2.0.1</version>
-    <packaging>jar</packaging>
-
-    <repositories>
-        <repository>
-            <id>ranides.net</id>
-            <name>ranides.net</name>
-            <url>http://maven.ranides.net</url>
-        </repository>
-    </repositories>
-    
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>net.ranides</groupId>
-            <artifactId>caliper</artifactId>
-        </dependency>
-		<dependency>
-			<groupId>net.ranides</groupId>
-			<artifactId>assira.asm</artifactId>
-		</dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-    </dependencies>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>net.ranides</groupId>
+        <artifactId>assira.common</artifactId>
+        <version>2.0.1</version>
+    </parent>
+    
+    <name>assira.junit</name>
+    <groupId>net.ranides</groupId>
+    <artifactId>assira.junit</artifactId>
+    <version>2.0.1</version>
+    <packaging>jar</packaging>
+
+    <repositories>
+        <repository>
+            <id>ranides.net</id>
+            <name>ranides.net</name>
+            <url>http://maven.ranides.net</url>
+        </repository>
+    </repositories>
+    
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+			<groupId>net.ranides</groupId>
+			<artifactId>assira.asm</artifactId>
+		</dependency>
+        <dependency>
+            <groupId>com.google.code.findbugs</groupId>
+            <artifactId>annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+    </dependencies>
 </project>

+ 0 - 104
assira.junit/src/main/java/net/ranides/assira/junit/BenchmarkReport.java

@@ -1,104 +0,0 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.PrintStream;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class BenchmarkReport {
-    
-    private static final Pattern RE_BENCHMARK = Pattern.compile(
-        "\\{vm=(.+?), trial=(.+?), benchmark=(.+?)\\} ([0-9,]+) ns; \\?=([0-9,]+) ns @ ([0-9]+) trials"
-    );
-    
-    private BenchmarkReport() { /* utility class */ }
-    
-    public static void print(PrintStream out, String data) {
-        
-        InfoMap result = new InfoMap();
-        for(String line : data.split("[\\n\\r]+")) {
-            result.add(line);
-        }
-        
-        String pattern = MessageFormat.format("%-{0}s    = %{1}.0f ? %.0f%n", 
-            result.maxname,
-            String.valueOf((int)result.maxtime).length()
-        );
-                
-        for(List<Info> binfo : result.map.values()) {
-            int n = 0; // binfo.size();
-            double avg = 0;
-            double dev = 0;
-            for(Info info : binfo) {
-                avg += info.trials*info.time;
-                n += info.trials;
-            }
-            avg = avg / n;
-
-            for(Info info : binfo) {
-                dev += info.trials * ((avg - info.time) * (avg - info.time));
-            }
-            dev = Math.sqrt(dev) / n;
-            out.printf(pattern, binfo.get(0).name, avg, dev);
-        }
-    }
-
-    private static class InfoMap {
-        
-        private final Map<String, List<Info>> map = new TreeMap<>();
-        
-        public int maxname = 20;
-        public double maxtime = 0;
-        
-        public void add(String line) {
-            Matcher hit = RE_BENCHMARK.matcher(line);
-            if(hit.find()) {
-                add(new Info(hit));
-            }
-        }
-        
-        public void add(Info info) {
-            maxname = Math.max(maxname, info.name.length());
-            maxtime = Math.max(maxtime, info.time);
-            
-            if( !map.containsKey(info.name) ) {
-                map.put(info.name, new ArrayList<>());
-            }
-            map.get(info.name).add(info);
-        }
-        
-    }
-    
-    private static class Info {
-        
-        public final String vm;
-        public final String name;
-        public final String trial;
-        public final double time;
-        public final int trials;
-        
-        public Info(Matcher hit) {
-            this.vm = hit.group(1);
-            this.name = hit.group(3);
-            this.trial = hit.group(2);
-            this.time = Double.parseDouble(hit.group(4).replace(',', '.'));
-            this.trials = Integer.parseInt(hit.group(6));
-        }
-
-    }
-
-}

+ 0 - 102
assira.junit/src/main/java/net/ranides/assira/junit/BenchmarkRunner.java

@@ -1,102 +0,0 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.IllegalCharsetNameException;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class BenchmarkRunner {
-    
-    private BenchmarkRunner() {
-        // utility class
-    }
-    
-    public static void run(Class<?> clazz) {
-        OutputStream collector = ConsoleObserver.get();
-        new com.google.caliper.Runner().run(
-            "--trials", "3",
-//            "--warmupMillis", "100",
-//            "--runMillis", "100",
-//            "-Dparam=0",
-            clazz.getName()
-        );
-        BenchmarkReport.print(System.out, collector.toString());
-    }
-    
-    
-    static final class ConsoleObserver extends OutputStream {
-
-        private final PrintStream stdout;
-        private final ByteArrayOutputStream stream;
-
-        private ConsoleObserver(PrintStream stdout) {
-            this.stdout = stdout;
-            this.stream = new ByteArrayOutputStream();
-        }
-
-        public static ConsoleObserver get() {
-            ConsoleObserver observer = new ConsoleObserver(System.out);
-            System.setOut(new PrintStream(observer));
-            return observer;
-        }
-
-        @Override
-        public void write(int data) throws IOException {
-            stdout.write(data);
-            stream.write(data);
-        }
-
-        @Override
-        public void write(byte[] data) throws IOException {
-            stdout.write(data);
-            stream.write(data);
-        }
-
-        @Override
-        public void write(byte[] data, int offset, int length) throws IOException {
-            stdout.write(data, offset, length);
-            stream.write(data, offset, length);
-        }
-
-        @Override
-        public void close() throws IOException {
-            stream.close();
-            System.setOut(stdout);
-        }
-
-        @Override
-        public void flush() throws IOException {
-            stdout.flush();
-            stream.flush();
-        }
-
-        @Override
-        public String toString() {
-            return toString("UTF-8");
-        }
-
-        public String toString(String charset) throws IllegalCharsetNameException {
-            try {
-                return stream.toString(charset);
-            } catch (UnsupportedEncodingException cause) {
-                throw (IllegalCharsetNameException)new IllegalCharsetNameException(charset).initCause(cause);
-            }
-        }
-
-    }
-
-
-}
-

+ 0 - 65
assira.junit/src/test/java/net/ranides/assira/junit/BenchmarkReportTest.java

@@ -1,65 +0,0 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public class BenchmarkReportTest {
-    
-    private static final String INPUT =
-        "     0% Scenario{vm=java, trial=0, benchmark=ListThread} 12741,34 ns; ?=252,99 ns @ 20 trials\n"+
-        "    4% Scenario{vm=java, trial=1, benchmark=ListThread} 10735,86 ns; ?=29,81 ns @ 1 trials\n"+
-        "    8% Scenario{vm=java, trial=2, benchmark=ListThread} 10624,55 ns; ?=70,86 ns @ 1 trials\n"+
-        "   13% Scenario{vm=java, trial=0, benchmark=CallerThread} 13616,58 ns; ?=36,58 ns @ 3 trials\n"+
-        "   17% Scenario{vm=java, trial=1, benchmark=CallerThread} 13677,01 ns; ?=66,01 ns @ 3 trials\n"+
-        "   21% Scenario{vm=java, trial=2, benchmark=CallerThread} 13852,23 ns; ?=63,15 ns @ 3 trials\n"+
-        "   25% Scenario{vm=java, trial=0, benchmark=CallerSecurityManager} 826,64 ns; ?=1,84 ns @ 3 trials\n"+
-        "   29% Scenario{vm=java, trial=1, benchmark=CallerSecurityManager} 816,69 ns; ?=3,84 ns @ 3 trials\n"+
-        "   33% Scenario{vm=java, trial=2, benchmark=CallerSecurityManager} 817,24 ns; ?=3,19 ns @ 3 trials\n"+
-        "   38% Scenario{vm=java, trial=0, benchmark=CallerSunReflect} 142,74 ns; ?=1,38 ns @ 5 trials\n"+
-        "   42% Scenario{vm=java, trial=1, benchmark=CallerSunReflect} 145,95 ns; ?=1,77 ns @ 10 trials\n"+
-        "   46% Scenario{vm=java, trial=2, benchmark=CallerSunReflect} 143,09 ns; ?=1,15 ns @ 3 trials\n"+
-        "   50% Scenario{vm=java, trial=0, benchmark=ListException} 12035,15 ns; ?=43,56 ns @ 3 trials\n"+
-        "   54% Scenario{vm=java, trial=1, benchmark=ListException} 12095,09 ns; ?=109,92 ns @ 3 trials\n"+
-        "   58% Scenario{vm=java, trial=2, benchmark=ListException} 12086,37 ns; ?=65,36 ns @ 3 trials\n"+
-        "   63% Scenario{vm=java, trial=0, benchmark=CallerException} 12985,63 ns; ?=145,23 ns @ 10 trials\n"+
-        "   67% Scenario{vm=java, trial=1, benchmark=CallerException} 12959,19 ns; ?=63,32 ns @ 3 trials\n"+
-        "   71% Scenario{vm=java, trial=2, benchmark=CallerException} 12881,98 ns; ?=68,18 ns @ 3 trials\n"+
-        "   75% Scenario{vm=java, trial=0, benchmark=ListSunReflect} 3754,91 ns; ?=37,69 ns @ 4 trials\n"+
-        "   79% Scenario{vm=java, trial=1, benchmark=ListSunReflect} 3862,52 ns; ?=37,97 ns @ 7 trials\n"+
-        "   83% Scenario{vm=java, trial=2, benchmark=ListSunReflect} 3883,26 ns; ?=29,84 ns @ 3 trials\n"+
-        "   88% Scenario{vm=java, trial=0, benchmark=ListSecurityManager} 815,23 ns; ?=1,44 ns @ 3 trials\n"+
-        "   92% Scenario{vm=java, trial=1, benchmark=ListSecurityManager} 821,71 ns; ?=8,04 ns @ 3 trials\n"+
-        "   96% Scenario{vm=java, trial=2, benchmark=ListSecurityManager} 814,32 ns; ?=2,53 ns @ 3 trials\n";
-    
-    private static final String EXPECTED = 
-        "CallerException          = 12961 ? 10%n"+
-        "CallerSecurityManager    =   820 ? 2%n"+
-        "CallerSunReflect         =   145 ? 0%n"+
-        "CallerThread             = 13715 ? 33%n"+
-        "ListException            = 12072 ? 9%n"+
-        "ListSecurityManager      =   817 ? 1%n"+
-        "ListSunReflect           =  3836 ? 14%n"+
-        "ListThread               = 12554 ? 126%n";
-    
-    @Test
-    public void testManual() {
-        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
-        BenchmarkReport.print(new PrintStream(ostream), INPUT);
-
-//        System.out.printf(">>>%n%s<<<%n", ostream.toString());
-        assertEquals(String.format(EXPECTED), ostream.toString());
-    }
-    
-}