Loading tests/SystemMemoryTest/README.txt +1 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,7 @@ Running the test You can manually run the test as follows: make tradefed-all system-memory-test SystemMemoryTestDevice tradefed.sh run commandAndExit template/local_min --template:map test=system-memory-test atest -v system-memory-test This installs and runs the test on device. You can see the metrics in the tradefed output. Loading tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java +18 −7 Original line number Diff line number Diff line Loading @@ -65,6 +65,18 @@ class Metrics { this.logs = logs; } /** * Writes the given <code>text</code> to a log with the given label. */ private void logText(String label, String text) throws IOException { File file = File.createTempFile(label, "txt"); PrintStream ps = new PrintStream(file); ps.print(text); try (FileInputStreamSource dataStream = new FileInputStreamSource(file)) { logs.addTestLog(label, LogDataType.TEXT, dataStream); } } /** * Returns the pid for the process with the given name. */ Loading Loading @@ -111,13 +123,7 @@ class Metrics { // Read showmap for system server and add it as a test log String showmap = device.executeShellCommand("showmap " + pid); String showmapLabel = label + ".system_server.showmap"; File file = File.createTempFile(showmapLabel, "txt"); PrintStream ps = new PrintStream(file); ps.print(showmap); try (FileInputStreamSource dataStream = new FileInputStreamSource(file)) { logs.addTestLog(showmapLabel, LogDataType.TEXT, dataStream); } logText(label + ".system_server.showmap", showmap); // Extract VSS, PSS and RSS from the showmap and output them as metrics. // The last lines of the showmap output looks something like: Loading @@ -140,6 +146,11 @@ class Metrics { throw new MetricsException("unexpected showmap format", e); } // Run debuggerd -j to get GC stats for system server and add it as a // test log String debuggerd = device.executeShellCommand("debuggerd -j " + pid); logText(label + ".system_server.debuggerd", debuggerd); // TODO: Experiment with other additional metrics. // TODO: Consider launching an instrumentation to collect metrics from Loading Loading
tests/SystemMemoryTest/README.txt +1 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,7 @@ Running the test You can manually run the test as follows: make tradefed-all system-memory-test SystemMemoryTestDevice tradefed.sh run commandAndExit template/local_min --template:map test=system-memory-test atest -v system-memory-test This installs and runs the test on device. You can see the metrics in the tradefed output. Loading
tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java +18 −7 Original line number Diff line number Diff line Loading @@ -65,6 +65,18 @@ class Metrics { this.logs = logs; } /** * Writes the given <code>text</code> to a log with the given label. */ private void logText(String label, String text) throws IOException { File file = File.createTempFile(label, "txt"); PrintStream ps = new PrintStream(file); ps.print(text); try (FileInputStreamSource dataStream = new FileInputStreamSource(file)) { logs.addTestLog(label, LogDataType.TEXT, dataStream); } } /** * Returns the pid for the process with the given name. */ Loading Loading @@ -111,13 +123,7 @@ class Metrics { // Read showmap for system server and add it as a test log String showmap = device.executeShellCommand("showmap " + pid); String showmapLabel = label + ".system_server.showmap"; File file = File.createTempFile(showmapLabel, "txt"); PrintStream ps = new PrintStream(file); ps.print(showmap); try (FileInputStreamSource dataStream = new FileInputStreamSource(file)) { logs.addTestLog(showmapLabel, LogDataType.TEXT, dataStream); } logText(label + ".system_server.showmap", showmap); // Extract VSS, PSS and RSS from the showmap and output them as metrics. // The last lines of the showmap output looks something like: Loading @@ -140,6 +146,11 @@ class Metrics { throw new MetricsException("unexpected showmap format", e); } // Run debuggerd -j to get GC stats for system server and add it as a // test log String debuggerd = device.executeShellCommand("debuggerd -j " + pid); logText(label + ".system_server.debuggerd", debuggerd); // TODO: Experiment with other additional metrics. // TODO: Consider launching an instrumentation to collect metrics from Loading