Merge "Log package parse timings" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd0d29e9fc
@@ -64,6 +64,7 @@ import android.os.FileUtils;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.PatternMatcher;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
@@ -145,6 +146,8 @@ public class PackageParser {
|
||||
private static final boolean DEBUG_JAR = false;
|
||||
private static final boolean DEBUG_PARSER = false;
|
||||
private static final boolean DEBUG_BACKUP = false;
|
||||
private static final boolean LOG_PARSE_TIMINGS = Build.IS_DEBUGGABLE;
|
||||
private static final int LOG_PARSE_TIMINGS_THRESHOLD_MS = 100;
|
||||
|
||||
private static final String PROPERTY_CHILD_PACKAGES_ENABLED =
|
||||
"persist.sys.child_packages_enabled";
|
||||
@@ -993,14 +996,23 @@ public class PackageParser {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
long parseTime = LOG_PARSE_TIMINGS ? SystemClock.uptimeMillis() : 0;
|
||||
if (packageFile.isDirectory()) {
|
||||
parsed = parseClusterPackage(packageFile, flags);
|
||||
} else {
|
||||
parsed = parseMonolithicPackage(packageFile, flags);
|
||||
}
|
||||
|
||||
long cacheTime = LOG_PARSE_TIMINGS ? SystemClock.uptimeMillis() : 0;
|
||||
cacheResult(packageFile, flags, parsed);
|
||||
|
||||
if (LOG_PARSE_TIMINGS) {
|
||||
parseTime = cacheTime - parseTime;
|
||||
cacheTime = SystemClock.uptimeMillis() - cacheTime;
|
||||
if (parseTime + cacheTime > LOG_PARSE_TIMINGS_THRESHOLD_MS) {
|
||||
Slog.i(TAG, "Parse times for '" + packageFile + "': parse=" + parseTime
|
||||
+ "ms, update_cache=" + cacheTime + " ms");
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user