Converting the times into properties file
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 11 Mar 2013 19:41:06 +0100
changeset 836eefe5c8438d4
parent 835 24096bd2b38a
child 837 dcc333e8f0b5
Converting the times into properties file
benchmarks/matrix-multiplication/pom.xml
benchmarks/matrix-multiplication/src/main/select-time.xsl
benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java
     1.1 --- a/benchmarks/matrix-multiplication/pom.xml	Sun Mar 10 21:28:50 2013 +0100
     1.2 +++ b/benchmarks/matrix-multiplication/pom.xml	Mon Mar 11 19:41:06 2013 +0100
     1.3 @@ -37,6 +37,36 @@
     1.4                    <skip>true</skip>
     1.5                </configuration>
     1.6            </plugin>      
     1.7 +          <plugin>
     1.8 +              <groupId>org.codehaus.mojo</groupId>
     1.9 +              <artifactId>xml-maven-plugin</artifactId>
    1.10 +              <version>1.0</version>
    1.11 +              <executions>
    1.12 +                  <execution>
    1.13 +                      <goals>
    1.14 +                          <goal>transform</goal>
    1.15 +                      </goals>
    1.16 +                      <phase>install</phase>
    1.17 +                  </execution>
    1.18 +              </executions>
    1.19 +              <configuration>
    1.20 +                  <transformationSets>
    1.21 +                      <transformationSet>
    1.22 +                          <dir>target/surefire-reports</dir>
    1.23 +                          <outputDir>target/surefire-reports</outputDir>
    1.24 +                          <includes>
    1.25 +                              <include>TEST*.xml</include>
    1.26 +                          </includes>
    1.27 +                          <stylesheet>src/main/select-time.xsl</stylesheet>
    1.28 +                          <fileMappers>
    1.29 +                              <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
    1.30 +                                  <targetExtension>.properties</targetExtension>
    1.31 +                              </fileMapper>
    1.32 +                          </fileMappers>                          
    1.33 +                      </transformationSet>
    1.34 +                  </transformationSets>
    1.35 +              </configuration>
    1.36 +          </plugin>
    1.37        </plugins>
    1.38    </build>
    1.39    
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/benchmarks/matrix-multiplication/src/main/select-time.xsl	Mon Mar 11 19:41:06 2013 +0100
     2.3 @@ -0,0 +1,38 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<!--
     2.6 +
     2.7 +    Back 2 Browser Bytecode Translator
     2.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     2.9 +
    2.10 +    This program is free software: you can redistribute it and/or modify
    2.11 +    it under the terms of the GNU General Public License as published by
    2.12 +    the Free Software Foundation, version 2 of the License.
    2.13 +
    2.14 +    This program is distributed in the hope that it will be useful,
    2.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.17 +    GNU General Public License for more details.
    2.18 +
    2.19 +    You should have received a copy of the GNU General Public License
    2.20 +    along with this program. Look for COPYING file in the top folder.
    2.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    2.22 +
    2.23 +-->
    2.24 +
    2.25 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    2.26 +    <xsl:output method="text"/>
    2.27 +
    2.28 +    <xsl:template match="/">
    2.29 +        <xsl:apply-templates select="testsuite/testcase"/>
    2.30 +    </xsl:template>
    2.31 +        
    2.32 +    
    2.33 +    <xsl:template match="testcase">
    2.34 +        <xsl:text>
    2.35 +</xsl:text>
    2.36 +        <xsl:value-of select="@name"/>
    2.37 +        <xsl:text>=</xsl:text>
    2.38 +        <xsl:value-of select="@time"/>
    2.39 +    </xsl:template>
    2.40 +
    2.41 +</xsl:stylesheet>
     3.1 --- a/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Sun Mar 10 21:28:50 2013 +0100
     3.2 +++ b/benchmarks/matrix-multiplication/src/test/java/org/apidesign/benchmark/matrixmul/MatrixTest.java	Mon Mar 11 19:41:06 2013 +0100
     3.3 @@ -31,6 +31,22 @@
     3.4      }
     3.5  
     3.6      @Compare(scripting = false) 
     3.7 +    public String oneIteration() throws IOException {
     3.8 +    
     3.9 +        Matrix m1 = new Matrix(5);
    3.10 +        Matrix m2 = new Matrix(5);
    3.11 +        
    3.12 +        m1.generateData();
    3.13 +        m2.generateData();
    3.14 +        
    3.15 +        Matrix res = m1.multiply(m2);
    3.16 +        
    3.17 +        StringBuilder sb = new StringBuilder();
    3.18 +        res.printOn(sb);
    3.19 +        return sb.toString();
    3.20 +    }
    3.21 +    
    3.22 +    @Compare(scripting = false) 
    3.23      public String tenThousandIterations() throws IOException {
    3.24      
    3.25          Matrix m1 = new Matrix(5);
    3.26 @@ -50,6 +66,27 @@
    3.27          return sb.toString();
    3.28      }
    3.29      
    3.30 +    @Compare(scripting = false) 
    3.31 +    public String tenUselessIterations() throws IOException {
    3.32 +    
    3.33 +        Matrix m1 = new Matrix(5);
    3.34 +        Matrix m2 = new Matrix(5);
    3.35 +        
    3.36 +        m1.generateData();
    3.37 +        m2.generateData();
    3.38 +        
    3.39 +        Matrix res = null;
    3.40 +        for (int i = 0; i < 10; i++) {
    3.41 +            res = m1.multiply(m2);
    3.42 +            m1 = res;
    3.43 +        }
    3.44 +        
    3.45 +        StringBuilder sb = new StringBuilder();
    3.46 +        res.printOn(sb);
    3.47 +        return sb.toString();
    3.48 +    }
    3.49 +
    3.50 +    
    3.51      @Factory
    3.52      public static Object[] create() {
    3.53          return VMTest.create(MatrixTest.class);