• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisión509f099e1dc19199c125ccc2c5ba3d1bf16559fa (tree)
Tiempo2016-10-19 03:40:29
AutorTim Murray <timmurray@goog...>
Commitergitbuildkicker

Log Message

Revert "libsuspend: move to exponential backoff"

This reverts commit fb896944b6a78d951c8442b444af860a28117e5c.

bug 32180327

Change-Id: Ic26bdffac6c56b102348f5393e6eb5d895960d7e
(cherry picked from commit 23c8bab0243bc6e7be8b95702c262c354009d56a)

Cambiar Resumen

Diferencia incremental

--- a/libsuspend/autosuspend_wakeup_count.c
+++ b/libsuspend/autosuspend_wakeup_count.c
@@ -21,7 +21,6 @@
2121 #include <stddef.h>
2222 #include <stdbool.h>
2323 #include <string.h>
24-#include <sys/param.h>
2524 #include <sys/stat.h>
2625 #include <sys/types.h>
2726 #include <unistd.h>
@@ -35,24 +34,12 @@
3534 #define SYS_POWER_STATE "/sys/power/state"
3635 #define SYS_POWER_WAKEUP_COUNT "/sys/power/wakeup_count"
3736
38-#define BASE_SLEEP_TIME 100000
39-
4037 static int state_fd;
4138 static int wakeup_count_fd;
4239 static pthread_t suspend_thread;
4340 static sem_t suspend_lockout;
4441 static const char *sleep_state = "mem";
4542 static void (*wakeup_func)(bool success) = NULL;
46-static int sleep_time = BASE_SLEEP_TIME;
47-
48-static void update_sleep_time(bool success) {
49- if (success) {
50- sleep_time = BASE_SLEEP_TIME;
51- return;
52- }
53- // double sleep time after each failure up to one minute
54- sleep_time = MIN(sleep_time * 2, 60000000);
55-}
5643
5744 static void *suspend_thread_func(void *arg __attribute__((unused)))
5845 {
@@ -60,12 +47,10 @@ static void *suspend_thread_func(void *arg __attribute__((unused)))
6047 char wakeup_count[20];
6148 int wakeup_count_len;
6249 int ret;
63- bool success = true;
50+ bool success;
6451
6552 while (1) {
66- update_sleep_time(success);
67- usleep(sleep_time);
68- success = false;
53+ usleep(100000);
6954 ALOGV("%s: read wakeup_count\n", __func__);
7055 lseek(wakeup_count_fd, 0, SEEK_SET);
7156 wakeup_count_len = TEMP_FAILURE_RETRY(read(wakeup_count_fd, wakeup_count,
@@ -89,6 +74,7 @@ static void *suspend_thread_func(void *arg __attribute__((unused)))
8974 continue;
9075 }
9176
77+ success = true;
9278 ALOGV("%s: write %*s to wakeup_count\n", __func__, wakeup_count_len, wakeup_count);
9379 ret = TEMP_FAILURE_RETRY(write(wakeup_count_fd, wakeup_count, wakeup_count_len));
9480 if (ret < 0) {
@@ -97,8 +83,8 @@ static void *suspend_thread_func(void *arg __attribute__((unused)))
9783 } else {
9884 ALOGV("%s: write %s to %s\n", __func__, sleep_state, SYS_POWER_STATE);
9985 ret = TEMP_FAILURE_RETRY(write(state_fd, sleep_state, strlen(sleep_state)));
100- if (ret >= 0) {
101- success = true;
86+ if (ret < 0) {
87+ success = false;
10288 }
10389 void (*func)(bool success) = wakeup_func;
10490 if (func != NULL) {