Skip to content
Snippets Groups Projects
Commit b30c3299 authored by Android Build Role Account android-build-prod's avatar Android Build Role Account android-build-prod
Browse files

Snap for 5370280 from 6397f54b to q-keystone-qcom-release

Change-Id: I6b7262b32e3c04f5af916f519eae9a51c043ba68
parents 9afa3fbb 6397f54b
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ public class DmesgParser implements IParser {
private static final String ACTION = "ACTION";
private static final String DURATION = "DURATION";
private static final String UEVENTD = "ueventd";
private static final String INIT = "init";
// Matches: [ 14.822691] init:
private static final String SERVICE_PREFIX = String.format("^\\[\\s+(?<%s>.*)\\] init:\\s+",
......@@ -94,6 +95,11 @@ public class DmesgParser implements IParser {
private static final Pattern UEVENTD_STAGE_INFO = Pattern.compile(
String.format("%s%s", UEVENTD_PREFIX, STAGE_SUFFIX));
private static final String PROPERTY_SUFFIX= String.format(
"(?<%s>.*)\\s+took\\s+(?<%s>.*)ms$", STAGE, DURATION);
// Matches [ 7.270487] init: Wait for property 'apexd.status=ready' took 230ms
private static final Pattern WAIT_FOR_PROPERTY_INFO = Pattern.compile(
String.format("%s%s", SERVICE_PREFIX, PROPERTY_SUFFIX));
private DmesgItem mDmesgItem = new DmesgItem();
......@@ -142,6 +148,7 @@ public class DmesgParser implements IParser {
* @param line individual line of the dmesg log
*/
private void parse(String line) {
if (parseServiceInfo(line)) {
return;
}
......@@ -210,7 +217,17 @@ public class DmesgParser implements IParser {
stageInfoItem.setDuration((long) (Double.parseDouble(
match.group(DURATION)) * 1000));
mDmesgItem.addStageInfoItem(stageInfoItem);
return true;
}
if((match = matches(WAIT_FOR_PROPERTY_INFO, line)) != null) {
DmesgStageInfoItem stageInfoItem = new DmesgStageInfoItem();
stageInfoItem.setStageName(String.format("%s_%s", INIT, match.group(STAGE)));
stageInfoItem.setDuration((long) (Double.parseDouble(
match.group(DURATION))));
mDmesgItem.addStageInfoItem(stageInfoItem);
return true;
}
return false;
}
......
......@@ -40,6 +40,7 @@ public class DmesgParserTest extends TestCase {
private static final String NETD = "netd";
private static final String[] LINES =
new String[] {
"[ 2.471163] init: Wait for property 'apexd.status=ready' took 403ms",
"[ 3.786943] ueventd: Coldboot took 0.701291 seconds",
"[ 22.962730] init: starting service 'bootanim'...",
"[ 23.252321] init: starting service 'netd'...",
......@@ -96,7 +97,7 @@ public class DmesgParserTest extends TestCase {
assertEquals("Service info items list size should be 2", 2,
dmesgParser.getServiceInfoItems().size());
assertEquals("Stage info items list size should be 2",2,
assertEquals("Stage info items list size should be 3",3,
dmesgParser.getStageInfoItems().size());
assertEquals("Action info items list size should be 9",9,
dmesgParser.getActionInfoItems().size());
......@@ -116,7 +117,7 @@ public class DmesgParserTest extends TestCase {
dmesgParser.parseInfo(bufferedReader);
assertEquals("Service info items list size should be 2", 2,
dmesgParser.getServiceInfoItems().size());
assertEquals("Stage info items list size should be 2", 2,
assertEquals("Stage info items list size should be 3", 3,
dmesgParser.getStageInfoItems().size());
assertEquals("Action info items list size should be 9",9,
dmesgParser.getActionInfoItems().size());
......@@ -197,7 +198,7 @@ public class DmesgParserTest extends TestCase {
dmesgParser.parseStageInfo(line);
}
List<DmesgStageInfoItem> stageInfoItems = dmesgParser.getStageInfoItems();
assertEquals(2, stageInfoItems.size());
assertEquals(3, stageInfoItems.size());
assertEquals(EXPECTED_STAGE_INFO_ITEMS, stageInfoItems);
}
......@@ -234,6 +235,7 @@ public class DmesgParserTest extends TestCase {
private static List<DmesgStageInfoItem> getExpectedStageInfoItems() {
return Arrays.asList(
new DmesgStageInfoItem("init_Wait for property 'apexd.status=ready'", null, 403L),
new DmesgStageInfoItem("ueventd_Coldboot", null, 701L),
new DmesgStageInfoItem("first", 41665L, null));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment