summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees Troy <dees_troy@teamw.in>2014-02-07 19:46:59 +0100
committerGerrit Code Review <gerrit2@gerrit>2014-02-07 19:46:59 +0100
commit3b2be98ca45a6c6f50b8d68cfafd5509c40d670d (patch)
tree0c717c6345b33d79ecb06348c45b439feaa65a00
parentMerge "Restore contexts when doing mkdierhier in libtar Do a restore of loaded file contexts to /data/media directory. This will help denials to be prevented when internal storage is wiped." into android-4.4 (diff)
parentAdd option to print render time of each frame to log file (diff)
downloadandroid_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar.gz
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar.bz2
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar.lz
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar.xz
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.tar.zst
android_bootable_recovery-3b2be98ca45a6c6f50b8d68cfafd5509c40d670d.zip
-rw-r--r--gui/gui.cpp27
-rw-r--r--twrp-functions.cpp6
-rw-r--r--twrp-functions.hpp1
3 files changed, 34 insertions, 0 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 2098342b0..912899f07 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -57,6 +57,9 @@ extern "C"
#include "blanktimer.hpp"
#endif
+// Enable to print render time of each frame to the log file
+//#define PRINT_RENDER_TIME 1
+
const static int CURTAIN_FADE = 32;
using namespace rapidxml;
@@ -484,6 +487,11 @@ static int runPages(void)
DataManager::SetValue("tw_loaded", 1);
+#ifdef PRINT_RENDER_TIME
+ timespec start, end;
+ int32_t render_t, flip_t;
+#endif
+
for (;;)
{
loopTimer();
@@ -493,11 +501,30 @@ static int runPages(void)
int ret;
ret = PageManager::Update();
+
+#ifndef PRINT_RENDER_TIME
if (ret > 1)
PageManager::Render();
if (ret > 0)
flip();
+#else
+ if (ret > 1)
+ {
+ clock_gettime(CLOCK_MONOTONIC, &start);
+ PageManager::Render();
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ render_t = TWFunc::timespec_diff_ms(start, end);
+
+ flip();
+ clock_gettime(CLOCK_MONOTONIC, &start);
+ flip_t = TWFunc::timespec_diff_ms(end, start);
+
+ LOGINFO("Render(): %u ms, flip(): %u ms, total: %u ms\n", render_t, flip_t, render_t+flip_t);
+ }
+ else if(ret == 1)
+ flip();
+#endif
}
else
{
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 3f44fd2ce..df7174362 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -515,6 +515,12 @@ timespec TWFunc::timespec_diff(timespec& start, timespec& end)
return temp;
}
+int32_t TWFunc::timespec_diff_ms(timespec& start, timespec& end)
+{
+ return ((end.tv_sec * 1000) + end.tv_nsec/1000000) -
+ ((start.tv_sec * 1000) + start.tv_nsec/1000000);
+}
+
int TWFunc::drop_caches(void) {
string file = "/proc/sys/vm/drop_caches";
string value = "3";
diff --git a/twrp-functions.hpp b/twrp-functions.hpp
index eb88ae2f3..587d7725e 100644
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -60,6 +60,7 @@ public:
static int copy_file(string src, string dst, int mode); //copy file from src to dst with mode permissions
static unsigned int Get_D_Type_From_Stat(string Path); // Returns a dirent dt_type value using stat instead of dirent
static timespec timespec_diff(timespec& start, timespec& end); // Return a diff for 2 times
+ static int32_t timespec_diff_ms(timespec& start, timespec& end); // Returns diff in ms
static int read_file(string fn, vector<string>& results); //read from file
static int read_file(string fn, string& results); //read from file
static int write_file(string fn, string& line); //write from file