Android kernel logcat时间戳显示错乱修改

前言

在抓取log时发现,kernel log合logcat的时间戳不对应。在分析log时,造成很大的困扰

修改

针对Android 10 的修改

diff --git a/system/core/logd/LogKlog.cpp b/system/core/logd/LogKlog.cpp
old mode 100644
new mode 100755
index edd326a..f7b1f82
--- a/system/core/logd/LogKlog.cpp
+++ b/system/core/logd/LogKlog.cpp
@@ -308,8 +308,13 @@
             --len;
         }
         buf = cp;
-
-        if (isMonotonic()) return now;
+        //<!--modify for task start {@
+        //if (isMonotonic()) return now;
+        if (isMonotonic()){
+            now = log_time(CLOCK_REALTIME);
+            return now;
+        }
+        //modify for task end @}-->
 
         const char* b;
         if (((b = android::strnstr(cp, len, suspendStr))) &&
@@ -362,6 +367,9 @@
             now = log_time(CLOCK_REALTIME);
         }
     }
+    //<!-- modify for task start {@
+    now = log_time(CLOCK_REALTIME);
+    //modify for task end @}-->
     return now;
 }
 

你可能感兴趣的:(android)