Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/perf
diff options
context:
space:
mode:
authorWainer S. Moschetta2011-12-13 19:22:36 +0000
committerOtavio Pontes2011-12-14 12:04:14 +0000
commit1ad5b184dad25305b7f98943810ebc98bf31ba19 (patch)
tree0ba2f12bcd5c32c37ba089ef0198851b4249e738 /perf
parent27a1c31597cf3b43e5d4555c4a1ff21d8e0fded7 (diff)
downloadorg.eclipse.linuxtools-1ad5b184dad25305b7f98943810ebc98bf31ba19.tar.gz
org.eclipse.linuxtools-1ad5b184dad25305b7f98943810ebc98bf31ba19.tar.xz
org.eclipse.linuxtools-1ad5b184dad25305b7f98943810ebc98bf31ba19.zip
Perf: read events list also from stderr
Old versions of Perf used to send events list to stderr instead of stdout This patch changes the plug-in to check whether stdout is empty or not Signed-off-by: Wainer S. Moschetta <wainersm@linux.vnet.ibm.com>
Diffstat (limited to 'perf')
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/PerfCore.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/PerfCore.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/PerfCore.java
index adb5be326b..e8c21a1468 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/PerfCore.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/PerfCore.java
@@ -72,14 +72,18 @@ public class PerfCore {
HashMap<String,ArrayList<String>> events = new HashMap<String,ArrayList<String>>();
Process p = null;
BufferedReader input = null;
- BufferedReader error = null;
try {
// Alternatively can try with -i flag
p = Runtime.getRuntime().exec("perf list"); //(char 1 as -t is a custom field seperator
p.waitFor();
input = new BufferedReader(new InputStreamReader(p.getInputStream()));
- error = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- spitStream(error,"Perf Report (eventsList) STDERR", null);
+ /*
+ * Old versions of Perf will send events list to stderr instead of stdout
+ * Checking if stdout is empty then read from stderr
+ */
+ if ( ! input.ready() )
+ input = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+
} catch( IOException e ) {
e.printStackTrace();
} catch (InterruptedException e) {

Back to the top