From 29cacd1e2d35c51336b322d07c2869d7e101a165 Mon Sep 17 00:00:00 2001 From: Shukang Zhou Date: Fri, 18 Feb 2022 14:55:00 -0800 Subject: Add diagnosis messages to simpleperf sample reporter Bug: 219764010 Test: existing Change-Id: Iafe50d1cc1f29ee905772e153c69ad69438f99e3 --- .../tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'profilers') diff --git a/profilers/src/com/android/tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java b/profilers/src/com/android/tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java index 216b8370f4b..92a50719501 100644 --- a/profilers/src/com/android/tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java +++ b/profilers/src/com/android/tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java @@ -58,10 +58,17 @@ public final class SimpleperfSampleReporter implements TracePreProcessor { @NotNull public ByteString preProcessTrace(@NotNull ByteString trace, @NotNull List symbolDirs) { try { + if (trace.isEmpty()) { + getLogger().error("Simpleperf preprocessing exited unsuccessfully. Input trace is empty."); + return FAILURE; + } + File processedTraceFile = FileUtil.createTempFile( String.format("%s%ctrace-%d", FileUtil.getTempDirectory(), File.separatorChar, System.currentTimeMillis()), ".trace", true); - Process reportSample = new ProcessBuilder(getReportSampleCommand(trace, processedTraceFile, symbolDirs)).start(); + List command = getReportSampleCommand(trace, processedTraceFile, symbolDirs); + getLogger().info("Running simpleperf command: " + command); + Process reportSample = new ProcessBuilder(command).start(); reportSample.waitFor(); boolean reportSampleSuccess = reportSample.exitValue() == 0; -- cgit v1.2.3