Skip to content
Snippets Groups Projects
Commit f05cc567 authored by Joshua Schwarz's avatar Joshua Schwarz Committed by Android (Google) Code Review
Browse files

Merge "Add app summary metrics to memory health parser."

parents 8438477a 64538e22
Branches
No related tags found
No related merge requests found
...@@ -37,6 +37,15 @@ public class MemoryHealthItem extends GenericItem { ...@@ -37,6 +37,15 @@ public class MemoryHealthItem extends GenericItem {
public static final String NATIVE_PEAK = "native_peak"; public static final String NATIVE_PEAK = "native_peak";
public static final String PSS_PEAK = "pss_peak"; public static final String PSS_PEAK = "pss_peak";
public static final String SUMMARY_JAVA_HEAP_AVG = "summary_java_heap_avg";
public static final String SUMMARY_NATIVE_HEAP_AVG = "summary_native_heap_avg";
public static final String SUMMARY_CODE_AVG = "summary_code_avg";
public static final String SUMMARY_STACK_AVG = "summary_stack_avg";
public static final String SUMMARY_GRAPHICS_AVG = "summary_graphics_avg";
public static final String SUMMARY_OTHER_AVG = "summary_other_avg";
public static final String SUMMARY_SYSTEM_AVG = "summary_system_avg";
public static final String SUMMARY_OVERALL_PSS_AVG = "summary_overall_pss_avg";
public MemoryHealthItem(Map<String, Map<String, Long>> foreground, public MemoryHealthItem(Map<String, Map<String, Long>> foreground,
Map<String, Map<String, Long>> background) { Map<String, Map<String, Long>> background) {
super(new HashSet<String>(Arrays.asList(FOREGROUND, BACKGROUND))); super(new HashSet<String>(Arrays.asList(FOREGROUND, BACKGROUND)));
......
...@@ -43,6 +43,15 @@ public class MemoryHealthParser implements IParser { ...@@ -43,6 +43,15 @@ public class MemoryHealthParser implements IParser {
mappings.put("Peak Dalvik Heap", MemoryHealthItem.DALVIK_PEAK); mappings.put("Peak Dalvik Heap", MemoryHealthItem.DALVIK_PEAK);
mappings.put("Peak Native Heap", MemoryHealthItem.NATIVE_PEAK); mappings.put("Peak Native Heap", MemoryHealthItem.NATIVE_PEAK);
mappings.put("Peak PSS", MemoryHealthItem.PSS_PEAK); mappings.put("Peak PSS", MemoryHealthItem.PSS_PEAK);
mappings.put("Average Summary Java Heap", MemoryHealthItem.SUMMARY_JAVA_HEAP_AVG);
mappings.put("Average Summary Native Heap", MemoryHealthItem.SUMMARY_NATIVE_HEAP_AVG);
mappings.put("Average Summary Code", MemoryHealthItem.SUMMARY_CODE_AVG);
mappings.put("Average Summary Stack", MemoryHealthItem.SUMMARY_STACK_AVG);
mappings.put("Average Summary Graphics", MemoryHealthItem.SUMMARY_GRAPHICS_AVG);
mappings.put("Average Summary Other", MemoryHealthItem.SUMMARY_OTHER_AVG);
mappings.put("Average Summary System", MemoryHealthItem.SUMMARY_SYSTEM_AVG);
mappings.put("Average Summary Overall Pss", MemoryHealthItem.SUMMARY_OVERALL_PSS_AVG);
SECTION_MAPPINGS = Collections.unmodifiableMap(mappings); SECTION_MAPPINGS = Collections.unmodifiableMap(mappings);
} }
......
...@@ -36,6 +36,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -36,6 +36,14 @@ public class MemHealthParserTest extends TestCase {
"Peak Native Heap: 11136", "Peak Native Heap: 11136",
"Peak Dalvik Heap: 9812", "Peak Dalvik Heap: 9812",
"Peak PSS: 95161", "Peak PSS: 95161",
"Average Summary Java Heap: 8223",
"Average Summary Native Heap: 3852",
"Average Summary Code: 1804",
"Average Summary Stack: 246",
"Average Summary Graphics: 0",
"Average Summary Other: 855",
"Average Summary System: 9151",
"Average Summary Overall Pss: 24135",
"Count 528" "Count 528"
); );
...@@ -50,6 +58,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -50,6 +58,14 @@ public class MemHealthParserTest extends TestCase {
assertEquals(11136, process.get("native_peak").longValue()); assertEquals(11136, process.get("native_peak").longValue());
assertEquals(9812, process.get("dalvik_peak").longValue()); assertEquals(9812, process.get("dalvik_peak").longValue());
assertEquals(95161, process.get("pss_peak").longValue()); assertEquals(95161, process.get("pss_peak").longValue());
assertEquals(8223, process.get("summary_java_heap_avg").longValue());
assertEquals(3852, process.get("summary_native_heap_avg").longValue());
assertEquals(1804, process.get("summary_code_avg").longValue());
assertEquals(246, process.get("summary_stack_avg").longValue());
assertEquals(0, process.get("summary_graphics_avg").longValue());
assertEquals(855, process.get("summary_other_avg").longValue());
assertEquals(9151, process.get("summary_system_avg").longValue());
assertEquals(24135, process.get("summary_overall_pss_avg").longValue());
} }
public void testTwoForegroundProc() { public void testTwoForegroundProc() {
...@@ -61,6 +77,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -61,6 +77,14 @@ public class MemHealthParserTest extends TestCase {
"Peak Native Heap: 11136", "Peak Native Heap: 11136",
"Peak Dalvik Heap: 9812", "Peak Dalvik Heap: 9812",
"Peak PSS: 95161", "Peak PSS: 95161",
"Average Summary Java Heap: 8223",
"Average Summary Native Heap: 3852",
"Average Summary Code: 1804",
"Average Summary Stack: 246",
"Average Summary Graphics: 0",
"Average Summary Other: 855",
"Average Summary System: 9151",
"Average Summary Overall Pss: 24135",
"Count 528", "Count 528",
"com.google.android.music", "com.google.android.music",
"Average Native Heap: 1", "Average Native Heap: 1",
...@@ -69,6 +93,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -69,6 +93,14 @@ public class MemHealthParserTest extends TestCase {
"Peak Native Heap: 4", "Peak Native Heap: 4",
"Peak Dalvik Heap: 5", "Peak Dalvik Heap: 5",
"Peak PSS: 6", "Peak PSS: 6",
"Average Summary Java Heap: 7",
"Average Summary Native Heap: 8",
"Average Summary Code: 9",
"Average Summary Stack: 10",
"Average Summary Graphics: 11",
"Average Summary Other: 12",
"Average Summary System: 13",
"Average Summary Overall Pss: 14",
"Count 7" "Count 7"
); );
...@@ -82,6 +114,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -82,6 +114,14 @@ public class MemHealthParserTest extends TestCase {
assertEquals(4, process.get("native_peak").longValue()); assertEquals(4, process.get("native_peak").longValue());
assertEquals(5, process.get("dalvik_peak").longValue()); assertEquals(5, process.get("dalvik_peak").longValue());
assertEquals(6, process.get("pss_peak").longValue()); assertEquals(6, process.get("pss_peak").longValue());
assertEquals(7, process.get("summary_java_heap_avg").longValue());
assertEquals(8, process.get("summary_native_heap_avg").longValue());
assertEquals(9, process.get("summary_code_avg").longValue());
assertEquals(10, process.get("summary_stack_avg").longValue());
assertEquals(11, process.get("summary_graphics_avg").longValue());
assertEquals(12, process.get("summary_other_avg").longValue());
assertEquals(13, process.get("summary_system_avg").longValue());
assertEquals(14, process.get("summary_overall_pss_avg").longValue());
} }
public void testForegroundBackgroundProc() { public void testForegroundBackgroundProc() {
...@@ -93,6 +133,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -93,6 +133,14 @@ public class MemHealthParserTest extends TestCase {
"Peak Native Heap: 11136", "Peak Native Heap: 11136",
"Peak Dalvik Heap: 9812", "Peak Dalvik Heap: 9812",
"Peak PSS: 95161", "Peak PSS: 95161",
"Average Summary Java Heap: 8223",
"Average Summary Native Heap: 3852",
"Average Summary Code: 1804",
"Average Summary Stack: 246",
"Average Summary Graphics: 0",
"Average Summary Other: 855",
"Average Summary System: 9151",
"Average Summary Overall Pss: 24135",
"Count 528", "Count 528",
"Background", "Background",
"com.google.android.music", "com.google.android.music",
...@@ -102,6 +150,14 @@ public class MemHealthParserTest extends TestCase { ...@@ -102,6 +150,14 @@ public class MemHealthParserTest extends TestCase {
"Peak Native Heap: 4", "Peak Native Heap: 4",
"Peak Dalvik Heap: 5", "Peak Dalvik Heap: 5",
"Peak PSS: 6", "Peak PSS: 6",
"Average Summary Java Heap: 7",
"Average Summary Native Heap: 8",
"Average Summary Code: 9",
"Average Summary Stack: 10",
"Average Summary Graphics: 11",
"Average Summary Other: 12",
"Average Summary System: 13",
"Average Summary Overall Pss: 14",
"Count 7" "Count 7"
); );
...@@ -116,5 +172,13 @@ public class MemHealthParserTest extends TestCase { ...@@ -116,5 +172,13 @@ public class MemHealthParserTest extends TestCase {
assertEquals(4, process.get("native_peak").longValue()); assertEquals(4, process.get("native_peak").longValue());
assertEquals(5, process.get("dalvik_peak").longValue()); assertEquals(5, process.get("dalvik_peak").longValue());
assertEquals(6, process.get("pss_peak").longValue()); assertEquals(6, process.get("pss_peak").longValue());
assertEquals(7, process.get("summary_java_heap_avg").longValue());
assertEquals(8, process.get("summary_native_heap_avg").longValue());
assertEquals(9, process.get("summary_code_avg").longValue());
assertEquals(10, process.get("summary_stack_avg").longValue());
assertEquals(11, process.get("summary_graphics_avg").longValue());
assertEquals(12, process.get("summary_other_avg").longValue());
assertEquals(13, process.get("summary_system_avg").longValue());
assertEquals(14, process.get("summary_overall_pss_avg").longValue());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment