summaryrefslogtreecommitdiff
path: root/startop/iorap
diff options
context:
space:
mode:
authoryawanng <yawanng@google.com>2020-12-01 23:59:17 +0000
committerYan Wang <yawanng@google.com>2020-12-10 01:17:08 +0000
commit6cb10246a8f2557176b7bfeb049cbcf5ce5c5dd2 (patch)
tree258135597fef0cdca1368ab8dbc50a693c15270d /startop/iorap
parent37ef4e0be35f2469192cf3e5988fe8e477f6ed86 (diff)
iorap: Terminate iorapd process when both tracing and prefetching are off.
Purge spam log when iorapd process is not alive. Turn off the Iorap Service when both tracing and prefetching are not alive. Bug: 174588448 Test: set the flags via mendel and check the log Change-Id: I8d4e0c869dec5e7dc5016622b154aef46e1d4f02 (cherry picked from commit 11b592be871ea04bf634d2355ec3298bec9a94e6)
Diffstat (limited to 'startop/iorap')
-rw-r--r--startop/iorap/src/com/google/android/startop/iorap/IorapForwardingService.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/startop/iorap/src/com/google/android/startop/iorap/IorapForwardingService.java b/startop/iorap/src/com/google/android/startop/iorap/IorapForwardingService.java
index 3104c7e7e0a1..f923721b19ea 100644
--- a/startop/iorap/src/com/google/android/startop/iorap/IorapForwardingService.java
+++ b/startop/iorap/src/com/google/android/startop/iorap/IorapForwardingService.java
@@ -34,6 +34,7 @@ import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.provider.DeviceConfig;
import android.util.ArraySet;
import android.util.Log;
@@ -154,9 +155,27 @@ public class IorapForwardingService extends SystemService {
@VisibleForTesting
protected boolean isIorapEnabled() {
+ // These two mendel flags should match those in iorapd native process
+ // system/iorapd/src/common/property.h
+ boolean isTracingEnabled =
+ getMendelFlag("iorap_perfetto_enable", "iorapd.perfetto.enable", false);
+ boolean isReadAheadEnabled =
+ getMendelFlag("iorap_readahead_enable", "iorapd.readahead.enable", false);
// Same as the property in iorapd.rc -- disabling this will mean the 'iorapd' binder process
// never comes up, so all binder connections will fail indefinitely.
- return IS_ENABLED;
+ return IS_ENABLED && (isTracingEnabled || isReadAheadEnabled);
+ }
+
+ private boolean getMendelFlag(String mendelFlag, String sysProperty, boolean defaultValue) {
+ // TODO(yawanng) use DeviceConfig to get mendel property.
+ // DeviceConfig doesn't work and the reason is not clear.
+ // Provider service is already up before IORapForwardService.
+ String mendelProperty = "persist.device_config."
+ + DeviceConfig.NAMESPACE_RUNTIME_NATIVE_BOOT
+ + "."
+ + mendelFlag;
+ return SystemProperties.getBoolean(mendelProperty,
+ SystemProperties.getBoolean(sysProperty, defaultValue));
}
//</editor-fold>
@@ -239,7 +258,9 @@ public class IorapForwardingService extends SystemService {
//
// TODO: it would be good to get nodified of 'adb shell stop iorapd' to avoid
// printing this warning.
- Log.w(TAG, "Failed to connect to iorapd, is it down? Delay for " + sleepTime);
+ if (DEBUG) {
+ Log.v(TAG, "Failed to connect to iorapd, is it down? Delay for " + sleepTime);
+ }
// Use a handler instead of Thread#sleep to avoid backing up the binder thread
// when this is called from the death recipient callback.
@@ -275,7 +296,9 @@ public class IorapForwardingService extends SystemService {
// Connect to the native binder service.
mIorapRemote = provideIorapRemote();
if (mIorapRemote == null) {
- Log.e(TAG, "connectToRemoteAndConfigure - null iorap remote. check for Log.wtf?");
+ if (DEBUG) {
+ Log.e(TAG, "connectToRemoteAndConfigure - null iorap remote. check for Log.wtf?");
+ }
return false;
}
invokeRemote(mIorapRemote,