[Android] Benchmark: fix warning log count

Duncan McNamara git at videolan.org
Fri Aug 31 15:38:49 CEST 2018


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Aug 31 11:10:16 2018 +0200| [e120ef0cf1aa56f3cea49fe20b6c223307f2696a] | committer: Geoffrey Métais

Benchmark: fix warning log count

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

> https://code.videolan.org/videolan/vlc-android/commit/e120ef0cf1aa56f3cea49fe20b6c223307f2696a
---

 .../org/videolan/vlc/gui/video/benchmark/BenchActivity.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
index 0411252e4..e9d069492 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
@@ -402,17 +402,24 @@ public class BenchActivity extends ShallowVideoPlayer {
         int counter = 0;
 
         try {
-            Process process = Runtime.getRuntime().exec("logcat -d");
+            int pid = android.os.Process.myPid();
+            /*Displays priority, tag, and PID of the process issuing the message from this pid*/
+            Process process = Runtime.getRuntime().exec("logcat -d -v brief --pid=" + pid);
             BufferedReader bufferedReader = new BufferedReader(
                     new InputStreamReader(process.getInputStream()));
             String line;
             while ((line = bufferedReader.readLine()) != null) {
-                if (line.contains("W VLC") || line.contains("E VLC")) {
+                if (line.contains("W/") || line.contains("E/")) {
                     if (line.contains(" late ")) {
                         counter += 1;
                     }
                 }
             }
+            /* Clear logs, so that next test is not polluted by current one */
+            new ProcessBuilder()
+            .command("logcat", "-c")
+            .redirectErrorStream(true)
+            .start();
         } catch (IOException ex) {
             Log.e(TAG, ex.toString());
         }



More information about the Android mailing list