diff options
Diffstat (limited to 'simpleperf/demo/SimpleperfExampleWithNative/app')
31 files changed, 384 insertions, 0 deletions
diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/.gitignore b/simpleperf/demo/SimpleperfExampleWithNative/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/CMakeLists.txt b/simpleperf/demo/SimpleperfExampleWithNative/app/CMakeLists.txt new file mode 100644 index 00000000..f8e6e8b3 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/CMakeLists.txt @@ -0,0 +1,44 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.4.1) + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. + +add_library( # Sets the name of the library. + native-lib + + # Sets the library as a shared library. + SHARED + + # Provides a relative path to your source file(s). + src/main/cpp/native-lib.cpp ) + +# Searches for a specified prebuilt library and stores the path as a +# variable. Because CMake includes system libraries in the search path by +# default, you only need to specify the name of the public NDK library +# you want to add. CMake verifies that the library exists before +# completing its build. + +find_library( # Sets the name of the path variable. + log-lib + + # Specifies the name of the NDK library that + # you want CMake to locate. + log ) + +# Specifies libraries CMake should link to your target library. You +# can link multiple libraries, such as libraries you define in this +# build script, prebuilt third-party libraries, or system libraries. + +target_link_libraries( # Specifies the target library. + native-lib + + # Links the target library to the log library + # included in the NDK. + ${log-lib} )
\ No newline at end of file diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle b/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle new file mode 100644 index 00000000..efa47c20 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle @@ -0,0 +1,42 @@ +apply plugin: 'com.android.application' + +apply from: 'profiling.gradle' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.2" + defaultConfig { + applicationId "com.example.simpleperf.simpleperfexamplewithnative" + minSdkVersion 15 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags "-std=c++11" + } + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.1' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' +} diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling.gradle b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling.gradle new file mode 100644 index 00000000..661d5497 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling.gradle @@ -0,0 +1,60 @@ + +// Set when building only part of the abis in the apk. +def abiFiltersForWrapScript = [] + +android { + buildTypes { + profiling { + initWith debug + externalNativeBuild { + cmake { + // cmake Debug build type uses -O0, which makes the code slow. + arguments "-DCMAKE_BUILD_TYPE=Release" + } + } + packagingOptions { + // Contain debug info in the libraries. + doNotStrip "**.so" + + // Exclude wrap.sh for architectures not built. + if (abiFiltersForWrapScript) { + def exclude_abis = ["armeabi", "armeabi-v7a", "arm64-v8a", + "x86", "x86_64", "mips", "mips64"] + .findAll{ !(it in abiFiltersForWrapScript) } + .collect{ "**/" + it + "/wrap.sh" } + excludes += exclude_abis + } + } + + // Add lib/xxx/wrap.sh in the apk. This is to enable java profiling on Android O + // devices. + sourceSets { + main { + resources { + srcDir { + "profiling_apk_add_dir" + } + } + } + } + } + } +} + +def writeWrapScriptToFullyCompileJavaApp(wrapFile) { + wrapFile.withWriter { writer -> + writer.write('#!/system/bin/sh\n') + writer.write('\$@\n') + } +} + +task createProfilingApkAddDir { + for (String abi : ["armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"]) { + def dir = new File("app/profiling_apk_add_dir/lib/" + abi) + dir.mkdirs() + def wrapFile = new File(dir, "wrap.sh") + writeWrapScriptToFullyCompileJavaApp(wrapFile) + println "write file " + wrapFile.path + } +} + diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/arm64-v8a/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/arm64-v8a/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/arm64-v8a/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi-v7a/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi-v7a/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi-v7a/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/armeabi/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips64/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips64/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/mips64/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86_64/wrap.sh b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86_64/wrap.sh new file mode 100644 index 00000000..047ea6fa --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/profiling_apk_add_dir/lib/x86_64/wrap.sh @@ -0,0 +1,2 @@ +#!/system/bin/sh +$@ diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/proguard-rules.pro b/simpleperf/demo/SimpleperfExampleWithNative/app/proguard-rules.pro new file mode 100644 index 00000000..b9d149a6 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /home/yabinc/Android/Sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/androidTest/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleInstrumentedTest.java b/simpleperf/demo/SimpleperfExampleWithNative/app/src/androidTest/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleInstrumentedTest.java new file mode 100644 index 00000000..3b21b449 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/androidTest/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.simpleperf.simpleperfexamplewithnative; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.simpleperf.simpleperfexamplewithnative", appContext.getPackageName()); + } +} diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/AndroidManifest.xml b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..94078ff3 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.simpleperf.simpleperfexamplewithnative"> + + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity android:name=".MainActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest>
\ No newline at end of file diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/cpp/native-lib.cpp b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/cpp/native-lib.cpp new file mode 100644 index 00000000..5cd0607b --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/cpp/native-lib.cpp @@ -0,0 +1,62 @@ +#include <jni.h> + +#include <pthread.h> +#include <stdlib.h> + +#include <string> + + + +extern "C" +JNIEXPORT jstring JNICALL +Java_com_example_simpleperf_simpleperfexamplewithnative_MainActivity_stringFromJNI( + JNIEnv *env, + jobject /* this */) { + std::string hello = "Hello from C++"; + return env->NewStringUTF(hello.c_str()); +} + +static void ThrowErrnoException(JNIEnv* env, const char* function_name, int err) { + jclass cls = env->FindClass("android/system/ErrnoException"); + if (cls == nullptr) { + return; + } + jmethodID cid = env->GetMethodID(cls, "<init>", "(Ljava/lang/String;I)V"); + if (cid == nullptr) { + return; + } + jstring msg = env->NewStringUTF(function_name); + if (msg == nullptr) { + return; + } + jthrowable obj = (jthrowable)env->NewObject(cls, cid, msg, err); + if (obj == nullptr) { + return; + } + env->Throw(obj); +} + +int CallFunction(int a) { + return a + atoi("1"); +} + +static void* BusyLoopThread(void*) { + volatile int i = 0; + while (true) { + i = CallFunction(i); + } + return nullptr; +} + +extern "C" +JNIEXPORT void JNICALL +Java_com_example_simpleperf_simpleperfexamplewithnative_MainActivity_createBusyThreadFromJNI( + JNIEnv *env, + jobject /* this */) { + pthread_t thread; + int ret = pthread_create(&thread, nullptr, BusyLoopThread, nullptr); + if (ret) { + ThrowErrnoException(env, "pthread_create", ret); + return; + } +} diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java new file mode 100644 index 00000000..4dbf4823 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/java/com/example/simpleperf/simpleperfexamplewithnative/MainActivity.java @@ -0,0 +1,33 @@ +package com.example.simpleperf.simpleperfexamplewithnative; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.widget.TextView; + +public class MainActivity extends AppCompatActivity { + + // Used to load the 'native-lib' library on application startup. + static { + System.loadLibrary("native-lib"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // Example of a call to a native method + TextView tv = (TextView) findViewById(R.id.sample_text); + tv.setText(stringFromJNI()); + + createBusyThreadFromJNI(); + } + + /** + * A native method that is implemented by the 'native-lib' native library, + * which is packaged with this application. + */ + public native String stringFromJNI(); + + private native void createBusyThreadFromJNI(); +} diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/layout/activity_main.xml b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..9b06408d --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.example.simpleperf.simpleperfexamplewithnative.MainActivity"> + + <TextView + android:id="@+id/sample_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Hello World!" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + +</android.support.constraint.ConstraintLayout> diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..cde69bcc --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..9a078e3e --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..c133a0cb --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..efc028a6 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..bfa42f0e --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..3af2608a --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..324e72cd --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..9bec2e62 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..aee44e13 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..34947cd6 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/colors.xml b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..3ab3e9cb --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#3F51B5</color> + <color name="colorPrimaryDark">#303F9F</color> + <color name="colorAccent">#FF4081</color> +</resources> diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/strings.xml b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..1ac079d7 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="app_name">SimpleperfExampleWithNative</string> +</resources> diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/styles.xml b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..5885930d --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + +</resources> diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/src/test/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleUnitTest.java b/simpleperf/demo/SimpleperfExampleWithNative/app/src/test/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleUnitTest.java new file mode 100644 index 00000000..5bb893b9 --- /dev/null +++ b/simpleperf/demo/SimpleperfExampleWithNative/app/src/test/java/com/example/simpleperf/simpleperfexamplewithnative/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.simpleperf.simpleperfexamplewithnative; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +}
\ No newline at end of file |