diff options
author | Ivaylo Asenov <ivaylo.asenov@linaro.org> | 2016-10-21 08:17:51 +0300 |
---|---|---|
committer | Ivaylo Asenov <ivaylo.asenov@linaro.org> | 2016-10-21 08:18:20 +0300 |
commit | a20a339c8950824a57f2538b0b93e50289afd9a9 (patch) | |
tree | 863536dd4785a4b2167ca953485d29a736ceea30 | |
parent | 049833364d7dfff0fdbb694ffda7c61a078f68fa (diff) | |
download | benchmark-a20a339c8950824a57f2538b0b93e50289afd9a9.tar.gz |
Add additional benchmarks to benchmark app.
Integrated benchmarks from: “https://openbenchmarking.org/”:
- "Tiotester"
- "Himeno Benchmark"
- "Stream"
- "FS_Mark"
- "Bork"
- "SciMark"
- "Smallpt"
- "Tscp"
Change-Id: Ic516e9895d835a91e233210fb4fee2377deabfd7
Signed-off-by: Ivaylo Asenov <ivaylo.asenov@linaro.org>
23 files changed, 832 insertions, 5 deletions
diff --git a/BenchmarkFramework/Readme.txt b/BenchmarkFramework/Readme.txt index e95269d..2692db0 100644 --- a/BenchmarkFramework/Readme.txt +++ b/BenchmarkFramework/Readme.txt @@ -5,7 +5,7 @@ This file includes a little info about "benchmarkframework" application. 1) The main target of the application is to run different benchmark tests integrated inside the app and written on (JAVA/C/C++) -2) There are 25 tests integrated for now: +2) There are 33 tests integrated for now: - "MemSpeed" // This benchmark is integrated as *so library and will be remove if not needed. Source code: http://www.roylongbottom.org.uk/android%20benchmarks.htm#anchor17 @@ -51,6 +51,19 @@ This file includes a little info about "benchmarkframework" application. - "Nehe16(GPU)" - "TeapotES(GPU)" +//Source code: https://openbenchmarking.org/ +- "Tiotester" (Tiotester (Threaded I/O Tester) benchmarks the hard disk drive / file-system performance.) +- "Himeno" (The Himeno benchmark is a linear solver of pressure Poisson using a point-Jacobi method). (Processor Test) +- "Stream" Stream:(This benchmark tests the system memory (RAM) performance.) +- "FS-Mark" (FS_Mark is designed to test a system's file-system performance.) +- "Bork" (Bork is a small, cross-platform file encryption utility. It is written in Java and designed to be included along with the files it encrypts for long-term + storage. This test measures the amount of time it takes to encrypt a sample file.) +- "SciMark" (This test runs the Java version of SciMark 2.0, which is a benchmark for scientific and numerical computing developed by programmers at the + National Institute of Standards and Technology. This benchmark is made up of Fast Foruier Transform, Jacobi Successive Over-relaxation, Monte Carlo, + Sparse Matrix Multiply, and dense LU matrix factorization benchmarks.) +- "Smallpt" (Smallpt is a C++ global illumination renderer written in less than 100 lines of code. Global illumination is done via unbiased Monte Carlo path tracing + and there is multi-threading support via the OpenMP library.) +- "Tscp" (This is a performance test of TSCP, Tom Kerrigan's Simple Chess Program, which has a built-in performance benchmark.) diff --git a/BenchmarkFramework/app/app.iml b/BenchmarkFramework/app/app.iml index c90b398..0a3a2f8 100644 --- a/BenchmarkFramework/app/app.iml +++ b/BenchmarkFramework/app/app.iml @@ -98,5 +98,7 @@ <orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" /> <orderEntry type="library" exported="" name="design-23.1.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" /> + <orderEntry type="library" exported="" name="scimark2lib" level="project" /> + <orderEntry type="library" exported="" name="bork" level="project" /> </component> </module>
\ No newline at end of file diff --git a/BenchmarkFramework/app/build.gradle b/BenchmarkFramework/app/build.gradle index f495af5..33d7eb5 100644 --- a/BenchmarkFramework/app/build.gradle +++ b/BenchmarkFramework/app/build.gradle @@ -25,4 +25,6 @@ dependencies { compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile files('libs/mpandroidchartlibrary-2-2-4.jar') + compile files('libs/bork.jar') + compile files('libs/scimark2lib.jar') } diff --git a/BenchmarkFramework/app/libs/bork.jar b/BenchmarkFramework/app/libs/bork.jar Binary files differnew file mode 100644 index 0000000..7d8f1a5 --- /dev/null +++ b/BenchmarkFramework/app/libs/bork.jar diff --git a/BenchmarkFramework/app/libs/scimark2lib.jar b/BenchmarkFramework/app/libs/scimark2lib.jar Binary files differnew file mode 100644 index 0000000..1cfd26d --- /dev/null +++ b/BenchmarkFramework/app/libs/scimark2lib.jar diff --git a/BenchmarkFramework/app/src/main/assets/fs_mark b/BenchmarkFramework/app/src/main/assets/fs_mark Binary files differnew file mode 100755 index 0000000..c7582bc --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/fs_mark diff --git a/BenchmarkFramework/app/src/main/assets/himenobmtxpa b/BenchmarkFramework/app/src/main/assets/himenobmtxpa Binary files differnew file mode 100755 index 0000000..0b7f2bb --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/himenobmtxpa diff --git a/BenchmarkFramework/app/src/main/assets/smallpt b/BenchmarkFramework/app/src/main/assets/smallpt Binary files differnew file mode 100755 index 0000000..bd319de --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/smallpt diff --git a/BenchmarkFramework/app/src/main/assets/stream b/BenchmarkFramework/app/src/main/assets/stream Binary files differnew file mode 100755 index 0000000..a556fce --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/stream diff --git a/BenchmarkFramework/app/src/main/assets/tiotest b/BenchmarkFramework/app/src/main/assets/tiotest Binary files differnew file mode 100755 index 0000000..079290c --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/tiotest diff --git a/BenchmarkFramework/app/src/main/assets/tscp b/BenchmarkFramework/app/src/main/assets/tscp Binary files differnew file mode 100755 index 0000000..2bff7f8 --- /dev/null +++ b/BenchmarkFramework/app/src/main/assets/tscp diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/BaseBenchmark.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/BaseBenchmark.java index 0cc1118..d51b618 100644 --- a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/BaseBenchmark.java +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/BaseBenchmark.java @@ -57,7 +57,10 @@ public class BaseBenchmark { "dhry N", // "iozone -a -i 0 -b output.xls", "iozone -E -C 70 -L -S -W", - "bonnie -d temp -s 400 -r 200 -u "+ MainActivity.APP_UID + "bonnie -d temp -s 400 -r 200 -u "+ MainActivity.APP_UID, + "himenobmtxpa L", + "fs_mark -d temp -s 51200 -n 4096" +// "smallpt 24" ); @@ -366,6 +369,14 @@ public class BaseBenchmark { if(dir.exists()){ Log.i(TAG, tempDirPath + " created"); File dirTemp = new File(tempDirPath); + + if(dirTemp.exists()){//delete files inside temp + String[]entries = dirTemp.list(); + for(String s: entries){ + File currentFile = new File(dirTemp.getPath(),s); + currentFile.delete(); + } + } dirTemp.mkdirs(); } diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Chart.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Chart.java index 959bf8c..0ab9ab5 100644 --- a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Chart.java +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Chart.java @@ -60,7 +60,15 @@ public class Chart extends AppCompatActivity { "Kubench(GPU)", "Nehe08(GPU)", "Nehe16(GPU)", - "TeapotES(GPU)"}; + "TeapotES(GPU)", + "Tiotester", + "Himeno", + "Stream", + "FS-Mark", + "Bork", + "SciMark", + "Smallpt", + "Tscp"}; @Override diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/MainActivity.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/MainActivity.java index 1c00b44..1c3bc9d 100644 --- a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/MainActivity.java +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/MainActivity.java @@ -166,7 +166,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe "Test22", "Test23", "Test24", - "Test25"}; + "Test25", + "Test26", + "Test27", + "Test28", + "Test29", + "Test30", + "Test31", + "Test32", + "Test33"}; //********************************************************************************************** @Override @@ -279,7 +287,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe "Kubench(GPU)", "Nehe08(GPU)", "Nehe16(GPU)", - "TeapotES(GPU)"}; + "TeapotES(GPU)", + "Tiotester", + "Himeno", + "Stream", + "FS-Mark", + "Bork", + "SciMark", + "Smallpt", + "Tscp"}; //*******************GridView******************* diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test26.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test26.java new file mode 100644 index 0000000..1ad55cb --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test26.java @@ -0,0 +1,46 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + +/** + * Created by iasenov on 10/19/16. + */ +public class Test26 extends BaseBenchmark{ + + private String TAG = "tiotester"; + + public String startBenchmark(int count) + { + version = " Tiotester"; + benchmarkName = "Test26"; + executable_name = "tiotest"; + integrationType = "EX"; + chartName = "Tiotester"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test27.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test27.java new file mode 100644 index 0000000..f98bae5 --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test27.java @@ -0,0 +1,46 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + +/** + * Created by iasenov on 10/19/16. + */ +public class Test27 extends BaseBenchmark{ + + private String TAG = "himenobmtxpa"; + + public String startBenchmark(int count) + { + version = " Himeno"; + benchmarkName = "Test27"; + executable_name = "himenobmtxpa"; + integrationType = "EX"; + chartName = "Himeno"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test28.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test28.java new file mode 100644 index 0000000..64f8daa --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test28.java @@ -0,0 +1,46 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + +/** + * Created by iasenov on 10/19/16. + */ +public class Test28 extends BaseBenchmark{ + + private String TAG = "stream"; + + public String startBenchmark(int count) + { + version = " Stream"; + benchmarkName = "Test28"; + executable_name = "stream"; + integrationType = "EX"; + chartName = "Stream"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test29.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test29.java new file mode 100644 index 0000000..cac9839 --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test29.java @@ -0,0 +1,46 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + +/** + * Created by iasenov on 10/19/16. + */ +public class Test29 extends BaseBenchmark{ + + private String TAG = "fs-mark"; + + public String startBenchmark(int count) + { + version = " FS-Mark"; + benchmarkName = "Test29"; + executable_name = "fs_mark"; + integrationType = "EX"; + chartName = "FS-Mark"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test30.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test30.java new file mode 100644 index 0000000..8d1835e --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test30.java @@ -0,0 +1,293 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + +import org.matthew.bork.Bork; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.Arrays; + +import art_benchmarks.math.AccessNBody; + + +/** + * Created by iasenov on 10/20/16. + */ +public class Test30 extends BaseBenchmark{ + + private String TAG = "Bork"; + static boolean isJavaCanceled = false; + + + private static final String PASSWORD = "wibble is a stupid password"; + //private static final byte [] TEST_DATA = + // ("This is a line of text\n" + + // "This is the second line of text\n" + + // "Some special characters \000\0900\0420\b\t").getBytes (); + + private static final byte [] TEST_DATA = ("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam\n"+ + "varius. Pellentesque habitant morbi tristique senectus et netus et\n"+ + "malesuada fames ac turpis egestas. In enim pede, commodo at, aliquam\n"+ + "nec, mattis vel, lectus. Vivamus ligula. Curabitur at orci vel eros\n"+ + "luctus fermentum. Ut quis magna. Aliquam erat volutpat. In augue leo,\n"+ + "eleifend vitae, convallis vitae, mattis iaculis, diam. Nunc\n"+ + "elementum. Phasellus sit amet sapien. Pellentesque aliquam auctor\n"+ + "nisl. Fusce dapibus pulvinar ligula. Vestibulum ornare, enim ut\n"+ + "dignissim lacinia, mauris est varius nisl, non elementum arcu lacus a\n"+ + "justo. Donec tristique commodo pede. Pellentesque ante felis, faucibus\n"+ + "ac, vulputate sit amet, consectetuer vitae, urna. Pellentesque\n"+ + "habitant morbi tristique senectus et netus et malesuada fames ac\n"+ + "turpis egestas. Aenean lobortis tellus ac nibh. Praesent lorem.\n"+ + "\n"+ + " Curabitur libero elit, commodo eu, sollicitudin id, ultrices eget,\n"+ + " mi. In viverra risus in urna. Cras sit amet lacus sodales purus\n"+ + " vestibulum fringilla. Etiam lacus. Aliquam lobortis sem quis\n"+ + " sapien. Cras congue justo non lacus. Phasellus interdum, dui ac\n"+ + " blandit pharetra, magna diam semper justo, ut rutrum diam nibh sit\n"+ + " amet sapien. Aenean semper vestibulum eros. Integer vel lectus eu\n"+ + " ligula elementum aliquam. Pellentesque eu leo. Proin ac arcu. Vivamus\n"+ + " elementum magna quis augue. Nulla molestie felis eu tortor. Ut\n"+ + " placerat elementum sapien. Nullam bibendum euismod erat. In\n"+ + " venenatis, felis cursus mollis viverra, eros ante iaculis tellus, nec\n"+ + " vulputate dolor purus ac leo. Nulla facilisi. Etiam porta fringilla\n"+ + " diam. Phasellus ultricies, est ut fermentum semper, leo eros\n"+ + " vulputate dui, lacinia tempor quam risus id elit.\n"+ + "\n"+ + " Donec malesuada wisi eget dolor. Vivamus euismod. Duis sagittis pede\n"+ + " ac wisi. Integer commodo. Phasellus vestibulum, orci sed molestie\n"+ + " pretium, pede erat ornare justo, ut fringilla tortor dui sed\n"+ + " turpis. Cras suscipit. Vivamus bibendum. Morbi mauris. Duis at ligula\n"+ + " non lorem posuere interdum. Quisque suscipit euismod velit. Integer\n"+ + " mollis, quam at consequat blandit, dui odio eleifend elit, convallis\n"+ + " sagittis pede nulla at lacus. Pellentesque habitant morbi tristique\n"+ + " senectus et netus et malesuada fames ac turpis egestas. Donec\n"+ + " condimentum. Curabitur cursus quam id augue. Etiam porttitor. Lorem\n"+ + " ipsum dolor sit amet, consectetuer adipiscing elit. In a lorem sed\n"+ + " ipsum porta varius.\n"+ + "\n"+ + " Phasellus gravida arcu et magna. Nullam feugiat iaculis mi. Cras\n"+ + " lectus eros, ullamcorper ac, fermentum ut, pharetra gravida,\n"+ + " purus. Aliquam erat volutpat. Integer adipiscing dolor a\n"+ + " tellus. Curabitur in elit. Morbi eleifend, wisi in elementum\n"+ + " porttitor, massa nisl lacinia est, non vehicula magna velit in\n"+ + " diam. Proin vel mauris vitae nibh semper condimentum. Morbi\n"+ + " consectetuer. Duis ac turpis ut sem cursus iaculis. Phasellus luctus\n"+ + " leo eu lorem. Vestibulum lectus nulla, cursus sed, pharetra vitae,\n"+ + " aliquet in, metus. Donec placerat commodo lacus. Vivamus ut\n"+ + " erat. Nullam ut nibh. Mauris faucibus, ipsum vel eleifend ultricies,\n"+ + " pede sem ultricies wisi, vitae gravida leo urna vel lectus. Sed\n"+ + " libero odio, euismod id, malesuada id, porta et, nulla. Donec luctus\n"+ + " odio ut libero malesuada scelerisque. Nulla eros. Nulla facilisi.\n"+ + "\n"+ + " Sed viverra blandit enim. Cum sociis natoque penatibus et magnis dis\n"+ + " parturient montes, nascetur ridiculus mus. Pellentesque nulla felis,\n"+ + " pellentesque tincidunt, bibendum at, aliquet vitae, eros. Vivamus\n"+ + " vitae leo quis est fringilla porttitor. Phasellus vulputate pede a\n"+ + " lectus. Praesent interdum enim vitae tortor. Nulla nisl ipsum,\n"+ + " aliquam ut, volutpat at, commodo a, velit. Nam quis lorem sed wisi\n"+ + " nonummy pharetra. Curabitur imperdiet faucibus metus. Proin viverra,\n"+ + " dolor id imperdiet sodales, leo lacus scelerisque justo, sed dictum\n"+ + " urna tortor non quam. Suspendisse diam tortor, dapibus et,\n"+ + " sollicitudin at, tincidunt ac, purus. Suspendisse neque nulla,\n"+ + " sagittis ut, volutpat eu, venenatis sed, mauris. Proin mattis\n"+ + " lobortis leo. Pellentesque libero.\n"+ + " \n"+ + " Thanks to http://www.lipsum.com/").getBytes(); + + + + public String startBenchmark(int count) { + + isJavaCanceled = false; + + version = " Bork "; + benchmarkName = "Test30"; + integrationType = "SL"; + chartName = "Bork"; + + long before; + long after; + + + clear(); + + //****Redirect System.out and Syste.err**** + PrintStream stdOut = System.out; + PrintStream stdErrt = System.err; + + PrintStream interceptor_stdout = new Interceptor(stdOut); + PrintStream interceptor_err = new Interceptor(stdErrt); + System.setOut(interceptor_stdout);// just add the interceptor + System.setErr(interceptor_err);// just add the interceptor + //****Redirect System.out and Syste.err**** + + startTest = 0;//System.currentTimeMillis(); + endTest = 0; + + if(isJavaCanceled) return ""; + + + //before = System.currentTimeMillis(); + // create plain text + File plaintextFile = createFile (TEST_DATA); + + + // encrypt + Bork bork = new Bork (plaintextFile.getPath (), PASSWORD); + try { + before = System.currentTimeMillis(); + bork.encrypt(); + after = System.currentTimeMillis(); + + File ciphertextFile = bork.outfile; + ciphertextFile.deleteOnExit(); + + + if(!ciphertextFile.exists ()){ + System.out.println("No encrypted file created"); + } + + //assertTrue ("No encrypted file created", ciphertextFile.exists ()); + + byte [] contents = contents (ciphertextFile); + byte [] cipherText = + subarray(contents, contents.length - TEST_DATA.length, TEST_DATA.length); + + + + if(Arrays.equals(TEST_DATA, cipherText)){ + System.out.println("Not encrypted!"); + } + + + //assertFalse("Not encrypted!", Arrays.equals(TEST_DATA, cipherText)); + + if(!plaintextFile.delete()){ + System.out.println("Cannot delete plaintext"); + } + + //assertTrue ("Cannot delete plaintext", plaintextFile.delete()); + + //after = System.currentTimeMillis(); + System.out.println("Bork(encrypt): " + (after - before)); + endTest = after - before + endTest; + + + if(isJavaCanceled) return ""; + + + //before = System.currentTimeMillis(); + // decrypt + bork = new Bork (ciphertextFile.getPath (), PASSWORD); + before = System.currentTimeMillis(); + bork.decrypt(); + after = System.currentTimeMillis(); + + if(!plaintextFile.equals(bork.outfile)){ + System.out.println("Not equals files"); + } + + //assertEquals (plaintextFile, bork.outfile); + + if(!plaintextFile.exists()){ + System.out.println("No decrypted file created: " + plaintextFile); + } + + //assertTrue("No decrypted file created: " + plaintextFile, + // plaintextFile.exists()); + + if(!Arrays.equals(TEST_DATA, contents(bork.outfile))){ + System.out.println("Failed to decrypt back to original"); + } + + //assertTrue("Failed to decrypt back to original", + // Arrays.equals(TEST_DATA, contents(bork.outfile))); + + if(plaintextFile.lastModified() != ciphertextFile.lastModified()){ + System.out.println("Last modified not preservedl"); + } + + //assertEquals("Last modified not preserved", + // plaintextFile.lastModified(), ciphertextFile.lastModified()); + + ciphertextFile.delete(); + //after = System.currentTimeMillis(); + System.out.println("Bork(decrypt): " + (after - before)); + endTest = after - before + endTest; + + + } catch (IOException e) { + e.printStackTrace(); + } + + + + + xout[2] = Interceptor.outputTxt; + Interceptor.clear(); + + //endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + isJavaCanceled = true; + Log.i(TAG, "stopBenchmark: isJNICanceled"); + return true; + } + + + private byte [] subarray (byte [] bytes, int start, int length) + { + byte [] slice = new byte [length]; + + System.arraycopy(bytes, start, slice, 0, length); + + return slice; + } + + private static byte [] contents (File file) throws IOException + { + byte [] buffer = new byte [(int)file.length ()]; + + FileInputStream input = new FileInputStream (file); + + if (input.read(buffer) != buffer.length) + throw new IOException ("Failed to read entire file"); + + input.close(); + + return buffer; + } + + private static File createFile (byte [] contents) + { + + + File plaintextFile = null; + try { + plaintextFile = File.createTempFile("temp", "bork"); + + plaintextFile.deleteOnExit (); + + FileOutputStream output = new FileOutputStream (plaintextFile); + + output.write (contents); + + output.close (); + } catch (IOException e) { + e.printStackTrace(); + } + + return plaintextFile; + } +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test31.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test31.java new file mode 100644 index 0000000..7e1a4bd --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test31.java @@ -0,0 +1,151 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.util.Log; + + + +import java.io.PrintStream; + +import jnt.scimark2.Constants; +import jnt.scimark2.Random; +import jnt.scimark2.kernel; + + +/** + * Created by iasenov on 10/20/16. + */ +public class Test31 extends BaseBenchmark{ + + private String TAG = "SciMark"; + static boolean isJavaCanceled = false; + + + + + + public String startBenchmark(int count) { + + isJavaCanceled = false; + + version = " SciMark "; + benchmarkName = "Test31"; + integrationType = "SL"; + chartName = "SciMark"; + + long before; + long after; + + + clear(); + + //****Redirect System.out and Syste.err**** + PrintStream stdOut = System.out; + PrintStream stdErrt = System.err; + + PrintStream interceptor_stdout = new Interceptor(stdOut); + PrintStream interceptor_err = new Interceptor(stdErrt); + System.setOut(interceptor_stdout);// just add the interceptor + System.setErr(interceptor_err);// just add the interceptor + //****Redirect System.out and Syste.err**** + + startTest = System.currentTimeMillis(); + + + if(isJavaCanceled) return ""; + + + before = System.currentTimeMillis(); + + + // default to the (small) cache-contained version + double min_time = Constants.RESOLUTION_DEFAULT; + + int FFT_size = Constants.FFT_SIZE; + int SOR_size = Constants.SOR_SIZE; + int Sparse_size_M = Constants.SPARSE_SIZE_M; + int Sparse_size_nz = Constants.SPARSE_SIZE_nz; + int LU_size = Constants.LU_SIZE; + + + // run the benchmark + + double res[] = new double[6]; + Random R = new Random(Constants.RANDOM_SEED); + + res[1] = kernel.measureFFT(FFT_size, min_time, R); + if(isJavaCanceled) return ""; + res[2] = kernel.measureSOR( SOR_size, min_time, R); + if(isJavaCanceled) return ""; + res[3] = kernel.measureMonteCarlo(min_time, R); + if(isJavaCanceled) return ""; + res[4] = kernel.measureSparseMatmult( Sparse_size_M, + Sparse_size_nz, min_time, R); + if(isJavaCanceled) return ""; + res[5] = kernel.measureLU( LU_size, min_time, R); + if(isJavaCanceled) return ""; + + + res[0] = (res[1] + res[2] + res[3] + res[4] + res[5]) / 5; + + + // print out results + System.out.println(); + System.out.println("SciMark 2.0a"); + System.out.println(); + System.out.println("Composite Score: " + res[0]); + System.out.print("FFT ("+FFT_size+"): "); + if (res[1]==0.0) + System.out.println(" ERROR, INVALID NUMERICAL RESULT!"); + else + System.out.println(res[1]); + + System.out.println("SOR ("+SOR_size+"x"+ SOR_size+"): " + + " " + res[2]); + System.out.println("Monte Carlo : " + res[3]); + System.out.println("Sparse matmult (N="+ Sparse_size_M+ + ", nz=" + Sparse_size_nz + "): " + res[4]); + System.out.print("LU (" + LU_size + "x" + LU_size + "): "); + if (res[5]==0.0) + System.out.println(" ERROR, INVALID NUMERICAL RESULT!"); + else + System.out.println(res[5]); + + // print out System info + System.out.println(); + System.out.println("java.vendor: " + + System.getProperty("java.vendor")); + System.out.println("java.version: " + + System.getProperty("java.version")); + System.out.println("os.arch: " + + System.getProperty("os.arch")); + System.out.println("os.name: " + + System.getProperty("os.name")); + System.out.println("os.version: " + + System.getProperty("os.version")); + + + + after = System.currentTimeMillis(); + + + + + xout[2] = Interceptor.outputTxt; + Interceptor.clear(); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + isJavaCanceled = true; + Log.i(TAG, "stopBenchmark: isJNICanceled"); + return true; + } + +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test32.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test32.java new file mode 100644 index 0000000..a3a0b2f --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test32.java @@ -0,0 +1,79 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.content.ContentValues; +import android.content.Context; +import android.os.Environment; +import android.provider.MediaStore; +import android.util.Log; + +import java.io.File; + +/** + * Created by iasenov on 10/20/16. + */ +public class Test32 extends BaseBenchmark{ + + private String TAG = "Smallpt"; + + public String startBenchmark(int count) + { + version = " Smallpt"; + benchmarkName = "Test32"; + executable_name = "smallpt"; + integrationType = "EX"; + chartName = "Smallpt"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + //Get produced image file + File img = new File(MainActivity.EXECUTABLE_PATH, "image.ppm"); + + if(img.exists()){ + + /* + // make sure your target location folder exists! + File targetLocation = new File (getGalleryPath() + "iii.ppm"); + + if(img.renameTo(targetLocation)){ + Log.v(TAG, "Move file successful."); + }else{ + Log.v(TAG, "Move file failed."); + Log.v(TAG, img.getAbsolutePath() +"-->"+targetLocation.getAbsolutePath()); + } + + */ + + Log.i(TAG, "image.ppm was deleted"); + img.delete(); + } + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } + + private static String getGalleryPath() { + return Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DCIM + "/"; + } + +} diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test33.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test33.java new file mode 100644 index 0000000..2d48f3a --- /dev/null +++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test33.java @@ -0,0 +1,52 @@ +package org.linaro.iasenov.benchmarkframework; + +import android.os.Environment; +import android.util.Log; + +import java.io.File; + +/** + * Created by iasenov on 10/20/16. + */ +public class Test33 extends BaseBenchmark{ + + private String TAG = "Tscp"; + + public String startBenchmark(int count) + { + version = " Tscp"; + benchmarkName = "Test33"; + executable_name = "tscp"; + integrationType = "EX"; + chartName = "Tscp"; + + + + clear(); + + startTest = System.currentTimeMillis(); + + String param = ""; + + TESTCOMMANDS = getCommands(executable_name, benchmarkName); + + xout[2] = copyAssetsExecFileAndRun(executable_name, TESTCOMMANDS); + + endTest = System.currentTimeMillis(); + + sendElapsedTimeToChart(); + + submitElapsedTime(endTest-startTest); + + + + return benchmarkName + ":" + getBenchmarkResult(5, integrationType); + } + + public boolean stopBenchmark(){ + process_exec.destroy(); + Log.i(TAG, "Destroy Process:" + process_exec.toString()); + return true; + } + +} diff --git a/BenchmarkFramework/shellscript/runTestsFromShell.sh b/BenchmarkFramework/shellscript/runTestsFromShell.sh index 529e8f0..1c3b45a 100755 --- a/BenchmarkFramework/shellscript/runTestsFromShell.sh +++ b/BenchmarkFramework/shellscript/runTestsFromShell.sh @@ -29,6 +29,14 @@ # Test23 = "Nehe08(GPU)" # Test24 = "Nehe16(GPU)" # Test25 = "TeapotES(GPU)" +# Test26 = "Tiotester" +# Test27 = "Himeno" +# Test28 = "Stream" +# Test29 = "FS-Mark" +# Test30 = "Bork" +# Test31 = "SciMark" +# Test32 = "Smallpt" +# Test33 = "Tscp" adb devices @@ -154,6 +162,14 @@ echo "Test22 = Kubench(GPU)" echo "Test23 = Nehe08(GPU)" echo "Test24 = Nehe16(GPU)" echo "Test25 = TeapotES(GPU)" +echo "Test26 = Tiotester" +echo "Test27 = Himeno" +echo "Test28 = Stream" +echo "Test29 = FS-Mark" +echo "Test30 = Bork" +echo "Test31 = SciMark" +echo "Test32 = Smallpt" +echo "Test33 = Tscp" echo "" |