From 5a9267283c05ba70822ae27a8496c95cdd4a1058 Mon Sep 17 00:00:00 2001 From: Tom Hite Date: Mon, 15 Sep 2014 01:31:03 +0000 Subject: performance profile support Many device trees support the recovery.perf.mode property to set various core frequencies and online/offline mode. TWRP is highly threaded, and support for multiple cores on many operations dramatically recudes the time, e.g., backups, zip flashes, etc. p2: removed user notifications Change-Id: I957b8ca40b241c0af0471327eeb329cce1816017 --- twrp-functions.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 1798c49b7..cd8700f8f 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -42,6 +42,7 @@ #include "partitions.hpp" #include "variables.h" #include "bootloader.h" +#include "cutils/properties.h" #ifdef ANDROID_RB_POWEROFF #include "cutils/android_reboot.h" #endif @@ -1278,4 +1279,14 @@ bool TWFunc::Toggle_MTP(bool enable) { #endif } +void TWFunc::SetPerformanceMode(bool mode) { + if (mode) { + property_set("recovery.perf.mode", "1"); + } else { + property_set("recovery.perf.mode", "0"); + } + // Some time for events to catch up to init handlers + usleep(500000); +} + #endif // ndef BUILD_TWRPTAR_MAIN -- cgit v1.2.3