/** * *********************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * * * * produced by * * * * Java Grande Benchmarking Project * * * * at * * * * Edinburgh Parallel Computing Centre * * * * email: epcc-javagrande@epcc.ed.ac.uk * * * * * * This version copyright (c) The University of Edinburgh, 1999. * * All rights reserved. * * * * ************************************************************************ * * @author Shams Imam (shams@rice.edu) * */ package edu.rice.hj.example.applications.crypt; import edu.rice.hj.api.SuspendableException; public class JGFCryptBench extends AbstractCryptBench implements JGFSection { private int size; private int datasizes[] = {3000000, 20000000, 50000000}; int iter; /** *

Constructor for JGFCryptBench.

* * @param nthreads a int. * @param iter a int. */ public JGFCryptBench(int nthreads, int iter) { super(nthreads); this.iter = iter; } /** * {@inheritDoc} */ public void JGFsetsize(int size) { this.size = size; } /** *

JGFinitialise.

*/ public void JGFinitialise() { array_rows = datasizes[size]; buildTestData(); } /** *

JGFkernel.

*/ public void JGFkernel() throws SuspendableException { Do(iter); } /** *

JGFvalidate.

*/ public void JGFvalidate() { boolean error; error = false; for (int i = 0; i < array_rows; i++) { error = (plain1[i] != plain2[i]); if (error) { System.out.println("Validation failed"); System.out.println("Original Byte " + i + " = " + plain1[i]); System.out.println("Encrypted Byte " + i + " = " + crypt1[i]); System.out.println("Decrypted Byte " + i + " = " + plain2[i]); //break; } } } /** *

JGFtidyup.

*/ public void JGFtidyup() { freeTestData(); } /** * {@inheritDoc} */ public void JGFrun(int size) throws SuspendableException { JGFInstrumentor.addTimer("Section2:Crypt(" + iter + "):Kernel", "Kbyte", size); JGFsetsize(size); JGFinitialise(); JGFkernel(); JGFvalidate(); JGFtidyup(); JGFInstrumentor.addOpsToTimer("Section2:Crypt(" + iter + "):Kernel", (2 * array_rows) / 1000.); JGFInstrumentor.printTimer("Section2:Crypt(" + iter + "):Kernel"); } }