-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20285f4
commit 0836913
Showing
48 changed files
with
2,694 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.guilhermed.offloadingfibonaccibench" | ||
minSdkVersion 19 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
implementation 'com.mcxiaoke.volley:library:1.0.19' | ||
implementation 'com.cloudbees:endpoints:0.8' | ||
implementation 'eu.hgross:blaubot-android:2+' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# 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 |
26 changes: 26 additions & 0 deletions
26
...src/androidTest/java/com/guilhermed/offloadingfibonaccibench/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.guilhermed.offloadingfibonaccibench; | ||
|
||
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.*; | ||
|
||
/** | ||
* Instrumented 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() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.guilhermed.offloadingfibonacci", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.guilhermed.offloadingfibonaccibench"> | ||
|
||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_SECONDARY_STORAGE" /> | ||
<uses-permission android:name="android.permission.WRITE_SECONDARY_STORAGE" /> | ||
<uses-permission android:name="android.permission.STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
|
||
<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" | ||
android:largeHeap="true" | ||
android:usesCleartextTraffic="true"> | ||
<uses-library android:name="org.apache.http.legacy" android:required="false"/> | ||
|
||
<service | ||
android:name=".Midd" | ||
android:enabled="true" | ||
android:exported="true"></service> | ||
|
||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package AMOk; | ||
|
||
import Offload.Dataset; | ||
|
||
public class Actuator { | ||
private KnowledgeBase kBase; | ||
private Dataset dataset; | ||
|
||
public Actuator() { | ||
kBase = KnowledgeBase.getInstance(); | ||
dataset = Dataset.getInstance(); | ||
} | ||
|
||
public void act(){ | ||
dataset.setShouldOffload(kBase.getShouldOffload()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package AMOk; | ||
|
||
import android.util.Log; | ||
|
||
import Offload.Dataset; | ||
|
||
public class Analyser { | ||
|
||
public void analyse(){ | ||
KnowledgeBase kBase = KnowledgeBase.getInstance(); | ||
|
||
final String toastText = "fileSizeValue[0,1]: "+ Math.min((double)KnowledgeBase.getInstance().getFileSize()/(double)30,(double)1) | ||
+ "\nMemoValue[0,1]: "+ (double)KnowledgeBase.getInstance().getHeapUsed()/(double)KnowledgeBase.getInstance().getHeapSize() | ||
+ "\nBattery[0,1]:" + (double)KnowledgeBase.getInstance().getBatteryPct(); | ||
Log.d("Analyser data:",toastText); | ||
|
||
/** Specialist defined parameters due to application requests*/ | ||
double batteryWeight = 0.5; | ||
double memoWeight = 0.3; | ||
double sizeWeight = 0.2; | ||
|
||
|
||
double memo = memoWeight*((double)kBase.getHeapUsed()/(double)kBase.getHeapSize()); | ||
|
||
/** Using 30KB as size reference*/ | ||
double size = sizeWeight* Math.min((double)kBase.getFileSize()/(double)30,(double)1); | ||
|
||
double battery; | ||
|
||
if(kBase.isCharging()) | ||
battery = batteryWeight; | ||
else | ||
battery = batteryWeight*(double)kBase.getBatteryPct(); | ||
|
||
double coef = size + battery + memo; | ||
|
||
kBase.setCoefficient(coef); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package AMOk; | ||
|
||
public class Executor { | ||
|
||
public void execute(){ | ||
Actuator mActuator = new Actuator(); | ||
mActuator.act(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package AMOk; | ||
|
||
public class FrameworkMain { | ||
private Monitor mMonitor; | ||
private Analyser mAnalyser; | ||
private Planner mPlanner; | ||
private Executor mExecutor; | ||
|
||
public FrameworkMain(){ | ||
mMonitor = new Monitor(); | ||
mAnalyser = new Analyser(); | ||
mPlanner = new Planner(); | ||
mExecutor = new Executor(); | ||
} | ||
|
||
public void run(){ | ||
mMonitor.monitor(); | ||
mAnalyser.analyse(); | ||
mPlanner.plan(); | ||
mExecutor.execute(); | ||
} | ||
} |
Oops, something went wrong.