Skip to content
Snippets Groups Projects
Commit 2ce92643 authored by gopinath's avatar gopinath Committed by Gopinath Elanchezhian
Browse files

Parser to handle only transition delay info.

Tests :
java -cp
out/host/linux-x86/framework/loganalysis-tests.jar:out/host/linux-x86/framework/loganalysis.jar
org.junit.runner.JUnitCore com.android.loganalysis.UnitTests

OK (253 tests)

run google/template/local --template:map test
performance/app-transitions --cold-apps Calculator --hot-apps Calculator
--pre-launch-apps Calculator --apps-to-recents Calculator
--hot-apps-from-recents Calculator --hot-apps-from-recents Calculator
--launch-iteration 2  --no-bugreport-on-invocation-ended --alt-dir
/usr/local/google/home/gelanchezhian/Desktop/local

Test Sponge link:
https://sponge.corp.google.com/invocation?tab=host_log.txt&show=&id=cd595d48-4beb-4bbf-86b0-7b17b4ae82a6&searchFor=&sortBy=STATUS

Change-Id: I61163d67630e54f29248d56c2de1faf4dec45b41
parent 4348cc0f
Branches
No related tags found
No related merge requests found
...@@ -39,10 +39,17 @@ public class EventsLogParser implements IParser { ...@@ -39,10 +39,17 @@ public class EventsLogParser implements IParser {
// 01-01 01:38:44.863 1037 1111 I sysui_multi_action: // 01-01 01:38:44.863 1037 1111 I sysui_multi_action:
// [319,64,321,64,322,99,325,5951,757,761,758,9,759,4,806,com.google.android.gm,871, // [319,64,321,64,322,99,325,5951,757,761,758,9,759,4,806,com.google.android.gm,871,
// com.google.android.gm.welcome.WelcomeTourActivity,905,0] // com.google.android.gm.welcome.WelcomeTourActivity,905,0]
private static final Pattern TRANSITION_DELAY = Pattern.compile( private static final Pattern TRANSITION_STARTING_DELAY = Pattern.compile(
String.format("%s%s", EVENTS_PREFIX, "I sysui_multi_action: \\[319,(.*),321,(.*)" String.format("%s%s", EVENTS_PREFIX, "I sysui_multi_action: \\[319,(.*),321,(.*)"
+ ",322,(.*),806,(.*),871,(.*),905.*\\]$")); + ",322,(.*),806,(.*),871,(.*),905.*\\]$"));
// 01-01 01:38:44.863 1037 1111 I sysui_multi_action:
// [319,64,322,99,325,5951,757,761,758,9,759,4,806,com.google.android.gm,871,
// com.google.android.gm.welcome.WelcomeTourActivity,905,0]
private static final Pattern TRANSITION_DELAY = Pattern.compile(
String.format("%s%s", EVENTS_PREFIX, "I sysui_multi_action: \\[319,(.*),322,(.*)"
+ ",806,(.*),871,(.*),905.*\\]$"));
// 08-21 17:53:53.876 1053 2135 I sysui_latency: [1,50] // 08-21 17:53:53.876 1053 2135 I sysui_latency: [1,50]
private static final Pattern ACTION_LATENCY = Pattern.compile( private static final Pattern ACTION_LATENCY = Pattern.compile(
String.format("%s%s", EVENTS_PREFIX, "I sysui_latency: \\[(?<action>.*)," String.format("%s%s", EVENTS_PREFIX, "I sysui_latency: \\[(?<action>.*),"
...@@ -67,12 +74,17 @@ public class EventsLogParser implements IParser { ...@@ -67,12 +74,17 @@ public class EventsLogParser implements IParser {
String line; String line;
while ((line = input.readLine()) != null) { while ((line = input.readLine()) != null) {
Matcher match = null; Matcher match = null;
if (((match = matches(TRANSITION_DELAY, line)) != null)) { if (((match = matches(TRANSITION_STARTING_DELAY, line)) != null)) {
TransitionDelayItem delayItem = new TransitionDelayItem(); TransitionDelayItem delayItem = new TransitionDelayItem();
delayItem.setComponentName(match.group(4) + "/" + match.group(5)); delayItem.setComponentName(match.group(4) + "/" + match.group(5));
delayItem.setTransitionDelay(Long.parseLong(match.group(1))); delayItem.setTransitionDelay(Long.parseLong(match.group(1)));
delayItem.setStartingWindowDelay(Long.parseLong(match.group(2))); delayItem.setStartingWindowDelay(Long.parseLong(match.group(2)));
transitionDelayItems.add(delayItem); transitionDelayItems.add(delayItem);
} else if (((match = matches(TRANSITION_DELAY, line)) != null)) {
TransitionDelayItem delayItem = new TransitionDelayItem();
delayItem.setComponentName(match.group(3) + "/" + match.group(4));
delayItem.setTransitionDelay(Long.parseLong(match.group(1)));
transitionDelayItems.add(delayItem);
} }
} }
return transitionDelayItems; return transitionDelayItems;
......
...@@ -71,7 +71,7 @@ public class EventsLogParserTest extends TestCase { ...@@ -71,7 +71,7 @@ public class EventsLogParserTest extends TestCase {
} }
/** /**
* Test for Cold launch transition delay info * Test for Cold launch transition delay and starting window delay info
*/ */
public void testValidTransitionDelay() throws IOException { public void testValidTransitionDelay() throws IOException {
List<String> lines = Arrays List<String> lines = Arrays
...@@ -92,6 +92,26 @@ public class EventsLogParserTest extends TestCase { ...@@ -92,6 +92,26 @@ public class EventsLogParserTest extends TestCase {
transitionItems.get(0).getStartingWindowDelay()); transitionItems.get(0).getStartingWindowDelay());
} }
/**
* Test for only transition delay in hot launch
*/
public void testOnlyTransitionDelay() throws IOException {
List<String> lines = Arrays
.asList("01-02 08:12:10.849 934 986 I sysui_multi_action: [319,42,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
"01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
"01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_source_app,802,1]",
"01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,804,799,overview_source_app_index,801,8,802,1]");
List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
assertEquals("Transition Delay items list should have one item", 1,
transitionItems.size());
assertEquals("Component name not parsed correctly",
"com.google.android.apps.maps/com.google.android.maps.MapsActivity",
transitionItems.get(0).getComponentName());
assertEquals("Transition delay is not parsed correctly", 42,
transitionItems.get(0).getTransitionDelay());
}
/** /**
* Test for same app transition delay items order after parsing from the events log * Test for same app transition delay items order after parsing from the events log
*/ */
...@@ -141,7 +161,7 @@ public class EventsLogParserTest extends TestCase { ...@@ -141,7 +161,7 @@ public class EventsLogParserTest extends TestCase {
*/ */
public void testInvalidTransitionPattern() throws IOException { public void testInvalidTransitionPattern() throws IOException {
List<String> lines = Arrays List<String> lines = Arrays
.asList("01-02 08:11:58.691 934 986 I sysui_multi_action: [319,48,328,37,322,82,325,84088,757,761,758,9,759,4,806,com.google.android.calculator,871,com.android.calculator2.Calculator,905,0]", .asList("01-02 08:11:58.691 934 986 I sysui_multi_action: [319,48,322,82,325,84088,757,761,758,9,759,4,807,com.google.android.calculator,871,com.android.calculator2.Calculator,905,0]",
"01-02 08:12:03.639 934 970 I sysui_multi_action: [757,803,799,window_time_0,802,5]", "01-02 08:12:03.639 934 970 I sysui_multi_action: [757,803,799,window_time_0,802,5]",
"01-02 08:12:10.849 934 986 I sysui_multi_action: 319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]", "01-02 08:12:10.849 934 986 I sysui_multi_action: 319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
"01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]", "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment