├── AndroidManifest.xml ├── LICENCE ├── Makefile ├── README ├── android-9.jar ├── debug.keystore ├── default.properties ├── jni ├── Android.mk └── bindings.cpp ├── libs └── achartengine-1.0.0.jar ├── res ├── drawable │ ├── background.png │ ├── help.png │ ├── icon.png │ ├── level.xml │ ├── level_1.png │ ├── level_2.png │ ├── level_3.png │ ├── level_4.png │ ├── level_5.png │ ├── level_6.png │ ├── level_7.png │ ├── level_8.png │ ├── level_9.png │ ├── line.png │ ├── power_off.png │ ├── power_on.png │ ├── time.xml │ ├── time_0.png │ ├── time_1.png │ ├── time_10.png │ ├── time_11.png │ ├── time_12.png │ ├── time_2.png │ ├── time_3.png │ ├── time_4.png │ ├── time_5.png │ ├── time_6.png │ ├── time_7.png │ ├── time_8.png │ ├── time_9.png │ └── widget_bg.png ├── layout │ ├── help.xml │ ├── main.xml │ ├── misc_item_layout.xml │ ├── misc_layout.xml │ ├── power_tabs.xml │ ├── widget_configure.xml │ ├── widget_item_layout.xml │ └── widget_layout.xml ├── values │ ├── arrays.xml │ └── strings.xml └── xml │ ├── preferences.xml │ ├── viewer_preferences.xml │ └── widget_info.xml └── src └── edu └── umich └── PowerTutor ├── PowerNotifications.aidl ├── components ├── Audio.java ├── CPU.java ├── GPS.java ├── LCD.java ├── OLED.java ├── PowerComponent.java ├── Sensors.java ├── Threeg.java └── Wifi.java ├── phone ├── DreamConstants.java ├── DreamPowerCalculator.java ├── PassionConstants.java ├── PassionPowerCalculator.java ├── PhoneConstants.java ├── PhonePowerCalculator.java ├── PhoneSelector.java ├── PowerFunction.java ├── SapphireConstants.java └── SapphirePowerCalculator.java ├── service ├── ICounterService.aidl ├── IterationData.java ├── LogUploader.java ├── PowerData.java ├── PowerEstimator.java ├── UMLoggerService.java └── UidInfo.java ├── ui ├── EditPreferences.java ├── Help.java ├── MiscView.java ├── PowerPie.java ├── PowerTabs.java ├── PowerTop.java ├── PowerViewer.java ├── StartupReceiver.java ├── UMLogger.java └── ViewerPreferences.java ├── util ├── BatteryStats.java ├── Counter.java ├── ForegroundDetector.java ├── HexEncode.java ├── HistoryBuffer.java ├── NativeLoader.java ├── NotificationService.java ├── Recycler.java └── SystemInfo.java └── widget ├── Configure.java ├── DataSource.java ├── DataSourceConfigure.java └── PowerWidget.java /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 The University of Michigan 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | 16 | Please send inquiries to powertutor@umich.edu 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: package 2 | 3 | ANDROID_LIB=android-9.jar 4 | CLASSPATH=$(ANDROID_LIB):libs/achartengine-1.0.0.jar 5 | 6 | genres: 7 | mkdir -p gen bin 8 | aapt package -m -J gen -M AndroidManifest.xml -S res -I $(ANDROID_LIB) 9 | 10 | aidl: 11 | find src/ -type f | \ 12 | grep '\.aidl$$' | \ 13 | xargs -n 1 aidl -Isrc -I$(ANDROID_LIB) -ogen 14 | 15 | gen: genres aidl 16 | 17 | compile: gen 18 | mkdir -p bin 19 | find src/ gen/ -type f | \ 20 | grep '\.java$$' | \ 21 | xargs javac -cp $(CLASSPATH) -d bin 22 | ndk-build 23 | 24 | dex: compile 25 | dx --dex --output=bin/classes.dex bin/ libs/ 26 | 27 | package: dex 28 | aapt package -M AndroidManifest.xml -S res \ 29 | -F bin/PowerTutor.apk -I $(ANDROID_LIB) 30 | cd bin; zip PowerTutor.apk classes.dex 31 | zip bin/PowerTutor.apk -r libs -i \*.so 32 | jarsigner -storepass android -keystore debug.keystore \ 33 | bin/PowerTutor.apk androiddebugkey 34 | 35 | install: package 36 | adb install bin/PowerTutor.apk 37 | 38 | clean: 39 | rm -rf bin/ gen/ 40 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | PowerTutor Project 2 | 3 | Model based power mobile power estimator by application 4 | 5 | Contact: powertutor@umich.edu 6 | 7 | Website: http://powertutor.org 8 | 9 | This package includes the PowerTutor source code. The code responsible for 10 | uploading logs to our remote server has been removed and replaced by a stub that 11 | does nothing. 12 | -------------------------------------------------------------------------------- /android-9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/android-9.jar -------------------------------------------------------------------------------- /debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/debug.keystore -------------------------------------------------------------------------------- /default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-3 12 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAN_VARS) 4 | 5 | LOCAL_MODULE_FILENAME := bindings 6 | LOCAL_MODULE := bindings 7 | LOCAL_SRC_FILES := bindings.cpp 8 | 9 | include $(BUILD_SHARED_LIBRARY) 10 | -------------------------------------------------------------------------------- /jni/bindings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | extern "C" { 12 | JNIEXPORT jdouble JNICALL 13 | Java_edu_umich_PowerTutor_components_OLED_getScreenPixPower( 14 | JNIEnv * env, jobject thiz, jdouble rcoef, jdouble gcoef, 15 | jdouble bcoef, jdouble modul_coef); 16 | } 17 | 18 | #define NUMBER_OF_SAMPLES 500 19 | 20 | static int fd = -2; 21 | static struct fb_fix_screeninfo screeninfo; 22 | static unsigned char* buf; 23 | 24 | static unsigned int samples[NUMBER_OF_SAMPLES]; 25 | 26 | JNIEXPORT jdouble JNICALL 27 | Java_edu_umich_PowerTutor_components_OLED_getScreenPixPower( 28 | JNIEnv * env, jobject thiz, jdouble rcoef, jdouble gcoef, 29 | jdouble bcoef, jdouble modul_coef) { 30 | if(fd == -1) { 31 | return (jdouble)-1.0; 32 | } else if(fd == -2) { 33 | fd = open("/dev/graphics/fb0", O_RDWR); 34 | if(fd == -1) { 35 | fd = open("/dev/fb0", O_RDWR); 36 | } 37 | if(fd == -1) { 38 | return (jdouble)-1.0; 39 | } 40 | if(ioctl(fd, FBIOGET_FSCREENINFO, &screeninfo)) { 41 | close(fd); 42 | fd = -1; 43 | return (jdouble)-1.0; 44 | } 45 | buf = (unsigned char*)mmap(NULL, screeninfo.smem_len, PROT_READ, 46 | MAP_SHARED, fd, 0); 47 | if(buf == (unsigned char*)-1) { 48 | close(fd); 49 | fd = -1; 50 | return (jdouble)-1.0; 51 | } 52 | int range = screeninfo.smem_len / 12; 53 | srand(555); 54 | for(int i = 0; i < NUMBER_OF_SAMPLES; i++) { 55 | int a = range * i / NUMBER_OF_SAMPLES; 56 | int b = range * (i + 1) / NUMBER_OF_SAMPLES; 57 | if(b <= a + 1) { 58 | samples[i] = a; 59 | } else { 60 | samples[i] = a + rand() % (b - a); 61 | } 62 | } 63 | } 64 | jdouble pixPower = 0.0; 65 | for(int i = 0; i < NUMBER_OF_SAMPLES; i++) { 66 | int x = 4 * samples[i]; 67 | int r = buf[x]; 68 | int g = buf[x + 1]; 69 | int b = buf[x + 2]; 70 | 71 | /* Calculate the power usage of this one pixel if it were at full 72 | * brightness. Linearly scale by brightness to get true power 73 | * consumption. To calculate whole screen compute average of sampled 74 | * region and multiply by number of pixels. 75 | */ 76 | int modul_val = r + g + b; 77 | pixPower += rcoef * (r * r) + gcoef * (g * g) + bcoef * (b * b) - 78 | modul_coef * (modul_val * modul_val); 79 | } 80 | return pixPower; 81 | } 82 | -------------------------------------------------------------------------------- /libs/achartengine-1.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/libs/achartengine-1.0.0.jar -------------------------------------------------------------------------------- /res/drawable/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/background.png -------------------------------------------------------------------------------- /res/drawable/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/help.png -------------------------------------------------------------------------------- /res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/icon.png -------------------------------------------------------------------------------- /res/drawable/level.xml: -------------------------------------------------------------------------------- 1 | 2 | android:id="@+id/l1" 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/drawable/level_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_1.png -------------------------------------------------------------------------------- /res/drawable/level_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_2.png -------------------------------------------------------------------------------- /res/drawable/level_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_3.png -------------------------------------------------------------------------------- /res/drawable/level_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_4.png -------------------------------------------------------------------------------- /res/drawable/level_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_5.png -------------------------------------------------------------------------------- /res/drawable/level_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_6.png -------------------------------------------------------------------------------- /res/drawable/level_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_7.png -------------------------------------------------------------------------------- /res/drawable/level_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_8.png -------------------------------------------------------------------------------- /res/drawable/level_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/level_9.png -------------------------------------------------------------------------------- /res/drawable/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/line.png -------------------------------------------------------------------------------- /res/drawable/power_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/power_off.png -------------------------------------------------------------------------------- /res/drawable/power_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/power_on.png -------------------------------------------------------------------------------- /res/drawable/time.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /res/drawable/time_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_0.png -------------------------------------------------------------------------------- /res/drawable/time_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_1.png -------------------------------------------------------------------------------- /res/drawable/time_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_10.png -------------------------------------------------------------------------------- /res/drawable/time_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_11.png -------------------------------------------------------------------------------- /res/drawable/time_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_12.png -------------------------------------------------------------------------------- /res/drawable/time_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_2.png -------------------------------------------------------------------------------- /res/drawable/time_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_3.png -------------------------------------------------------------------------------- /res/drawable/time_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_4.png -------------------------------------------------------------------------------- /res/drawable/time_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_5.png -------------------------------------------------------------------------------- /res/drawable/time_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_6.png -------------------------------------------------------------------------------- /res/drawable/time_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_7.png -------------------------------------------------------------------------------- /res/drawable/time_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_8.png -------------------------------------------------------------------------------- /res/drawable/time_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/time_9.png -------------------------------------------------------------------------------- /res/drawable/widget_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msg555/PowerTutor/6ba2d63f97bfdc9abf4b9ff54d6ae3fea7f6ef68/res/drawable/widget_bg.png -------------------------------------------------------------------------------- /res/layout/help.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 15 | 19 | 27 | 33 | 34 | 41 | 51 | 59 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 17 | 22 | 27 | 32 | 38 |