Android Framework: 增加trace點

摩斯电码發表於2024-10-22

參考

  • systrace/perfetto中需要actrace打tag相關方法-車載車機framework系統開發實戰

示例:

+#define ATRACE_TAG ATRACE_TAG_ALWAYS
+
 #include <dlfcn.h>
 #include <iostream>
+#include <utils/Trace.h>

@@ -55,6 +58,7 @@ void LogdStub::initLogLevel() {
 }

 bool LogdStub::isFactoryBuild() {
+        ATRACE_CALL();
         char factoryBuild[92];
         property_get("ro.boot.factorybuild", factoryBuild, "0");
         if (std::strncmp(factoryBuild, "1", 1) == 0) {
@@ -66,6 +70,7 @@ bool LogdStub::isFactoryBuild() {
 bool LogdStub::isSlogLimitEnable(log_id_t log_id, int prio) {
+        ATRACE_CALL();
         bool ret = true;
         if (load_enable && !isFactoryBuild()) {
             ILogdStub* Istub = GetImplInstance();

相關文章