diff options
-rw-r--r-- | tests/SystemMemoryTest/README.txt | 3 | ||||
-rw-r--r-- | tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java | 25 |
2 files changed, 19 insertions, 9 deletions
diff --git a/tests/SystemMemoryTest/README.txt b/tests/SystemMemoryTest/README.txt index de5042cf3732..8ffca1532117 100644 --- a/tests/SystemMemoryTest/README.txt +++ b/tests/SystemMemoryTest/README.txt @@ -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. diff --git a/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java b/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java index 7de092a973ad..616983e39c50 100644 --- a/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java +++ b/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Metrics.java @@ -66,6 +66,18 @@ class Metrics { } /** + * 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. */ private int getPidForProcess(String name) @@ -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: @@ -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 |