diff options
author | Wainer S. Moschetta | 2011-12-13 19:22:36 +0000 |
---|---|---|
committer | Otavio Pontes | 2011-12-14 12:04:14 +0000 |
commit | 1ad5b184dad25305b7f98943810ebc98bf31ba19 (patch) | |
tree | 0ba2f12bcd5c32c37ba089ef0198851b4249e738 /perf | |
parent | 27a1c31597cf3b43e5d4555c4a1ff21d8e0fded7 (diff) | |
download | org.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.java | 10 |
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) { |