[Android] [PATCH 3/3] Benchmark: fix warning log count

Duncan McNamara dcn.mcnamara at gmail.com
Fri Aug 31 11:10:16 CEST 2018


---
 .../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());
         }
-- 
2.18.0



More information about the Android mailing list