diff options
author | Shukang Zhou <shukang@google.com> | 2022-02-18 14:55:00 -0800 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-02-19 02:26:27 +0000 |
commit | 29cacd1e2d35c51336b322d07c2869d7e101a165 (patch) | |
tree | f5a6d5e5c6f354af041250cd84ebf33ab6dcbcae /profilers | |
parent | 43f346d8e0613fd7c23c38f026f457cecac08772 (diff) | |
download | idea-29cacd1e2d35c51336b322d07c2869d7e101a165.tar.gz |
Add diagnosis messages to simpleperf sample reporter
Bug: 219764010
Test: existing
Change-Id: Iafe50d1cc1f29ee905772e153c69ad69438f99e3
Diffstat (limited to 'profilers')
-rw-r--r-- | profilers/src/com/android/tools/profilers/cpu/simpleperf/SimpleperfSampleReporter.java | 9 |
1 files changed, 8 insertions, 1 deletions
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<String> 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<String> command = getReportSampleCommand(trace, processedTraceFile, symbolDirs); + getLogger().info("Running simpleperf command: " + command); + Process reportSample = new ProcessBuilder(command).start(); reportSample.waitFor(); boolean reportSampleSuccess = reportSample.exitValue() == 0; |