diff options
author | Lisa Liu <liulisa@google.com> | 2022-11-01 02:05:52 +0000 |
---|---|---|
committer | Lisa Liu <liulisa@google.com> | 2022-11-10 02:58:18 +0000 |
commit | 54d3cd2cc5349ef02eaa59a161421b12f141409d (patch) | |
tree | cd1c6fb8ed09451914d7525e9454f89eac4a0ad2 /src/com/android/loganalysis/parser/DmesgParser.java | |
parent | d51361a18982b599a1adb6fb1def75816622948b (diff) | |
download | loganalysis-54d3cd2cc5349ef02eaa59a161421b12f141409d.tar.gz |
Add mount_all command parsing to DmesgParserandroid-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-release
[ 2.295667] init: Command 'mount_all --late' action=late-fs
(/vendor/etc/init/init.rc:347) took 250ms and succeeded
Bug: 233968506
Test: loganalysis-tests
Change-Id: I976c66f0df6607019c7de71ca66895bb1d7f1152
Diffstat (limited to 'src/com/android/loganalysis/parser/DmesgParser.java')
-rw-r--r-- | src/com/android/loganalysis/parser/DmesgParser.java | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/src/com/android/loganalysis/parser/DmesgParser.java b/src/com/android/loganalysis/parser/DmesgParser.java index 53514d2..f7aac4d 100644 --- a/src/com/android/loganalysis/parser/DmesgParser.java +++ b/src/com/android/loganalysis/parser/DmesgParser.java @@ -47,6 +47,7 @@ public class DmesgParser implements IParser { private static final String INIT = "init"; private static final String WAIT_PROPERTY = "Wait for property "; private static final String TOTAL_MODULE = "TOTAL_MODULE"; + private static final String MOUNT_ALL = "mount_all"; // Matches: [ 14.822691] init: private static final String SERVICE_PREFIX = String.format("^\\[\\s+(?<%s>.*)\\] init:\\s+", @@ -106,8 +107,8 @@ public class DmesgParser implements IParser { "%sLoaded kernel module \\S+\\/(?<koname>\\S+)\\.ko", SERVICE_PREFIX)); // Matches: [ 3.791635] ueventd: Coldboot took 0.695055 seconds - private static final String STAGE_SUFFIX= String.format( - "(?<%s>.*)\\s+took\\s+(?<%s>.*)\\s+seconds$", STAGE, DURATION); + private static final String STAGE_SUFFIX = + String.format("(?<%s>.*)\\s+took\\s+(?<%s>.*)\\s+seconds$", STAGE, DURATION); private static final Pattern UEVENTD_STAGE_INFO = Pattern.compile( String.format("%s%s", UEVENTD_PREFIX, STAGE_SUFFIX)); @@ -117,6 +118,15 @@ public class DmesgParser implements IParser { private static final Pattern WAIT_FOR_PROPERTY_INFO = Pattern.compile( String.format("%s%s", SERVICE_PREFIX, PROPERTY_SUFFIX)); + // Matches: [ 2.295667] init: Command 'mount_all --late' action=late-fs + // (/vendor/etc/init/init.rc:347) took 250ms and succeeded + private static final String MOUNT_SUFFIX = + String.format( + "Command 'mount_all (?<%s>/\\S+|.*)?--(?<%s>.+)'.* took (?<%s>\\d+)ms.*", + SOURCE, STAGE, DURATION); + private static final Pattern MOUNT_STAGE_INFO = + Pattern.compile(String.format("%s%s", SERVICE_PREFIX, MOUNT_SUFFIX)); + private DmesgItem mDmesgItem = new DmesgItem(); /** @@ -134,10 +144,10 @@ public class DmesgParser implements IParser { /** * Parse the kernel log till EOF to retrieve the duration of the service calls, start times of * different boot stages and actions taken. Besides, while parsing these informations are stored - * in the intermediate {@link DmesgServiceInfoItem}, {@link DmesgStageInfoItem} and - * {@link DmesgActionInfoItem} objects + * in the intermediate {@link DmesgServiceInfoItem}, {@link DmesgStageInfoItem} and {@link + * DmesgActionInfoItem} objects * - * @param input dmesg log + * @param bufferedLog dmesg log * @throws IOException */ public DmesgItem parseInfo(BufferedReader bufferedLog) throws IOException { @@ -184,9 +194,9 @@ public class DmesgParser implements IParser { * log and store the {@code duration} it took to complete the service if the end time stamp is * available in {@link DmesgServiceInfoItem}. * - * @param individual line of the dmesg log - * @return {@code true}, if the {@code line} indicates start or end of a service, - * {@code false}, otherwise + * @param line individual line of the dmesg log + * @return {@code true}, if the {@code line} indicates start or end of a service, {@code false}, + * otherwise */ @VisibleForTesting boolean parseServiceInfo(String line) { @@ -211,13 +221,12 @@ public class DmesgParser implements IParser { } /** - * Parse init stages log from each {@code line} of dmesg log and - * store the stage name, start time and duration if available in a - * {@link DmesgStageInfoItem} object + * Parse init stages log from each {@code line} of dmesg log and store the stage name, start + * time and duration if available in a {@link DmesgStageInfoItem} object * - * @param individual line of the dmesg log - * @return {@code true}, if the {@code line} indicates start of a boot stage, - * {@code false}, otherwise + * @param line individual line of the dmesg log + * @return {@code true}, if the {@code line} indicates start of a boot stage, {@code false}, + * otherwise */ @VisibleForTesting boolean parseStageInfo(String line) { @@ -246,17 +255,31 @@ public class DmesgParser implements IParser { mDmesgItem.addStageInfoItem(stageInfoItem); return true; } - + if ((match = matches(MOUNT_STAGE_INFO, line)) != null) { + DmesgStageInfoItem stageInfoItem = new DmesgStageInfoItem(); + if (match.group(SOURCE).isEmpty()) { + stageInfoItem.setStageName( + String.format("%s_%s_%s", INIT, MOUNT_ALL, match.group(STAGE))); + } else { + stageInfoItem.setStageName( + String.format( + "%s_%s_%s_%s", + INIT, MOUNT_ALL, match.group(STAGE), match.group(SOURCE).trim())); + } + stageInfoItem.setDuration((long) Double.parseDouble(match.group(DURATION))); + mDmesgItem.addStageInfoItem(stageInfoItem); + return true; + } return false; } /** - * Parse action from each {@code line} of dmesg log and store the action name and start time - * in {@link DmesgActionInfoItem} object + * Parse action from each {@code line} of dmesg log and store the action name and start time in + * {@link DmesgActionInfoItem} object * - * @param individual {@code line} of the dmesg log - * @return {@code true}, if {@code line} indicates starting of processing of action - * {@code false}, otherwise + * @param line individual {@code line} of the dmesg log + * @return {@code true}, if {@code line} indicates starting of processing of action {@code + * false}, otherwise */ @VisibleForTesting boolean parseActionInfo(String line) { @@ -279,7 +302,7 @@ public class DmesgParser implements IParser { * Parse modules from each {@code line} of dmesg log and store the module name and loading time * in {@link DmesgModuleInfoItem} object * - * @param individual {@code line} of the dmesg log + * @param line individual {@code line} of the dmesg log * @return {@code true}, if {@code line} indicates start, end of a module loading or the summary * {@code false}, otherwise */ |