aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Serov <artem.serov@linaro.org>2016-08-26 11:18:36 +0100
committerArtem Serov <artem.serov@linaro.org>2016-08-26 11:20:33 +0100
commit06ded660971faa2300183224784fcf894ec7957a (patch)
treec96844a2f74759d2dce38c084c3d7872a9e20139
parent61bd4b34d351970b869444aaa8f1fed3a7106eec (diff)
downloadart-testing-06ded660971faa2300183224784fcf894ec7957a.tar.gz
Fix caffeinemark files encoding.
Change encoding from UTF-8 with CRLF to ascii. Change-Id: I68af43a0546ebec2a255e43712055029f6bd47ad
-rw-r--r--benchmarks/caffeinemark/FloatAtom.java418
-rw-r--r--benchmarks/caffeinemark/LogicAtom.java444
-rw-r--r--benchmarks/caffeinemark/LoopAtom.java362
-rw-r--r--benchmarks/caffeinemark/MethodAtom.java370
-rw-r--r--benchmarks/caffeinemark/SieveAtom.java344
-rw-r--r--benchmarks/caffeinemark/StringAtom.java332
6 files changed, 1135 insertions, 1135 deletions
diff --git a/benchmarks/caffeinemark/FloatAtom.java b/benchmarks/caffeinemark/FloatAtom.java
index 05b9cf5..78ce754 100644
--- a/benchmarks/caffeinemark/FloatAtom.java
+++ b/benchmarks/caffeinemark/FloatAtom.java
@@ -1,209 +1,209 @@
-/*
- * This benchmark has been ported from "Caffeinemark" benchmark suite and
- * slightly modified: Custom version of Math library (FMath) were replaced by
- * default one.
- *
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/FloatAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: Simulates a 3D rotation of objects around a point.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-import java.lang.Math;
-
-// TODO: check that disassemble of the 'execute' is similar to the original benchmark's one.
-// CHECKSTYLE.OFF: .*
-public class FloatAtom
-{
- public boolean initialize(int i)
- {
- if(i != 0)
- wMaxDegrees = i;
- xA = new float[3][3];
- vA = new float[3][20];
- vB = new float[3][20];
- int j = 0;
- do
- {
- vA[0][j] = j;
- vA[1][j] = -j;
- vA[2][j] = (float)j * 3.1415926535897931F;
- } while(++j < 20);
- return true;
- }
-
- public FloatAtom()
- {
- wMaxDegrees = 185;
- }
-
- public int execute()
- {
- int j;
- for(j = 0; j < wMaxDegrees; j += 5)
- {
- float d = ((float)(float)j * 3.1415926535897931F) / 180F;
- float d1 = (float)Math.sin(d);
- float d2 = (float)Math.cos(d);
- xA[0][0] = d2;
- xA[1][0] = d1;
- xA[2][0] = 0.0F;
- xA[0][1] = -d1;
- xA[1][1] = d2;
- xA[2][1] = 0.0F;
- xA[0][2] = 0.0F;
- xA[1][2] = 0.0F;
- xA[2][2] = 1.0F;
- int i = 0;
- do
- {
- vB[0][i] = 0.0F;
- vB[1][i] = 0.0F;
- vB[2][i] = 0.0F;
- int l = 0;
- do
- {
- int k = 0;
- do
- vB[l][i] = vB[l][i] + xA[k][l] * vB[l][i];
- while(++k < 3);
- } while(++l < 3);
- } while(++i < 20);
- }
-
- return j;
- }
-
- public String testName()
- {
- return new String("Float");
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 4449;
- }
-
- public void setRemote()
- {
- }
-
- public float xA[][];
- public float xB[][];
- public float vA[][];
- public float vB[][];
- public int wMaxDegrees;
- public final int POINTCOUNT = 20;
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_MAX_DEGREES = 1000000;
-
- public void timeFloatAtom(int iters) {
- initialize(PREDEFINED_MAX_DEGREES);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifyFloatAtom() {
- initialize(PREDEFINED_MAX_DEGREES);
- execute();
- float sum = 0.0F;
- for (int i = 0; i < 20; i++) {
- sum += vB[0][i] + vB[1][i] + vB[2][i];
- }
-
- float expected = 0.0f;
- float found = sum;
-
- if (Math.abs(expected - found) > 0.000000001) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- FloatAtom obj = new FloatAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeFloatAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifyFloatAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/FloatAtom: " + (after - before));
- System.exit(rc);
- }
-}
+/*
+ * This benchmark has been ported from "Caffeinemark" benchmark suite and
+ * slightly modified: Custom version of Math library (FMath) were replaced by
+ * default one.
+ *
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/FloatAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: Simulates a 3D rotation of objects around a point.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+import java.lang.Math;
+
+// TODO: check that disassemble of the 'execute' is similar to the original benchmark's one.
+// CHECKSTYLE.OFF: .*
+public class FloatAtom
+{
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ wMaxDegrees = i;
+ xA = new float[3][3];
+ vA = new float[3][20];
+ vB = new float[3][20];
+ int j = 0;
+ do
+ {
+ vA[0][j] = j;
+ vA[1][j] = -j;
+ vA[2][j] = (float)j * 3.1415926535897931F;
+ } while(++j < 20);
+ return true;
+ }
+
+ public FloatAtom()
+ {
+ wMaxDegrees = 185;
+ }
+
+ public int execute()
+ {
+ int j;
+ for(j = 0; j < wMaxDegrees; j += 5)
+ {
+ float d = ((float)(float)j * 3.1415926535897931F) / 180F;
+ float d1 = (float)Math.sin(d);
+ float d2 = (float)Math.cos(d);
+ xA[0][0] = d2;
+ xA[1][0] = d1;
+ xA[2][0] = 0.0F;
+ xA[0][1] = -d1;
+ xA[1][1] = d2;
+ xA[2][1] = 0.0F;
+ xA[0][2] = 0.0F;
+ xA[1][2] = 0.0F;
+ xA[2][2] = 1.0F;
+ int i = 0;
+ do
+ {
+ vB[0][i] = 0.0F;
+ vB[1][i] = 0.0F;
+ vB[2][i] = 0.0F;
+ int l = 0;
+ do
+ {
+ int k = 0;
+ do
+ vB[l][i] = vB[l][i] + xA[k][l] * vB[l][i];
+ while(++k < 3);
+ } while(++l < 3);
+ } while(++i < 20);
+ }
+
+ return j;
+ }
+
+ public String testName()
+ {
+ return new String("Float");
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 4449;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public float xA[][];
+ public float xB[][];
+ public float vA[][];
+ public float vB[][];
+ public int wMaxDegrees;
+ public final int POINTCOUNT = 20;
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_MAX_DEGREES = 1000000;
+
+ public void timeFloatAtom(int iters) {
+ initialize(PREDEFINED_MAX_DEGREES);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifyFloatAtom() {
+ initialize(PREDEFINED_MAX_DEGREES);
+ execute();
+ float sum = 0.0F;
+ for (int i = 0; i < 20; i++) {
+ sum += vB[0][i] + vB[1][i] + vB[2][i];
+ }
+
+ float expected = 0.0f;
+ float found = sum;
+
+ if (Math.abs(expected - found) > 0.000000001) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ FloatAtom obj = new FloatAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeFloatAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifyFloatAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/FloatAtom: " + (after - before));
+ System.exit(rc);
+ }
+}
diff --git a/benchmarks/caffeinemark/LogicAtom.java b/benchmarks/caffeinemark/LogicAtom.java
index bfca043..721ccf2 100644
--- a/benchmarks/caffeinemark/LogicAtom.java
+++ b/benchmarks/caffeinemark/LogicAtom.java
@@ -1,222 +1,222 @@
-/*
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/LogicAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: Tests the speed with which the virtual machine executes decision-making
- * instructions.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-// TODO: investigate very short time of execution of host.
-// CHECKSTYLE.OFF: .*
-public class LogicAtom
-{
- public boolean initialize(int i)
- {
- if(i != 0)
- wIterationCount = i;
- return true;
- }
-
- public int execute()
- {
- boolean flag7 = true;
- boolean flag8 = true;
- boolean flag9 = true;
- boolean flag10 = true;
- boolean flag11 = true;
- boolean flag12 = true;
- boolean flag6 = true;
- boolean flag = true;
- boolean flag1 = true;
- boolean flag2 = true;
- boolean flag3 = true;
- boolean flag4 = true;
- boolean flag5 = true;
- flag7 = true;
- flag8 = true;
- flag9 = true;
- flag10 = true;
- flag11 = true;
- flag12 = true;
- for(int i = 0; i < wIterationCount; i++)
- if((flag || flag1) && (flag2 || flag3) && (flag4 || flag5 || flag6))
- {
- flag7 = !flag7;
- flag8 = !flag8;
- flag9 = !flag9;
- flag10 = !flag10;
- flag11 = !flag11;
- flag12 = !flag12;
- flag = !flag;
- flag1 = !flag1;
- flag2 = !flag2;
- flag3 = !flag3;
- flag4 = !flag4;
- flag5 = !flag5;
- flag = !flag;
- flag1 = !flag1;
- flag2 = !flag2;
- flag3 = !flag3;
- flag4 = !flag4;
- flag5 = !flag5;
- }
-
- flag = true;
- flag1 = false;
- flag2 = true;
- flag3 = false;
- flag4 = true;
- flag5 = false;
- for(int j = 0; j < wIterationCount; j++)
- if((flag || flag1) && (flag2 || flag3) && (flag4 || flag5 || flag6))
- {
- flag = !flag;
- flag1 = !flag1;
- flag2 = !flag2;
- flag3 = !flag3;
- flag4 = !flag4;
- flag5 = !flag5;
- flag7 = !flag7;
- flag8 = !flag8;
- flag9 = !flag9;
- flag10 = !flag10;
- flag11 = !flag11;
- flag12 = !flag12;
- flag7 = !flag7;
- flag8 = !flag8;
- flag9 = !flag9;
- flag10 = !flag10;
- flag11 = !flag11;
- flag12 = !flag12;
- }
-
- return !flag7 ? 1 : 0;
- }
-
- public String testName()
- {
- return new String("Logic");
- }
-
- public LogicAtom()
- {
- wIterationCount = 1200;
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 3813;
- }
-
- public void setRemote()
- {
- }
-
- public int wIterationCount;
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_ITERATION_COUNT = 50000000;
-
- public void timeLogicAtom(int iters) {
- initialize(PREDEFINED_ITERATION_COUNT);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifyLogicAtom() {
- initialize(PREDEFINED_ITERATION_COUNT);
- int expected = 0;
- int found = execute();
-
- if (found != expected) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- LogicAtom obj = new LogicAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeLogicAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifyLogicAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/LogicAtom: " + (after - before));
- System.exit(rc);
- }
-}
+/*
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/LogicAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: Tests the speed with which the virtual machine executes decision-making
+ * instructions.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+// TODO: investigate very short time of execution of host.
+// CHECKSTYLE.OFF: .*
+public class LogicAtom
+{
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ wIterationCount = i;
+ return true;
+ }
+
+ public int execute()
+ {
+ boolean flag7 = true;
+ boolean flag8 = true;
+ boolean flag9 = true;
+ boolean flag10 = true;
+ boolean flag11 = true;
+ boolean flag12 = true;
+ boolean flag6 = true;
+ boolean flag = true;
+ boolean flag1 = true;
+ boolean flag2 = true;
+ boolean flag3 = true;
+ boolean flag4 = true;
+ boolean flag5 = true;
+ flag7 = true;
+ flag8 = true;
+ flag9 = true;
+ flag10 = true;
+ flag11 = true;
+ flag12 = true;
+ for(int i = 0; i < wIterationCount; i++)
+ if((flag || flag1) && (flag2 || flag3) && (flag4 || flag5 || flag6))
+ {
+ flag7 = !flag7;
+ flag8 = !flag8;
+ flag9 = !flag9;
+ flag10 = !flag10;
+ flag11 = !flag11;
+ flag12 = !flag12;
+ flag = !flag;
+ flag1 = !flag1;
+ flag2 = !flag2;
+ flag3 = !flag3;
+ flag4 = !flag4;
+ flag5 = !flag5;
+ flag = !flag;
+ flag1 = !flag1;
+ flag2 = !flag2;
+ flag3 = !flag3;
+ flag4 = !flag4;
+ flag5 = !flag5;
+ }
+
+ flag = true;
+ flag1 = false;
+ flag2 = true;
+ flag3 = false;
+ flag4 = true;
+ flag5 = false;
+ for(int j = 0; j < wIterationCount; j++)
+ if((flag || flag1) && (flag2 || flag3) && (flag4 || flag5 || flag6))
+ {
+ flag = !flag;
+ flag1 = !flag1;
+ flag2 = !flag2;
+ flag3 = !flag3;
+ flag4 = !flag4;
+ flag5 = !flag5;
+ flag7 = !flag7;
+ flag8 = !flag8;
+ flag9 = !flag9;
+ flag10 = !flag10;
+ flag11 = !flag11;
+ flag12 = !flag12;
+ flag7 = !flag7;
+ flag8 = !flag8;
+ flag9 = !flag9;
+ flag10 = !flag10;
+ flag11 = !flag11;
+ flag12 = !flag12;
+ }
+
+ return !flag7 ? 1 : 0;
+ }
+
+ public String testName()
+ {
+ return new String("Logic");
+ }
+
+ public LogicAtom()
+ {
+ wIterationCount = 1200;
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 3813;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public int wIterationCount;
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_ITERATION_COUNT = 50000000;
+
+ public void timeLogicAtom(int iters) {
+ initialize(PREDEFINED_ITERATION_COUNT);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifyLogicAtom() {
+ initialize(PREDEFINED_ITERATION_COUNT);
+ int expected = 0;
+ int found = execute();
+
+ if (found != expected) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ LogicAtom obj = new LogicAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeLogicAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifyLogicAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/LogicAtom: " + (after - before));
+ System.exit(rc);
+ }
+}
diff --git a/benchmarks/caffeinemark/LoopAtom.java b/benchmarks/caffeinemark/LoopAtom.java
index f107164..8a1fcf7 100644
--- a/benchmarks/caffeinemark/LoopAtom.java
+++ b/benchmarks/caffeinemark/LoopAtom.java
@@ -1,181 +1,181 @@
-/*
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/LoopAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: The loop test uses sorting and sequence generation as to measure compiler
- * optimization of loops.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-// CHECKSTYLE.OFF: .*
-public class LoopAtom
-{
- public boolean initialize(int i)
- {
- if(i != 0)
- FIBCOUNT = i;
- fibs = new int[FIBCOUNT];
- return true;
- }
-
- public int execute()
- {
- fibs[0] = 1;
- for(int i = 1; i < FIBCOUNT; i++)
- fibs[i] = fibs[i - 1] + i;
-
- int j1 = 0;
- int k1 = 0;
- for(int j = 0; j < FIBCOUNT; j++)
- {
- for(int k = 1; k < FIBCOUNT; k++)
- {
- int l = FIBCOUNT + dummy;
- j1 += l;
- k1 += 2;
- if(fibs[k - 1] < fibs[k])
- {
- int i1 = fibs[k - 1];
- fibs[k - 1] = fibs[k];
- fibs[k] = i1;
- }
- }
-
- }
-
- sum1 = j1;
- sum2 = k1;
- return fibs[0];
- }
-
- public String testName()
- {
- return new String("Loop");
- }
-
- public LoopAtom()
- {
- dummy = 12;
- FIBCOUNT = 64;
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 2692;
- }
-
- public void setRemote()
- {
- }
-
- public int dummy;
- public int FIBCOUNT;
- public int sum1;
- public int sum2;
- public int fibs[];
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_FIB_COUNT = 10000;
-
- public void timeLoopAtom(int iters) {
- initialize(PREDEFINED_FIB_COUNT);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifyLoopAtom() {
- initialize(PREDEFINED_FIB_COUNT);
- int expected = 49995001;
- int found = execute();
-
- if (found != expected) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- LoopAtom obj = new LoopAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeLoopAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifyLoopAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/LoopAtom: " + (after - before));
- System.exit(rc);
- }
-}
+/*
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/LoopAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: The loop test uses sorting and sequence generation as to measure compiler
+ * optimization of loops.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+// CHECKSTYLE.OFF: .*
+public class LoopAtom
+{
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ FIBCOUNT = i;
+ fibs = new int[FIBCOUNT];
+ return true;
+ }
+
+ public int execute()
+ {
+ fibs[0] = 1;
+ for(int i = 1; i < FIBCOUNT; i++)
+ fibs[i] = fibs[i - 1] + i;
+
+ int j1 = 0;
+ int k1 = 0;
+ for(int j = 0; j < FIBCOUNT; j++)
+ {
+ for(int k = 1; k < FIBCOUNT; k++)
+ {
+ int l = FIBCOUNT + dummy;
+ j1 += l;
+ k1 += 2;
+ if(fibs[k - 1] < fibs[k])
+ {
+ int i1 = fibs[k - 1];
+ fibs[k - 1] = fibs[k];
+ fibs[k] = i1;
+ }
+ }
+
+ }
+
+ sum1 = j1;
+ sum2 = k1;
+ return fibs[0];
+ }
+
+ public String testName()
+ {
+ return new String("Loop");
+ }
+
+ public LoopAtom()
+ {
+ dummy = 12;
+ FIBCOUNT = 64;
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 2692;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public int dummy;
+ public int FIBCOUNT;
+ public int sum1;
+ public int sum2;
+ public int fibs[];
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_FIB_COUNT = 10000;
+
+ public void timeLoopAtom(int iters) {
+ initialize(PREDEFINED_FIB_COUNT);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifyLoopAtom() {
+ initialize(PREDEFINED_FIB_COUNT);
+ int expected = 49995001;
+ int found = execute();
+
+ if (found != expected) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ LoopAtom obj = new LoopAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeLoopAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifyLoopAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/LoopAtom: " + (after - before));
+ System.exit(rc);
+ }
+}
diff --git a/benchmarks/caffeinemark/MethodAtom.java b/benchmarks/caffeinemark/MethodAtom.java
index bd3d249..e191b39 100644
--- a/benchmarks/caffeinemark/MethodAtom.java
+++ b/benchmarks/caffeinemark/MethodAtom.java
@@ -1,185 +1,185 @@
-/*
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/MethodAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: The Method test executes recursive function calls to see how well the VM handles
- * method calls.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-// CHECKSTYLE.OFF: .*
-public class MethodAtom
-{
-
- public MethodAtom()
- {
- wIterationCount = 100;
- }
-
- public int arithmeticSeries(int i)
- {
- if(i == 0)
- return 0;
- else
- return i + arithmeticSeries(i - 1);
- }
-
- public boolean initialize(int i)
- {
- if(i != 0)
- wIterationCount = i;
- return true;
- }
-
- public int execute()
- {
- int j = 0;
- for(int i = 0; i < wIterationCount; i++)
- {
- int k = arithmeticSeries(i);
- int l = notInlineableSeries(i);
- if(k > l)
- j += l;
- else
- j += k;
- }
-
- return j;
- }
-
- public String testName()
- {
- return new String("Method");
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 3728;
- }
-
- public int notInlineableSeries(int i)
- {
- int j = i;
- depthCount++;
- if(i == 0)
- return j;
- if((j & 1) != 0)
- j += notInlineableSeries(i - 1);
- else
- j += 1 + notInlineableSeries(i - 1);
- return j;
- }
-
- public void setRemote()
- {
- }
-
- public int depthCount;
- public int wIterationCount;
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_ITER_COUNT = 4000;
-
- public void timeMethodAtom(int iters) {
- initialize(PREDEFINED_ITER_COUNT);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifyMethodAtom() {
- initialize(PREDEFINED_ITER_COUNT);
- int expected = 2076731408;
- int found = execute();
-
- if (found != expected) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- MethodAtom obj = new MethodAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeMethodAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifyMethodAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/MethodAtom: " + (after - before));
- System.exit(rc);
- }
-
-}
+/*
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/MethodAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: The Method test executes recursive function calls to see how well the VM handles
+ * method calls.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+// CHECKSTYLE.OFF: .*
+public class MethodAtom
+{
+
+ public MethodAtom()
+ {
+ wIterationCount = 100;
+ }
+
+ public int arithmeticSeries(int i)
+ {
+ if(i == 0)
+ return 0;
+ else
+ return i + arithmeticSeries(i - 1);
+ }
+
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ wIterationCount = i;
+ return true;
+ }
+
+ public int execute()
+ {
+ int j = 0;
+ for(int i = 0; i < wIterationCount; i++)
+ {
+ int k = arithmeticSeries(i);
+ int l = notInlineableSeries(i);
+ if(k > l)
+ j += l;
+ else
+ j += k;
+ }
+
+ return j;
+ }
+
+ public String testName()
+ {
+ return new String("Method");
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 3728;
+ }
+
+ public int notInlineableSeries(int i)
+ {
+ int j = i;
+ depthCount++;
+ if(i == 0)
+ return j;
+ if((j & 1) != 0)
+ j += notInlineableSeries(i - 1);
+ else
+ j += 1 + notInlineableSeries(i - 1);
+ return j;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public int depthCount;
+ public int wIterationCount;
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_ITER_COUNT = 4000;
+
+ public void timeMethodAtom(int iters) {
+ initialize(PREDEFINED_ITER_COUNT);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifyMethodAtom() {
+ initialize(PREDEFINED_ITER_COUNT);
+ int expected = 2076731408;
+ int found = execute();
+
+ if (found != expected) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ MethodAtom obj = new MethodAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeMethodAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifyMethodAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/MethodAtom: " + (after - before));
+ System.exit(rc);
+ }
+
+}
diff --git a/benchmarks/caffeinemark/SieveAtom.java b/benchmarks/caffeinemark/SieveAtom.java
index 074c9cc..778f5d2 100644
--- a/benchmarks/caffeinemark/SieveAtom.java
+++ b/benchmarks/caffeinemark/SieveAtom.java
@@ -1,172 +1,172 @@
-/*
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/SieveAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: The classic sieve of eratosthenes finds prime numbers.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-// CHECKSTYLE.OFF: .*
-public class SieveAtom
-{
-
- public SieveAtom()
- {
- wMaxCandidate = 512;
- }
-
- public boolean initialize(int i)
- {
- if(i != 0)
- wMaxCandidate = i;
- wPrimes = new int[wMaxCandidate];
- return true;
- }
-
- public int execute()
- {
- int j = 1;
- boolean flag1 = false;
- wPrimes[0] = 1;
- wPrimes[1] = 2;
- j = 2;
- for(int i = 3; i < wMaxCandidate; i++)
- {
- int k = 1;
- boolean flag;
- for(flag = true; k < j && flag; k++)
- if(wPrimes[k] > 0 && wPrimes[k] <= i / 2 && i % wPrimes[k] == 0)
- flag = false;
-
- if(flag)
- {
- j++;
- wPrimes[j - 1] = i;
- }
- }
-
- return j;
- }
-
- public String testName()
- {
- return new String("Sieve");
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 2771;
- }
-
- public void setRemote()
- {
- }
-
- public int wPrimes[];
- public int wMaxCandidate;
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_MAX_CANDIDATE = 80000;
-
- public void timeSieveAtom(int iters) {
- initialize(PREDEFINED_MAX_CANDIDATE);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifySieveAtom() {
- initialize(PREDEFINED_MAX_CANDIDATE);
- int expected = 7838;
- int found = execute();
-
- if (found != expected) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- SieveAtom obj = new SieveAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeSieveAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifySieveAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/SieveAtom: " + (after - before));
- System.exit(rc);
- }
-}
+/*
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/SieveAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: The classic sieve of eratosthenes finds prime numbers.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+// CHECKSTYLE.OFF: .*
+public class SieveAtom
+{
+
+ public SieveAtom()
+ {
+ wMaxCandidate = 512;
+ }
+
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ wMaxCandidate = i;
+ wPrimes = new int[wMaxCandidate];
+ return true;
+ }
+
+ public int execute()
+ {
+ int j = 1;
+ boolean flag1 = false;
+ wPrimes[0] = 1;
+ wPrimes[1] = 2;
+ j = 2;
+ for(int i = 3; i < wMaxCandidate; i++)
+ {
+ int k = 1;
+ boolean flag;
+ for(flag = true; k < j && flag; k++)
+ if(wPrimes[k] > 0 && wPrimes[k] <= i / 2 && i % wPrimes[k] == 0)
+ flag = false;
+
+ if(flag)
+ {
+ j++;
+ wPrimes[j - 1] = i;
+ }
+ }
+
+ return j;
+ }
+
+ public String testName()
+ {
+ return new String("Sieve");
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 2771;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public int wPrimes[];
+ public int wMaxCandidate;
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_MAX_CANDIDATE = 80000;
+
+ public void timeSieveAtom(int iters) {
+ initialize(PREDEFINED_MAX_CANDIDATE);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifySieveAtom() {
+ initialize(PREDEFINED_MAX_CANDIDATE);
+ int expected = 7838;
+ int found = execute();
+
+ if (found != expected) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ SieveAtom obj = new SieveAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeSieveAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifySieveAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/SieveAtom: " + (after - before));
+ System.exit(rc);
+ }
+}
diff --git a/benchmarks/caffeinemark/StringAtom.java b/benchmarks/caffeinemark/StringAtom.java
index fce61c4..77e2456 100644
--- a/benchmarks/caffeinemark/StringAtom.java
+++ b/benchmarks/caffeinemark/StringAtom.java
@@ -1,166 +1,166 @@
-/*
- * This software is available under multiple licenses at
- * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/StringAtom.java
- * and we redistribute it under the BSD 2-clause License
- */
-
- // COPYRIGHT_BEGIN
- // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- //
- // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
- //
- // This software is available under multiple licenses:
- //
- // (1) BSD 2-clause
- // Redistribution and use in source and binary forms, with or without modification, are
- // permitted provided that the following conditions are met:
- // ·Redistributions of source code must retain the above copyright notice, this list
- // of conditions and the following disclaimer.
- // ·Redistributions in binary form must reproduce the above copyright notice, this list of
- // conditions and the following disclaimer in the documentation and/or other materials
- // provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- //
- // (2) GPL Version 2
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, version 2. This program is distributed
- // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- // PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along
- // with this program.If not, see<http:www.gnu.org/licenses/>.
- //
- // (3)CableLabs License
- // If you or the company you represent has a separate agreement with CableLabs
- // concerning the use of this code, your rights and obligations with respect
- // to this code shall be as set forth therein. No license is granted hereunder
- // for any other purpose.
- //
- // Please contact CableLabs if you need additional information or
- // have any questions.
- //
- // CableLabs
- // 858 Coal Creek Cir
- // Louisville, CO 80027-9750
- // 303 661-9100
- // COPYRIGHT_END
-
-/*
- * Description: The string test conducts a list of operations on strings and string buffers.
- * Main Focus: TODO
- *
- */
-
-package benchmarks.caffeinemark;
-
-// CHECKSTYLE.OFF: .*
-public class StringAtom
-{
-
- public StringAtom()
- {
- wIterationCount = 50;
- }
-
- public boolean initialize(int i)
- {
- if(i != 0)
- wIterationCount = i;
- sPattern1 = "one ";
- sPattern2 = "two ";
- sPattern3 = "three ";
- return true;
- }
-
- public int execute()
- {
- StringBuffer stringbuffer = new StringBuffer("Test");
- for(int j = 0; j < wIterationCount; j++)
- stringbuffer.append(sPattern1).append(sPattern2).append(sPattern3);
-
- stringbuffer.append("four");
- for(int k = 0; k < wIterationCount; k++)
- {
- int i = stringbuffer.toString().indexOf("four", k * 65);
- }
-
- return stringbuffer.length();
- }
-
- public String testName()
- {
- return new String("String");
- }
-
- public void setLocal()
- {
- }
-
- public int cleanUp()
- {
- return 0;
- }
-
- public int defaultMagnification()
- {
- return 2771;
- }
-
- public void setRemote()
- {
- }
-
- public int wIterationCount;
- public String sPattern1;
- public String sPattern2;
- public String sPattern3;
- // CHECKSTYLE.ON: .*
-
- private static int PREDEFINED_ITER_COUNT = 3000;
-
- public void timeStringAtom(int iters) {
- initialize(PREDEFINED_ITER_COUNT);
- for (int i = 0; i < iters; i++) {
- execute();
- }
- }
-
- public boolean verifyStringAtom() {
- initialize(PREDEFINED_ITER_COUNT);
- int expected = 42008;
- int found = execute();
-
- if (found != expected) {
- System.out.println("ERROR: Expected " + expected + " but found " + found);
- return false;
- }
- return true;
- }
-
- public static void main(String[] argv) {
- int rc = 0;
- StringAtom obj = new StringAtom();
-
- final long before = System.currentTimeMillis();
- obj.timeStringAtom(5);
- final long after = System.currentTimeMillis();
-
- if (!obj.verifyStringAtom()) {
- rc++;
- }
- System.out.println("benchmarks/caffeinemark/StringAtom: " + (after - before));
- System.exit(rc);
- }
-}
+/*
+ * This software is available under multiple licenses at
+ * https://community.cablelabs.com/svn/OCAPRI/trunk/ri/RI_Stack/apps/vm_perf_test/src/com/tvworks/plateval/caffeinemark/StringAtom.java
+ * and we redistribute it under the BSD 2-clause License
+ */
+
+ // COPYRIGHT_BEGIN
+ // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
+ //
+ // Copyright (C) 2008-2013, Cable Television Laboratories, Inc.
+ //
+ // This software is available under multiple licenses:
+ //
+ // (1) BSD 2-clause
+ // Redistribution and use in source and binary forms, with or without modification, are
+ // permitted provided that the following conditions are met:
+ // .Redistributions of source code must retain the above copyright notice, this list
+ // of conditions and the following disclaimer.
+ // .Redistributions in binary form must reproduce the above copyright notice, this list of
+ // conditions and the following disclaimer in the documentation and/or other materials
+ // provided with the distribution.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ //
+ // (2) GPL Version 2
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation, version 2. This program is distributed
+ // in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ // PURPOSE. See the GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this program.If not, see<http:www.gnu.org/licenses/>.
+ //
+ // (3)CableLabs License
+ // If you or the company you represent has a separate agreement with CableLabs
+ // concerning the use of this code, your rights and obligations with respect
+ // to this code shall be as set forth therein. No license is granted hereunder
+ // for any other purpose.
+ //
+ // Please contact CableLabs if you need additional information or
+ // have any questions.
+ //
+ // CableLabs
+ // 858 Coal Creek Cir
+ // Louisville, CO 80027-9750
+ // 303 661-9100
+ // COPYRIGHT_END
+
+/*
+ * Description: The string test conducts a list of operations on strings and string buffers.
+ * Main Focus: TODO
+ *
+ */
+
+package benchmarks.caffeinemark;
+
+// CHECKSTYLE.OFF: .*
+public class StringAtom
+{
+
+ public StringAtom()
+ {
+ wIterationCount = 50;
+ }
+
+ public boolean initialize(int i)
+ {
+ if(i != 0)
+ wIterationCount = i;
+ sPattern1 = "one ";
+ sPattern2 = "two ";
+ sPattern3 = "three ";
+ return true;
+ }
+
+ public int execute()
+ {
+ StringBuffer stringbuffer = new StringBuffer("Test");
+ for(int j = 0; j < wIterationCount; j++)
+ stringbuffer.append(sPattern1).append(sPattern2).append(sPattern3);
+
+ stringbuffer.append("four");
+ for(int k = 0; k < wIterationCount; k++)
+ {
+ int i = stringbuffer.toString().indexOf("four", k * 65);
+ }
+
+ return stringbuffer.length();
+ }
+
+ public String testName()
+ {
+ return new String("String");
+ }
+
+ public void setLocal()
+ {
+ }
+
+ public int cleanUp()
+ {
+ return 0;
+ }
+
+ public int defaultMagnification()
+ {
+ return 2771;
+ }
+
+ public void setRemote()
+ {
+ }
+
+ public int wIterationCount;
+ public String sPattern1;
+ public String sPattern2;
+ public String sPattern3;
+ // CHECKSTYLE.ON: .*
+
+ private static int PREDEFINED_ITER_COUNT = 3000;
+
+ public void timeStringAtom(int iters) {
+ initialize(PREDEFINED_ITER_COUNT);
+ for (int i = 0; i < iters; i++) {
+ execute();
+ }
+ }
+
+ public boolean verifyStringAtom() {
+ initialize(PREDEFINED_ITER_COUNT);
+ int expected = 42008;
+ int found = execute();
+
+ if (found != expected) {
+ System.out.println("ERROR: Expected " + expected + " but found " + found);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] argv) {
+ int rc = 0;
+ StringAtom obj = new StringAtom();
+
+ final long before = System.currentTimeMillis();
+ obj.timeStringAtom(5);
+ final long after = System.currentTimeMillis();
+
+ if (!obj.verifyStringAtom()) {
+ rc++;
+ }
+ System.out.println("benchmarks/caffeinemark/StringAtom: " + (after - before));
+ System.exit(rc);
+ }
+}