summaryrefslogtreecommitdiffstats
path: root/logcat
diff options
context:
space:
mode:
authorRiley Andrews <riandrews@google.com>2015-06-08 23:36:34 -0700
committerRiley Andrews <riandrews@google.com>2015-06-09 12:36:45 -0700
commitd98f4e8af5076e6a9dbd4ddc2c375cb7bcda8cd8 (patch)
tree0612af9c0104dc2df0b235822e6651eb45430154 /logcat
parent6f1457adc58644f7c68829fd0872947bd7e63bfd (diff)
downloadcore-d98f4e8af5076e6a9dbd4ddc2c375cb7bcda8cd8.tar.gz
core-d98f4e8af5076e6a9dbd4ddc2c375cb7bcda8cd8.tar.bz2
core-d98f4e8af5076e6a9dbd4ddc2c375cb7bcda8cd8.zip
Lower the priority of the threads in logd/logcat.
sched_batch implies only a penalty to latency in scheduling, but does not imply that the process will be given less cpu time. Increase the nice level to 10 to prioritize it below ui threads. Bug: 21696721 Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
Diffstat (limited to 'logcat')
-rw-r--r--logcat/logcat.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 736e02eaa..e598bb810 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/cdefs.h>
+#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -33,6 +34,7 @@
#include <log/logd.h>
#include <log/logger.h>
#include <log/logprint.h>
+#include <utils/threads.h>
#define DEFAULT_MAX_ROTATED_LOGS 4
@@ -221,6 +223,10 @@ static void setupOutput()
fprintf(stderr, "failed to set to batch scheduler\n");
}
+ if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
+ fprintf(stderr, "failed set to priority\n");
+ }
+
g_outFD = openLogFile (g_outputFileName);
if (g_outFD < 0) {