From a4bd476152cdd744a03ff80eca97f3a9ff900495 Mon Sep 17 00:00:00 2001 From: wenlong12 Date: Wed, 27 Dec 2023 11:23:21 +0800 Subject: [PATCH] =?UTF-8?q?Hilog=E8=BD=BB=E9=87=8F=E5=8C=96=20Signed-off-b?= =?UTF-8?q?y:wenlong12=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wenlong12 --- device/base/include/logging.h | 53 ++- device/base/src/common.cpp | 64 ++-- device/base/src/epoll_event_poller.cpp | 26 +- device/base/src/event_notifier.cpp | 6 +- device/base/src/schedule_task_manager.cpp | 6 +- device/base/test/unittest/common_test.cpp | 8 +- .../test/unittest/epoll_event_poller_test.cpp | 20 +- .../test/unittest/hiprofiler_cmd_test.cpp | 22 +- device/plugins/api/src/buffer_writer.cpp | 8 +- device/plugins/api/src/command_poller.cpp | 32 +- device/plugins/api/src/main.cpp | 12 +- device/plugins/api/src/plugin_manager.cpp | 99 +++--- device/plugins/api/src/plugin_module.cpp | 22 +- device/plugins/api/src/plugin_watcher.cpp | 24 +- .../api/test/unittest/buffer_write_test.cpp | 8 +- .../plugins/arkts_plugin/src/arkts_plugin.cpp | 73 ++-- .../test/unittest/arkts_plugin_unittest.cpp | 2 +- .../bytrace_plugin/src/bytrace_module.cpp | 6 +- .../cpu_plugin/src/cpu_data_plugin.cpp | 26 +- device/plugins/cpu_plugin/src/test_main.cpp | 2 +- .../diskio_plugin/src/diskio_data_plugin.cpp | 18 +- .../ftrace_plugin/include/sub_event_parser.h | 6 +- .../plugins/ftrace_plugin/src/file_utils.cpp | 2 +- .../ftrace_plugin/src/flow_controller.cpp | 69 ++-- .../ftrace_plugin/src/ftrace_data_reader.cpp | 2 +- .../ftrace_plugin/src/ftrace_fs_ops.cpp | 6 +- .../ftrace_plugin/src/ftrace_module.cpp | 16 +- .../ftrace_plugin/src/ftrace_parser.cpp | 26 +- .../src/kernel_symbols_parser.cpp | 4 +- .../ftrace_plugin/src/paged_mem_pool.cpp | 6 +- .../src/printk_formats_parser.cpp | 4 +- .../ftrace_plugin/src/process_utils.cpp | 26 +- .../ftrace_plugin/src/result_transporter.cpp | 10 +- .../plugins/ftrace_plugin/src/trace_ops.cpp | 8 +- .../unittest/printk_formats_parser_test.cpp | 2 +- .../ftrace_binder_event_formatter.cpp | 67 ++-- .../ftrace_block_event_formatter.cpp | 48 ++- .../ftrace_cgroup_event_formatter.cpp | 34 +- .../ftrace_clk_event_formatter.cpp | 34 +- .../ftrace_compaction_event_formatter.cpp | 4 +- .../ftrace_cpuhp_event_formatter.cpp | 8 +- .../ftrace_dma_fence_event_formatter.cpp | 17 +- .../ftrace_ext4_event_formatter.cpp | 322 +++++++++--------- .../ftrace_f2fs_event_formatter.cpp | 10 +- .../ftrace_filelock_event_formatter.cpp | 18 +- .../ftrace_filemap_event_formatter.cpp | 8 +- .../ftrace_ftrace_event_formatter.cpp | 24 +- .../ftrace_gpio_event_formatter.cpp | 4 +- .../ftrace_gpu_mem_event_formatter.cpp | 2 +- .../ftrace_i2c_event_formatter.cpp | 8 +- .../ftrace_ipi_event_formatter.cpp | 6 +- .../ftrace_irq_event_formatter.cpp | 10 +- .../ftrace_kmem_event_formatter.cpp | 36 +- .../ftrace_mmc_event_formatter.cpp | 4 +- .../ftrace_net_event_formatter.cpp | 28 +- .../ftrace_oom_event_formatter.cpp | 2 +- .../ftrace_pagemap_event_formatter.cpp | 4 +- .../ftrace_power_event_formatter.cpp | 70 ++-- .../ftrace_printk_event_formatter.cpp | 2 +- .../ftrace_raw_syscalls_event_formatter.cpp | 4 +- .../ftrace_rcu_event_formatter.cpp | 2 +- .../ftrace_regulator_event_formatter.cpp | 40 +-- .../ftrace_sched_event_formatter.cpp | 72 ++-- .../ftrace_signal_event_formatter.cpp | 4 +- .../ftrace_sunrpc_event_formatter.cpp | 58 ++-- .../ftrace_task_event_formatter.cpp | 4 +- .../ftrace_timer_event_formatter.cpp | 30 +- .../ftrace_v4l2_event_formatter.cpp | 14 +- .../ftrace_vmscan_event_formatter.cpp | 40 +-- .../ftrace_workqueue_event_formatter.cpp | 16 +- .../ftrace_writeback_event_formatter.cpp | 96 +++--- .../default/ftrace_cpp_generator.py | 2 +- .../gpu_plugin/src/gpu_data_plugin.cpp | 8 +- .../hidump_plugin/src/hidump_plugin.cpp | 26 +- .../test/unittest/hidump_plugin_unittest.cpp | 8 +- .../hiebpf_plugin/src/hiebpf_module.cpp | 14 +- .../plugins/hilog_plugin/src/file_cache.cpp | 2 +- .../plugins/hilog_plugin/src/hilog_plugin.cpp | 33 +- .../test/unittest/hilog_plugin_unittest.cpp | 14 +- .../hiperf_plugin/src/hiperf_module.cpp | 6 +- .../src/hisysevent_plugin.cpp | 33 +- .../unittest/hisysevent_plugin_unittest.cpp | 4 +- .../memory_plugin/src/memory_data_plugin.cpp | 52 +-- .../plugins/memory_plugin/src/test_main.cpp | 4 +- .../unittest/memory_data_plugin_unittest.cpp | 10 +- .../native_daemon/include/debug_logger.h | 2 +- .../native_daemon/include/hiperf_hilog.h | 53 --- ...tive_memory_profiler_sa_client_manager.cpp | 12 +- .../src/native_memory_profiler_sa_config.cpp | 10 +- ...ive_memory_profiler_sa_death_recipient.cpp | 2 +- .../src/native_memory_profiler_sa_proxy.cpp | 18 +- .../src/native_memory_profiler_sa_service.cpp | 46 +-- .../src/native_memory_profiler_sa_stub.cpp | 4 +- .../util/include/define_macro.h | 28 +- .../native_daemon/src/debug_logger.cpp | 7 +- .../native_daemon/src/hook_manager.cpp | 83 ++--- .../native_daemon/src/hook_service.cpp | 10 +- .../native_daemon/src/hook_standalone.cpp | 4 +- .../native_daemon/src/stack_data_repeater.cpp | 5 +- .../native_daemon/src/stack_preprocess.cpp | 59 ++-- .../native_daemon/src/virtual_runtime.cpp | 10 +- .../native_daemon/src/virtual_thread.cpp | 4 +- .../common/native/hook_manager_test.cpp | 4 +- .../plugins/native_hook/src/hook_client.cpp | 20 +- .../native_hook/src/hook_socket_client.cpp | 6 +- .../plugins/native_hook/src/stack_writer.cpp | 8 +- .../test/unittest/check_hook_data_test.cpp | 18 +- .../test/unittest/hook_socket_client_test.cpp | 2 +- .../test/unittest/stack_writer_test.cpp | 4 +- .../network_plugin/src/network_plugin.cpp | 10 +- .../src/process_data_plugin.cpp | 28 +- .../sample_plugin/src/sample_plugin.cpp | 8 +- .../stream_plugin/src/stream_plugin.cpp | 6 +- .../xpower_plugin/src/xpower_plugin.cpp | 38 +-- device/services/ipc/src/client_connection.cpp | 4 +- device/services/ipc/src/client_map.cpp | 2 +- device/services/ipc/src/socket_context.cpp | 22 +- .../services/ipc/src/unix_socket_client.cpp | 8 +- .../services/ipc/src/unix_socket_server.cpp | 28 +- .../plugin_service/src/plugin_service.cpp | 47 +-- .../src/plugin_service_impl.cpp | 12 +- .../plugin_service/src/plugin_session.cpp | 29 +- .../src/plugin_session_manager.cpp | 8 +- device/services/profiler_service/src/main.cpp | 2 +- .../src/profiler_capability_manager.cpp | 7 +- .../src/profiler_data_repeater.cpp | 3 +- .../profiler_service/src/profiler_service.cpp | 81 ++--- .../src/trace_file_writer.cpp | 34 +- .../test/unittest/plugin_service_stubs.cpp | 40 +-- .../unittest/profiler_data_repeater_test.cpp | 4 +- .../profiler_service_performance_test.cpp | 20 +- .../test/unittest/trace_file_reader_test.cpp | 12 +- .../test/unittest/trace_file_writer_test.cpp | 2 +- .../src/share_memory_allocator.cpp | 4 +- .../shared_memory/src/share_memory_block.cpp | 24 +- .../test/unittest/plugin_module_api_test.cpp | 4 +- 136 files changed, 1506 insertions(+), 1490 deletions(-) diff --git a/device/base/include/logging.h b/device/base/include/logging.h index ea9431ded..7ed209455 100644 --- a/device/base/include/logging.h +++ b/device/base/include/logging.h @@ -155,38 +155,34 @@ static inline std::string StringFormat(const char* fmt, ...) } } // logging -#ifdef HILOG_DEBUG -#undef HILOG_DEBUG -#endif - -#ifdef HILOG_INFO -#undef HILOG_INFO -#endif - -#ifdef HILOG_WARN -#undef HILOG_WARN -#endif - -#ifdef HILOG_ERROR -#undef HILOG_ERROR -#endif - #ifdef HILOG_PRINT #undef HILOG_PRINT #endif #ifdef HAVE_HILOG -#define HILOG_PRINT(type, level, fmt, ...) \ - HiLogPrint(type, level, LOG_DOMAIN, LOG_TAG, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_DEBUG(type, fmt, ...) \ + HILOG_DEBUG(type, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_INFO(type, fmt, ...) \ + HILOG_INFO(type, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_WARN(type, fmt, ...) \ + HILOG_WARN(type, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_ERROR(type, fmt, ...) \ + HILOG_ERROR(type, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) #else -#define HILOG_PRINT(type, level, fmt, ...) \ +#define HILOG_PRINT_DEBUG(type, level, fmt, ...) \ + HiLogPrint(type, level, LOG_DOMAIN, LOG_TAG, "%s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_INFO(type, level, fmt, ...) \ + HiLogPrint(type, level, LOG_DOMAIN, LOG_TAG, "%s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_WARN(type, level, fmt, ...) \ + HiLogPrint(type, level, LOG_DOMAIN, LOG_TAG, "%s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) +#define HILOG_PRINT_ERROR(type, level, fmt, ...) \ HiLogPrint(type, level, LOG_DOMAIN, LOG_TAG, "%s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()) #endif -#define HILOG_DEBUG(type, fmt, ...) HILOG_PRINT(type, LOG_DEBUG, fmt, ##__VA_ARGS__) -#define HILOG_INFO(type, fmt, ...) HILOG_PRINT(type, LOG_INFO, fmt, ##__VA_ARGS__) -#define HILOG_WARN(type, fmt, ...) HILOG_PRINT(type, LOG_WARN, fmt, ##__VA_ARGS__) -#define HILOG_ERROR(type, fmt, ...) HILOG_PRINT(type, LOG_ERROR, fmt, ##__VA_ARGS__) +#define PROFILER_LOG_DEBUG(type, fmt, ...) HILOG_PRINT_DEBUG(type, fmt, ##__VA_ARGS__) +#define PROFILER_LOG_INFO(type, fmt, ...) HILOG_PRINT_INFO(type, fmt, ##__VA_ARGS__) +#define PROFILER_LOG_WARN(type, fmt, ...) HILOG_PRINT_WARN(type, fmt, ##__VA_ARGS__) +#define PROFILER_LOG_ERROR(type, fmt, ...) HILOG_PRINT_ERROR(type, fmt, ##__VA_ARGS__) #endif // NDEBUG #define STD_PTR(K, T) std::K##_ptr @@ -196,8 +192,9 @@ static inline std::string StringFormat(const char* fmt, ...) #define CHECK_NOTNULL(ptr, retval, fmt, ...) \ do { \ if (ptr == nullptr) { \ - HILOG_WARN(LOG_CORE, "CHECK_NOTNULL(%s) in %s:%d FAILED, " fmt, #ptr, __func__, \ - __LINE__, ##__VA_ARGS__); \ + std::string str = std::string("CHECK_NOTNULL(") + logging::StringFormat(fmt, ##__VA_ARGS__) + \ + ") in " + __func__ + ":" + std::to_string(__LINE__) + "FAILED"; \ + HILOG_WARN(LOG_CORE, "%{public}s", str.c_str()); \ return retval; \ } \ } while (0) @@ -206,7 +203,9 @@ static inline std::string StringFormat(const char* fmt, ...) #define CHECK_TRUE(expr, retval, fmt, ...) \ do { \ if (!(expr)) { \ - HILOG_WARN(LOG_CORE, "CHECK_TRUE(%s) in %s:%d FAILED, " fmt, #expr, __func__, __LINE__, ##__VA_ARGS__); \ + std::string str = std::string("CHECK_TRUE(") + logging::StringFormat(fmt, ##__VA_ARGS__) + \ + ") in " + __func__ + ":" + std::to_string(__LINE__) + "FAILED"; \ + HILOG_WARN(LOG_CORE, "%{public}s", str.c_str()); \ return retval; \ } \ } while (0) @@ -222,7 +221,7 @@ static inline std::string StringFormat(const char* fmt, ...) #define RETURN_IF(expr, retval, fmt, ...) \ do { \ if ((expr)) { \ - HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__); \ + HILOG_WARN(LOG_CORE, "%{public}s", logging::StringFormat(fmt, ##__VA_ARGS__).c_str()); \ return retval; \ } \ } while (0) diff --git a/device/base/src/common.cpp b/device/base/src/common.cpp index d5b654873..560dee041 100644 --- a/device/base/src/common.cpp +++ b/device/base/src/common.cpp @@ -84,26 +84,26 @@ bool IsProcessRunning(int& lockFileFd) const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName.c_str(), errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName.c_str(), errno, buf); return false; } int flags = fcntl(fd, F_GETFD); if (flags == -1) { close(fd); - HILOG_ERROR(LOG_CORE, "%s: get fd flags failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: get fd flags failed!", __func__); return false; } flags |= FD_CLOEXEC; if (fcntl(fd, F_SETFD, flags) == -1) { close(fd); - HILOG_ERROR(LOG_CORE, "%s: set fd_cloexec failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: set fd_cloexec failed!", __func__); return false; } if (flock(fd, LOCK_EX | LOCK_NB) == -1) { // 进程正在运行,加锁失败 close(fd); printf("%s is running, please don't start it again.\n", processName.c_str()); - HILOG_ERROR(LOG_CORE, "%s is running, please don't start it again.", processName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "%s is running, please don't start it again.", processName.c_str()); return true; } std::string pidStr = std::to_string(getpid()); @@ -129,12 +129,12 @@ bool IsProcessExist(const std::string& processName, int& pid) char filePath[FILE_PATH_SIZE] = {0}; int len = snprintf_s(filePath, FILE_PATH_SIZE, FILE_PATH_SIZE - 1, "/proc/%s/cmdline", ptr->d_name); if (len < 0) { - HILOG_WARN(LOG_CORE, "maybe, the contents of cmdline had be cut off"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of cmdline had be cut off"); continue; } FILE* fp = fopen(filePath, "r"); if (fp == nullptr) { - HILOG_DEBUG(LOG_CORE, "open file failed! %s", filePath); + PROFILER_LOG_DEBUG(LOG_CORE, "open file failed! %s", filePath); continue; } char buf[BUFFER_SIZE] = {0}; @@ -180,7 +180,7 @@ int StartProcess(const std::string& processBin, std::vector& argv) int retval = execvp(processBin.c_str(), argv.data()); if (retval == -1 && errno == EXECVP_ERRNO) { printf("warning: %s does not exist!\n", processBin.c_str()); - HILOG_WARN(LOG_CORE, "warning: %s does not exist!", processBin.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "warning: %s does not exist!", processBin.c_str()); } _exit(EXIT_FAILURE); } @@ -214,7 +214,7 @@ void PrintMallinfoLog(const std::string& mallInfoPrefix, const struct mallinfo2& ", fsmblks = " + std::to_string(mi.fsmblks) + ", uordblks = " + std::to_string(mi.uordblks); mallinfoLog += ", fordblks = " + std::to_string(mi.fordblks) + ", keepcost = " + std::to_string(mi.keepcost); - HILOG_INFO(LOG_CORE, "%s", mallinfoLog.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s", mallinfoLog.c_str()); #endif // HOOK_ENABLE } @@ -239,9 +239,9 @@ inline int CustomFdFclose(FILE** fp) FILE* CustomPopen(const std::vector& command, const char* type, int fds[], volatile pid_t& childPid, bool needUnblock) { - HILOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); if (command.empty() || type == nullptr) { - HILOG_ERROR(LOG_CORE, "%s: param invalid", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: param invalid", __func__); return nullptr; } @@ -280,7 +280,7 @@ FILE* CustomPopen(const std::vector& command, const char* type, int setpgid(pid, pid); // exe path = argv[0]; exe name = argv[1] if (execve(argv[0], &argv[1], envp) == -1) { - HILOG_ERROR(LOG_CORE, "execve failed {%s:%s}", __func__, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "execve failed {%s:%s}", __func__, strerror(errno)); exit(EXIT_FAILURE); } } @@ -300,28 +300,28 @@ FILE* CustomPopen(const std::vector& command, const char* type, int // Make sure the parent pipe reads and writes exist;CustomPUnblock will use. childPid = pid; if (strncmp(type, "r", strlen(type)) == 0) { - HILOG_DEBUG(LOG_CORE, "END %s fds[READ]: success!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "END %s fds[READ]: success!", __func__); return fdopen(fds[READ], "r"); } - HILOG_DEBUG(LOG_CORE, "END %s fds[WRITE]: success!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "END %s fds[WRITE]: success!", __func__); return fdopen(fds[WRITE], "w"); } int CustomPclose(FILE* fp, int fds[], volatile pid_t& childPid, bool needUnblock) { - HILOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); CHECK_NOTNULL(fp, -1, "NOTE %s: fp is null", __func__); int stat = 0; if (needUnblock) { - HILOG_DEBUG(LOG_CORE, "NOTE Kill Endless Loop Child %d.", childPid); + PROFILER_LOG_DEBUG(LOG_CORE, "NOTE Kill Endless Loop Child %d.", childPid); kill(childPid, SIGKILL); } while (waitpid(childPid, &stat, 0) == -1) { - HILOG_ERROR(LOG_CORE, "%s: %s.", __func__, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "%s: %s.", __func__, strerror(errno)); if (errno == EINTR) { continue; } @@ -336,20 +336,20 @@ int CustomPclose(FILE* fp, int fds[], volatile pid_t& childPid, bool needUnblock fds[WRITE] = -1; CHECK_TRUE(CustomFdClose(fds[READ]) == 0, -1, "CustomFdClose failed!"); } else { - HILOG_INFO(LOG_CORE, "%s: Can't find fp in fds[READ/WRITE].", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s: Can't find fp in fds[READ/WRITE].", __func__); } } CHECK_TRUE(CustomFdFclose(&fp) == 0, -1, "CustomFdFclose failed!"); - HILOG_DEBUG(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "END %s: success!", __func__); return stat; } // IF pipe fds is block, before release other threads, you need call CustomPUnblock int CustomPUnblock(int fds[]) { - HILOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "BEGN %s: ready!", __func__); CHECK_TRUE(fds[READ] != -1 && fds[WRITE] != -1, -1, "END fds[READ/WRITE]=-1"); @@ -357,12 +357,12 @@ int CustomPUnblock(int fds[]) CHECK_TRUE(stat != -1, -1, "END fcntl(F_GETFL) failed!"); if (!(stat & O_NONBLOCK)) { - HILOG_DEBUG(LOG_CORE, "NOTE %s: ready!Unblock r_fd and close all", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "NOTE %s: ready!Unblock r_fd and close all", __func__); const char* eof = "\n\0"; write(fds[WRITE], eof, strlen(eof) + 1); fcntl(fds[READ], F_SETFL, O_NONBLOCK); } - HILOG_DEBUG(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "END %s: success!", __func__); return 0; } @@ -381,14 +381,14 @@ int GetServicePort() istr >> minPort >> maxPort; const int offset = 3168; // To be compatible with previously used port 50051; int port = (minPort + maxPort) / 2 + offset; - HILOG_DEBUG(LOG_CORE, "Service port is: %d", port); + PROFILER_LOG_DEBUG(LOG_CORE, "Service port is: %d", port); return port; } void SplitString(const std::string& str, const std::string &sep, std::vector& ret) { if (str.empty()) { - HILOG_ERROR(LOG_CORE, "The string splited is empty!"); + PROFILER_LOG_ERROR(LOG_CORE, "The string splited is empty!"); return; } std::string::size_type beginPos = str.find_first_not_of(sep); @@ -416,7 +416,7 @@ bool CheckApplicationPermission(int pid, const std::string& processName) if (pid > 0) { std::string filePath = "/proc/" + std::to_string(pid) + "/cmdline"; if (!LoadStringFromFile(filePath, bundleName)) { - HILOG_ERROR(LOG_CORE, "Get process name by pid failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "Get process name by pid failed!"); return false; } bundleName.resize(strlen(bundleName.c_str())); @@ -525,16 +525,16 @@ bool GetCurrentUserId(int32_t& userId) std::vector activeIds; int32_t ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(activeIds); if (ret != 0) { - HILOG_ERROR(LOG_CORE, "QueryActiveOsAccountIds failed ret:%d", ret); + PROFILER_LOG_ERROR(LOG_CORE, "QueryActiveOsAccountIds failed ret:%d", ret); return false; } if (activeIds.empty()) { - HILOG_ERROR(LOG_CORE, "QueryActiveOsAccountIds activeIds empty"); + PROFILER_LOG_ERROR(LOG_CORE, "QueryActiveOsAccountIds activeIds empty"); return false; } userId = activeIds[0]; - HILOG_INFO(LOG_CORE, "QueryActiveOsAccountIds userId[0]:%d", userId); + PROFILER_LOG_INFO(LOG_CORE, "QueryActiveOsAccountIds userId[0]:%d", userId); return true; } @@ -542,26 +542,26 @@ int32_t GetPackageUid(const std::string& name) { int32_t userId = 0; if (!GetCurrentUserId(userId)) { - HILOG_ERROR(LOG_CORE, "Failed to get current user id"); + PROFILER_LOG_ERROR(LOG_CORE, "Failed to get current user id"); return EC_INVALID_VALUE; } auto manager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (manager == nullptr) { - HILOG_ERROR(LOG_CORE, "systemAbilityManager is nullptr"); + PROFILER_LOG_ERROR(LOG_CORE, "systemAbilityManager is nullptr"); return EC_INVALID_VALUE; } sptr remoteObject = manager->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); if (remoteObject == nullptr) { - HILOG_ERROR(LOG_CORE, "failed to get service id"); + PROFILER_LOG_ERROR(LOG_CORE, "failed to get service id"); return EC_INVALID_VALUE; } sptr mgr = iface_cast(remoteObject); if (mgr == nullptr) { - HILOG_ERROR(LOG_CORE, "mgr is nullptr"); + PROFILER_LOG_ERROR(LOG_CORE, "mgr is nullptr"); return EC_INVALID_VALUE; } int32_t uid = mgr->GetUidByBundleName(name, userId); - HILOG_INFO(LOG_CORE, "pkgname is: %s, uid is : %d", name.c_str(), uid); + PROFILER_LOG_INFO(LOG_CORE, "pkgname is: %s, uid is : %d", name.c_str(), uid); return uid; } } // namespace COMMON diff --git a/device/base/src/epoll_event_poller.cpp b/device/base/src/epoll_event_poller.cpp index 38c7c3936..b2c55178f 100644 --- a/device/base/src/epoll_event_poller.cpp +++ b/device/base/src/epoll_event_poller.cpp @@ -31,11 +31,11 @@ EpollEventPoller::EpollEventPoller(int timeOut) : timeOut_(timeOut), epollFd_(IN EpollEventPoller::~EpollEventPoller() { if (state_ == STARTED) { - HILOG_INFO(LOG_CORE, "need Stop in destructor!"); + PROFILER_LOG_INFO(LOG_CORE, "need Stop in destructor!"); Stop(); } if (state_ == INITIED) { - HILOG_INFO(LOG_CORE, "need Finalize in dtor!"); + PROFILER_LOG_INFO(LOG_CORE, "need Finalize in dtor!"); Finalize(); } } @@ -106,10 +106,10 @@ bool EpollEventPoller::UpdateEvent(int op, const EventContextPtr& ctx) event.data.ptr = ctx.get(); std::string name = EpollOpName(op).c_str(); - HILOG_DEBUG(LOG_CORE, "poll set %s %d %x start!", name.c_str(), ctx->fd, event.events); + PROFILER_LOG_DEBUG(LOG_CORE, "poll set %s %d %x start!", name.c_str(), ctx->fd, event.events); int retval = epoll_ctl(epollFd_, op, ctx->fd, &event); CHECK_TRUE(retval == 0, false, "epoll_ctl %s failed, %d", name.c_str(), errno); - HILOG_DEBUG(LOG_CORE, "poll set %s %d %x done!", name.c_str(), ctx->fd, event.events); + PROFILER_LOG_DEBUG(LOG_CORE, "poll set %s %d %x done!", name.c_str(), ctx->fd, event.events); return true; } @@ -125,7 +125,7 @@ void EpollEventPoller::Run() int retval = TEMP_FAILURE_RETRY(epoll_wait(epollFd_, eventVec.data(), eventVec.size(), timeOut_)); CHECK_TRUE(retval >= 0, NO_RETVAL, "epoll_wait failed, %d!", errno); if (retval == 0) { - HILOG_INFO(LOG_CORE, "epoll_wait %dms timeout!", timeOut_); + PROFILER_LOG_INFO(LOG_CORE, "epoll_wait %dms timeout!", timeOut_); continue; } for (int i = 0; i < retval; i++) { @@ -154,20 +154,20 @@ void EpollEventPoller::OnNotify() { uint64_t value = 0; CHECK_TRUE(read(eventFd_, &value, sizeof(value)) == sizeof(value), NO_RETVAL, "read eventfd FAILED!"); - HILOG_DEBUG(LOG_CORE, "OnNotify %llu done!", static_cast(value)); + PROFILER_LOG_DEBUG(LOG_CORE, "OnNotify %llu done!", static_cast(value)); } bool EpollEventPoller::Notify(uint64_t value) { auto nbytes = write(eventFd_, &value, sizeof(value)); CHECK_TRUE(static_cast(nbytes) == sizeof(value), false, "write eventfd FAILED!"); - HILOG_DEBUG(LOG_CORE, "Notify %llu done!", static_cast(value)); + PROFILER_LOG_DEBUG(LOG_CORE, "Notify %llu done!", static_cast(value)); return true; } bool EpollEventPoller::Init() { - HILOG_INFO(LOG_CORE, "Init %d", state_.load()); + PROFILER_LOG_INFO(LOG_CORE, "Init %d", state_.load()); CHECK_TRUE(state_ == INITIAL, false, "Init FAIL %d", state_.load()); int epollFd = epoll_create1(EPOLL_CLOEXEC); @@ -187,7 +187,7 @@ bool EpollEventPoller::Init() epollFd_ = epollFd; eventFd_ = eventFd; AddContextLocked(eventFdCtx); - HILOG_INFO(LOG_CORE, "EpollEventPoller::Init %d done!", state_.load()); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPoller::Init %d done!", state_.load()); state_ = INITIED; return true; } @@ -195,11 +195,11 @@ bool EpollEventPoller::Init() bool EpollEventPoller::Finalize() { if (state_ == STARTED) { - HILOG_INFO(LOG_CORE, "need Stop in Finalize!"); + PROFILER_LOG_INFO(LOG_CORE, "need Stop in Finalize!"); Stop(); } - HILOG_INFO(LOG_CORE, "Finalize %d", state_.load()); + PROFILER_LOG_INFO(LOG_CORE, "Finalize %d", state_.load()); CHECK_TRUE(state_ == INITIED, false, "Finalize FAIL %d", state_.load()); std::unique_lock lock(mutex_); @@ -208,7 +208,7 @@ bool EpollEventPoller::Finalize() contextVec.push_back(ctxPair.second); } for (auto ctxPtr : contextVec) { - HILOG_DEBUG(LOG_CORE, "remove context for %d", ctxPtr->fd); + PROFILER_LOG_DEBUG(LOG_CORE, "remove context for %d", ctxPtr->fd); RemoveContextLocked(ctxPtr); } @@ -225,7 +225,7 @@ bool EpollEventPoller::Finalize() bool EpollEventPoller::Start() { - HILOG_INFO(LOG_CORE, "%s %d", __func__, state_.load()); + PROFILER_LOG_INFO(LOG_CORE, "%s %d", __func__, state_.load()); CHECK_TRUE(state_ == INITIED, false, "Start FAIL %d", state_.load()); running_ = true; diff --git a/device/base/src/event_notifier.cpp b/device/base/src/event_notifier.cpp index e1f610da8..b741f5b0d 100644 --- a/device/base/src/event_notifier.cpp +++ b/device/base/src/event_notifier.cpp @@ -46,19 +46,19 @@ EventNotifier::EventNotifier(unsigned int initValue, unsigned int mask) : fd_(-1 } fd_ = eventfd(initValue, flags_); CHECK_TRUE(fd_ >= 0, NO_RETVAL, "create eventfd FAILED, %d", errno); - HILOG_DEBUG(LOG_CORE, "EventNotifier create eventfd %d done!", fd_); + PROFILER_LOG_DEBUG(LOG_CORE, "EventNotifier create eventfd %d done!", fd_); } EventNotifier::EventNotifier(int fd) : fd_(fd), flags_(0) { int flags = fcntl(fd_, F_GETFL); CHECK_TRUE(flags >= 0, NO_RETVAL, "get flags of fd %d FAILED, %d", fd, errno); - HILOG_DEBUG(LOG_CORE, "EventNotifier bind eventfd %d done!", fd_); + PROFILER_LOG_DEBUG(LOG_CORE, "EventNotifier bind eventfd %d done!", fd_); } EventNotifier::~EventNotifier() { - HILOG_DEBUG(LOG_CORE, "EventNotifier close eventfd %d", fd_); + PROFILER_LOG_DEBUG(LOG_CORE, "EventNotifier close eventfd %d", fd_); close(fd_); } diff --git a/device/base/src/schedule_task_manager.cpp b/device/base/src/schedule_task_manager.cpp index cee73b272..a54453d40 100755 --- a/device/base/src/schedule_task_manager.cpp +++ b/device/base/src/schedule_task_manager.cpp @@ -63,7 +63,7 @@ int32_t ScheduleTaskManager::ScheduleTask(const std::function& callb { int32_t timerFd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); if (timerFd == -1) { - HILOG_ERROR(LOG_CORE, "ScheduleTaskManager timerfd create failed"); + PROFILER_LOG_ERROR(LOG_CORE, "ScheduleTaskManager timerfd create failed"); return -1; } @@ -71,7 +71,7 @@ int32_t ScheduleTaskManager::ScheduleTask(const std::function& callb struct itimerspec time; if (once) { if (interval == 0) { - HILOG_ERROR(LOG_CORE, "the interval parameters of a single execution cannot be 0"); + PROFILER_LOG_ERROR(LOG_CORE, "the interval parameters of a single execution cannot be 0"); return -1; } time.it_value.tv_sec = interval / TIME_BASE; @@ -89,7 +89,7 @@ int32_t ScheduleTaskManager::ScheduleTask(const std::function& callb int32_t ret = timerfd_settime(timerFd, 0, &time, NULL); if (ret == -1) { - HILOG_ERROR(LOG_CORE, "ScheduleTaskManager timerfd settime failed"); + PROFILER_LOG_ERROR(LOG_CORE, "ScheduleTaskManager timerfd settime failed"); return -1; } diff --git a/device/base/test/unittest/common_test.cpp b/device/base/test/unittest/common_test.cpp index 3fe7fc8ae..62371402a 100644 --- a/device/base/test/unittest/common_test.cpp +++ b/device/base/test/unittest/common_test.cpp @@ -34,21 +34,21 @@ protected: FILE* file = fopen(filePath.c_str(), "w"); if (file == nullptr) { std::string errorMsg = GetErrorMsg(); - HILOG_ERROR(LOG_CORE, "WriteFile: fopen() fail, %s, %s", filePath.c_str(), errorMsg.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "WriteFile: fopen() fail, %s, %s", filePath.c_str(), errorMsg.c_str()); return false; } size_t len = fwrite(const_cast(fileContent.c_str()), 1, fileContent.length(), file); if (len < 0) { std::string errorMsg = GetErrorMsg(); - HILOG_ERROR(LOG_CORE, "WriteFile: fwrite() fail, %s", errorMsg.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "WriteFile: fwrite() fail, %s", errorMsg.c_str()); (void)fclose(file); return false; } if (fflush(file) == EOF) { std::string errorMsg = GetErrorMsg(); - HILOG_ERROR(LOG_CORE, "WriteFile: fflush() error = %s", errorMsg.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "WriteFile: fflush() error = %s", errorMsg.c_str()); (void)fclose(file); return false; } @@ -56,7 +56,7 @@ protected: fsync(fileno(file)); if (fclose(file) != 0) { std::string errorMsg = GetErrorMsg(); - HILOG_ERROR(LOG_CORE, "CreateConfigFile: fclose() error = %s", errorMsg.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "CreateConfigFile: fclose() error = %s", errorMsg.c_str()); return false; } return true; diff --git a/device/base/test/unittest/epoll_event_poller_test.cpp b/device/base/test/unittest/epoll_event_poller_test.cpp index 42782257b..15ffbc493 100644 --- a/device/base/test/unittest/epoll_event_poller_test.cpp +++ b/device/base/test/unittest/epoll_event_poller_test.cpp @@ -66,7 +66,7 @@ HWTEST_F(EpollEventPollerTest, InitFinalize, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitFinalize start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitFinalize start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Finalize()); } @@ -79,7 +79,7 @@ HWTEST_F(EpollEventPollerTest, InitFinalize, TestSize.Level1) HWTEST_F(EpollEventPollerTest, InitOnly, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitOnly start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitOnly start!"); EXPECT_TRUE(eventPoller->Init()); } @@ -92,7 +92,7 @@ HWTEST_F(EpollEventPollerTest, Init2Finalize1, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.Init2Finalize1 start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.Init2Finalize1 start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_FALSE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Finalize()); @@ -107,7 +107,7 @@ HWTEST_F(EpollEventPollerTest, InitStartStopFinalize, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartStopFinalize start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartStopFinalize start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Start()); EXPECT_TRUE(eventPoller->Stop()); @@ -123,7 +123,7 @@ HWTEST_F(EpollEventPollerTest, InitStartStop, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartStop start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartStop start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Start()); EXPECT_TRUE(eventPoller->Stop()); @@ -138,7 +138,7 @@ HWTEST_F(EpollEventPollerTest, InitStart, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStart start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStart start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Start()); } @@ -152,7 +152,7 @@ HWTEST_F(EpollEventPollerTest, InitStartAddFd, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Start()); @@ -160,7 +160,7 @@ HWTEST_F(EpollEventPollerTest, InitStartAddFd, TestSize.Level1) uint64_t readValue = 0; auto onReadable = [&readValue, &eventFd]() { read(eventFd, &readValue, sizeof(readValue)); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd read %" PRIu64, readValue); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd read %" PRIu64, readValue); }; EXPECT_TRUE(eventPoller->AddFileDescriptor(eventFd, onReadable)); @@ -182,7 +182,7 @@ HWTEST_F(EpollEventPollerTest, InitStartAddEventFd, TestSize.Level1) { ASSERT_NE(eventPoller, nullptr); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd start!"); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd start!"); EXPECT_TRUE(eventPoller->Init()); EXPECT_TRUE(eventPoller->Start()); @@ -190,7 +190,7 @@ HWTEST_F(EpollEventPollerTest, InitStartAddEventFd, TestSize.Level1) uint64_t readValue = 0; auto onReadable = [&readValue, ¬ifier]() { readValue = notifier->Take(); - HILOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd read %" PRIu64, readValue); + PROFILER_LOG_INFO(LOG_CORE, "EpollEventPollerTest.InitStartAddFd read %" PRIu64, readValue); }; EXPECT_TRUE(eventPoller->AddFileDescriptor(notifier->GetFd(), onReadable)); diff --git a/device/cmds/test/unittest/hiprofiler_cmd_test.cpp b/device/cmds/test/unittest/hiprofiler_cmd_test.cpp index 684cb8df9..c9e836957 100644 --- a/device/cmds/test/unittest/hiprofiler_cmd_test.cpp +++ b/device/cmds/test/unittest/hiprofiler_cmd_test.cpp @@ -106,7 +106,7 @@ public: size_t nbytes = 0; if ((strlen(path.c_str()) >= PATH_MAX) || (realpath(path.c_str(), realPath) == nullptr)) { - HILOG_ERROR(LOG_CORE, "%s:path is invalid: %s, errno=%d", __func__, path.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:path is invalid: %s, errno=%d", __func__, path.c_str(), errno); return ""; } FILE* file = fopen(realPath, "rb"); @@ -131,7 +131,7 @@ public: result.push_back(HEX_CHARS[LHB(out[i])]); } - HILOG_DEBUG(LOG_CORE, "%s:%s-(%s)", __func__, path.c_str(), result.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:%s-(%s)", __func__, path.c_str(), result.c_str()); return result; } @@ -173,7 +173,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateConfigFile: fopen() error = %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateConfigFile: fopen() error = %s", buf); return; } @@ -182,9 +182,9 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateConfigFile: fwrite() error = %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateConfigFile: fwrite() error = %s", buf); if (fclose(writeFp) != 0) { - HILOG_ERROR(LOG_CORE, "fclose() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fclose() error"); } return; } @@ -194,9 +194,9 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateConfigFile: fflush() error = %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateConfigFile: fflush() error = %s", buf); if (fclose(writeFp) != 0) { - HILOG_ERROR(LOG_CORE, "fclose() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fclose() error"); } return; } @@ -207,7 +207,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateConfigFile: fclose() error = %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateConfigFile: fclose() error = %s", buf); return; } } @@ -467,17 +467,17 @@ public: { int pid = -1; std::string findpid = "pidof " + processName; - HILOG_INFO(LOG_CORE, "find pid command : %s", findpid.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "find pid command : %s", findpid.c_str()); std::unique_ptr pipe(popen(findpid.c_str(), "r"), pclose); char line[LINE_SIZE]; do { if (fgets(line, sizeof(line), pipe.get()) == nullptr) { - HILOG_INFO(LOG_CORE, "not find processName : %s", processName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "not find processName : %s", processName.c_str()); return; } else if (strlen(line) > 0 && isdigit(static_cast(line[0]))) { pid = atoi(line); - HILOG_INFO(LOG_CORE, "find processName : %s, pid: %d", processName.c_str(), pid); + PROFILER_LOG_INFO(LOG_CORE, "find processName : %s, pid: %d", processName.c_str(), pid); break; } } while (1); diff --git a/device/plugins/api/src/buffer_writer.cpp b/device/plugins/api/src/buffer_writer.cpp index 26921c0f1..41ed5eaf4 100644 --- a/device/plugins/api/src/buffer_writer.cpp +++ b/device/plugins/api/src/buffer_writer.cpp @@ -35,10 +35,10 @@ BufferWriter::BufferWriter(std::string name, uint32_t pluginId) : pluginName_(name), pluginVersion_(version) { - HILOG_INFO(LOG_CORE, "%s:%s %d [%d] [%d]", __func__, name.c_str(), size, smbFd, eventFd); + PROFILER_LOG_INFO(LOG_CORE, "%s:%s %d [%d] [%d]", __func__, name.c_str(), size, smbFd, eventFd); shareMemoryBlock_ = ShareMemoryAllocator::GetInstance().CreateMemoryBlockRemote(name, size, smbFd); if (shareMemoryBlock_ == nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:create shareMemoryBlock_ failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:create shareMemoryBlock_ failed!", __func__); } eventNotifier_ = EventNotifier::CreateWithFd(eventFd); pluginId_ = pluginId; @@ -50,14 +50,14 @@ BufferWriter::BufferWriter(std::string name, BufferWriter::~BufferWriter() { - HILOG_DEBUG(LOG_CORE, "%s:destroy eventfd = %d!", __func__, eventNotifier_ ? eventNotifier_->GetFd() : -1); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:destroy eventfd = %d!", __func__, eventNotifier_ ? eventNotifier_->GetFd() : -1); eventNotifier_ = nullptr; ShareMemoryAllocator::GetInstance().ReleaseMemoryBlockRemote(pluginName_); } void BufferWriter::Report() const { - HILOG_DEBUG(LOG_CORE, "%s:stats B: %" PRIu64 ", P: %d, W:%" PRIu64 ", F: %d", __func__, + PROFILER_LOG_DEBUG(LOG_CORE, "%s:stats B: %" PRIu64 ", P: %d, W:%" PRIu64 ", F: %d", __func__, bytesCount_.load(), bytesPending_.load(), writeCount_.load(), flushCount_.load()); } diff --git a/device/plugins/api/src/command_poller.cpp b/device/plugins/api/src/command_poller.cpp index bcd586fc6..296224dd4 100644 --- a/device/plugins/api/src/command_poller.cpp +++ b/device/plugins/api/src/command_poller.cpp @@ -40,7 +40,7 @@ bool CommandPoller::OnConnect() bool CommandPoller::OnCreateSessionCmd(const CreateSessionCmd& cmd, SocketContext& context) const { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); CHECK_TRUE(cmd.buffer_sizes().size() != 0 && cmd.plugin_configs().size() != 0, false, "%s:cmd invalid!", __func__); uint32_t bufferSize = cmd.buffer_sizes(0); @@ -56,24 +56,24 @@ bool CommandPoller::OnCreateSessionCmd(const CreateSessionCmd& cmd, SocketContex int smbFd = -1; int eventFd = -1; if (bufferSize != 0) { - HILOG_DEBUG(LOG_CORE, "%s:bufferSize = %d", __func__, bufferSize); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:bufferSize = %d", __func__, bufferSize); smbFd = context.ReceiveFileDiscriptor(); eventFd = context.ReceiveFileDiscriptor(); int flags = fcntl(eventFd, F_GETFL); - HILOG_DEBUG(LOG_CORE, "%s:smbFd = %d, eventFd = %d", __func__, smbFd, eventFd); - HILOG_DEBUG(LOG_CORE, "%s:eventFd flags = %X", __func__, flags); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:smbFd = %d, eventFd = %d", __func__, smbFd, eventFd); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:eventFd flags = %X", __func__, flags); } CHECK_TRUE(pluginManager->CreateWriter(config.name(), bufferSize, smbFd, eventFd, config.is_protobuf_serialize()), false, "%s:createWriter failed!", __func__); CHECK_TRUE(pluginManager->CreatePluginSession(configVec), false, "%s:createPluginSession failed!", __func__); - HILOG_DEBUG(LOG_CORE, "%s:ok", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ok", __func__); return true; } bool CommandPoller::OnDestroySessionCmd(const DestroySessionCmd& cmd) const { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); CHECK_TRUE(cmd.plugin_ids().size() != 0, false, "%s:cmd invalid!", __func__); uint32_t pluginId = cmd.plugin_ids(0); std::vector pluginIdVec; @@ -85,13 +85,13 @@ bool CommandPoller::OnDestroySessionCmd(const DestroySessionCmd& cmd) const "%s:destroyPluginSession failed!", __func__); CHECK_TRUE(pluginManager->ResetWriter(pluginId), false, "%s:resetWriter failed!", __func__); CHECK_TRUE(pluginManager->UnloadPlugin(pluginId), false, "%s:unloadPlugin failed!", __func__); - HILOG_DEBUG(LOG_CORE, "%s:ok", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ok", __func__); return true; } bool CommandPoller::OnStartSessionCmd(const StartSessionCmd& cmd, PluginResult& result) const { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); CHECK_TRUE(cmd.plugin_ids().size() != 0 && cmd.plugin_configs().size() != 0, false, "%s:cmd invalid!", __func__); std::vector pluginIds; @@ -103,13 +103,13 @@ bool CommandPoller::OnStartSessionCmd(const StartSessionCmd& cmd, PluginResult& CHECK_NOTNULL(pluginManager, false, "promote FAILED!"); CHECK_TRUE(pluginManager->StartPluginSession(pluginIds, configVec, result), false, "%s:start Session failed!", __func__); - HILOG_DEBUG(LOG_CORE, "%s:OK", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:OK", __func__); return true; } bool CommandPoller::OnStopSessionCmd(const StopSessionCmd& cmd) const { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); CHECK_TRUE(cmd.plugin_ids().size() != 0, false, "%s:cmd invalid!", __func__); std::vector pluginIds; pluginIds.push_back(cmd.plugin_ids(0)); @@ -117,13 +117,13 @@ bool CommandPoller::OnStopSessionCmd(const StopSessionCmd& cmd) const auto pluginManager = pluginManager_.lock(); // promote to shared_ptr CHECK_NOTNULL(pluginManager, false, "promote FAILED!"); CHECK_TRUE(pluginManager->StopPluginSession(pluginIds), false, "%s:stop Session failed!", __func__); - HILOG_DEBUG(LOG_CORE, "%s:ok", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ok", __func__); return true; } bool CommandPoller::OnReportBasicDataCmd(const RefreshSessionCmd& cmd) const { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); CHECK_TRUE(cmd.plugin_ids().size() != 0, false, "%s:cmd invalid!", __func__); std::vector pluginIds; pluginIds.push_back(cmd.plugin_ids(0)); @@ -131,13 +131,13 @@ bool CommandPoller::OnReportBasicDataCmd(const RefreshSessionCmd& cmd) const auto pluginManager = pluginManager_.lock(); // promote to shared_ptr CHECK_NOTNULL(pluginManager, false, "promote FAILED!"); CHECK_TRUE(pluginManager->ReportPluginBasicData(pluginIds), false, "%s:report basic data failed!", __func__); - HILOG_INFO(LOG_CORE, "%s:ok", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ok", __func__); return true; } bool CommandPoller::OnGetCommandResponse(SocketContext& context, ::GetCommandResponse& response) { - HILOG_DEBUG(LOG_CORE, "%s:proc", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:proc", __func__); std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); NotifyResultRequest nrr; nrr.set_request_id(1); @@ -173,10 +173,10 @@ bool CommandPoller::OnGetCommandResponse(SocketContext& context, ::GetCommandRes OnReportBasicDataCmd(response.refresh_session_cmd()); status->set_state(ProfilerPluginState::IN_SESSION); } else { - HILOG_DEBUG(LOG_CORE, "%s:command Response failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:command Response failed!", __func__); return false; } - HILOG_DEBUG(LOG_CORE, "%s:ok id = %d", __func__, nrr.command_id()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ok id = %d", __func__, nrr.command_id()); NotifyResult(nrr); return true; } diff --git a/device/plugins/api/src/main.cpp b/device/plugins/api/src/main.cpp index 33f451c9c..78414b1a1 100644 --- a/device/plugins/api/src/main.cpp +++ b/device/plugins/api/src/main.cpp @@ -60,7 +60,7 @@ std::vector presetPluginVec = { volatile sig_atomic_t g_isRunning = true; void SignalSigtermHandler(int sig) { - HILOG_INFO(LOG_CORE, "hiprofiler plugin receive sigterm signal!"); + PROFILER_LOG_INFO(LOG_CORE, "hiprofiler plugin receive sigterm signal!"); g_isRunning = false; } } // namespace @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) const int connectRetrySeconds = 3; std::string pluginDir(DEFAULT_PLUGIN_PATH); if (argv[1] != nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:pluginDir = %s", __func__, argv[1]); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:pluginDir = %s", __func__, argv[1]); pluginDir = argv[1]; } @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) if (commandPoller->OnConnect()) { break; } - HILOG_DEBUG(LOG_CORE, "%s:connect failed, try again", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:connect failed, try again", __func__); sleep(connectRetrySeconds); } pluginManager->SetCommandPoller(commandPoller); @@ -98,9 +98,9 @@ int main(int argc, char* argv[]) for (size_t i = 0; i < presetPluginVec.size(); i++) { const std::string pluginPath = DEFAULT_LIB_PATH + presetPluginVec[i]; if (pluginManager->AddPlugin(pluginPath)) { - HILOG_INFO(LOG_CORE, "add preset plugin %s success!", pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "add preset plugin %s success!", pluginPath.c_str()); } else { - HILOG_INFO(LOG_CORE, "add preset plugin %s failed!", pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "add preset plugin %s failed!", pluginPath.c_str()); } } @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_ONE_SECOND)); } if (flock(lockFileFd, LOCK_UN) == -1) { - HILOG_INFO(LOG_CORE, "release lockfile failed!"); + PROFILER_LOG_INFO(LOG_CORE, "release lockfile failed!"); } close(lockFileFd); pluginManager->StopAllPluginSession(); diff --git a/device/plugins/api/src/plugin_manager.cpp b/device/plugins/api/src/plugin_manager.cpp index c9191ec5e..31f75a760 100644 --- a/device/plugins/api/src/plugin_manager.cpp +++ b/device/plugins/api/src/plugin_manager.cpp @@ -45,7 +45,7 @@ std::string ComputeFileSha256(const std::string& path) size_t nbytes = 0; if ((path.length() >= PATH_MAX) || (realpath(path.c_str(), realPath) == nullptr)) { - HILOG_ERROR(LOG_CORE, "%s:path is invalid: %s, errno=%d", __func__, path.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:path is invalid: %s, errno=%d", __func__, path.c_str(), errno); return ""; } std::unique_ptr fptr(fopen(realPath, "rb"), fclose); @@ -61,7 +61,7 @@ std::string ComputeFileSha256(const std::string& path) result.push_back(HEX_CHARS[LHB(out[i])]); } - HILOG_DEBUG(LOG_CORE, "%s:%s-(%s)", __func__, path.c_str(), result.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:%s-(%s)", __func__, path.c_str(), result.c_str()); return result; } } // namespace @@ -80,27 +80,27 @@ bool PluginManager::AddPlugin(const std::string& pluginPath) CHECK_TRUE(plugin->Load(), false, "%s:load failed!", __func__); if (!plugin->BindFunctions()) { - HILOG_DEBUG(LOG_CORE, "%s:bindFunctions failed %s", __func__, pluginPath.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:bindFunctions failed %s", __func__, pluginPath.c_str()); plugin->Unload(); return false; } if (!plugin->GetInfo(info)) { - HILOG_DEBUG(LOG_CORE, "%s:getinfo failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:getinfo failed!", __func__); plugin->Unload(); return false; } std::string pluginName = info.name; if (pluginIds_.find(pluginName) != pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:already add", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:already add", __func__); plugin->Unload(); return false; } - HILOG_DEBUG(LOG_CORE, "%s:add plugin name = %s", __func__, pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:add plugin name = %s", __func__, pluginName.c_str()); if (!plugin->Unload()) { - HILOG_DEBUG(LOG_CORE, "%s:unload failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:unload failed!", __func__); return false; } @@ -122,19 +122,19 @@ bool PluginManager::RegisterPlugin(const PluginModulePtr& plugin, const std::str request.set_plugin_version(pluginInfo.pluginVersion); if (commandPoller_->RegisterPlugin(request, response)) { if (response.status() == ResponseStatus::OK) { - HILOG_DEBUG(LOG_CORE, "%s:response.plugin_id() = %d", __func__, response.plugin_id()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:response.plugin_id() = %d", __func__, response.plugin_id()); pluginIds_[pluginInfo.name] = response.plugin_id(); pluginModules_.insert(std::pair>(response.plugin_id(), plugin)); pluginPathAndNameMap_.insert( {pluginPath, pluginInfo.name} ); - HILOG_DEBUG(LOG_CORE, "%s:registerPlugin ok", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:registerPlugin ok", __func__); } else { - HILOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 1", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 1", __func__); return false; } } else { - HILOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 2", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 2", __func__); return false; } @@ -149,33 +149,34 @@ bool PluginManager::RemovePlugin(const std::string& pluginPath) std::string pluginName = pluginPathAndNameMap_[pluginPath]; auto it = pluginIds_.find(pluginName); if (it == pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } uint32_t index = it->second; // stop plugin if plugin running if (pluginModules_[index]->IsRunning()) { - HILOG_WARN(LOG_CORE, "%s:plugin delete while using, stop plugin", __func__); + PROFILER_LOG_WARN(LOG_CORE, "%s:plugin delete while using, stop plugin", __func__); // delete schedule task if POLLING mode if (pluginModules_[index]->GetSampleMode() == PluginModule::SampleMode::POLLING) { - HILOG_WARN(LOG_CORE, "%s:delete schedule task plugin name = %s", __func__, pluginName.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "%s:delete schedule task plugin name = %s", __func__, pluginName.c_str()); if (!scheduleTaskManager_.UnscheduleTask(scheduleTask_[pluginName])) { - HILOG_WARN(LOG_CORE, "%s:delete schedule task plugin name = %s failed!", __func__, pluginName.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "%s:delete schedule task plugin name = %s failed!", + __func__, pluginName.c_str()); } } if (!pluginModules_[index]->StopSession()) { - HILOG_WARN(LOG_CORE, "%s:plugin stop failed!", __func__); + PROFILER_LOG_WARN(LOG_CORE, "%s:plugin stop failed!", __func__); } } // Unload plugin if plugin loaded if (pluginModules_[index]->IsLoaded()) { - HILOG_WARN(LOG_CORE, "%s:plugin delete while using, unload plugin", __func__); + PROFILER_LOG_WARN(LOG_CORE, "%s:plugin delete while using, unload plugin", __func__); if (!pluginModules_[index]->Unload()) { - HILOG_WARN(LOG_CORE, "%s:unload plugin failed!", __func__); + PROFILER_LOG_WARN(LOG_CORE, "%s:unload plugin failed!", __func__); } } @@ -185,17 +186,17 @@ bool PluginManager::RemovePlugin(const std::string& pluginPath) UnregisterPluginResponse response; if (commandPoller_->UnregisterPlugin(request, response)) { if (response.status() != ResponseStatus::OK) { - HILOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 1", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 1", __func__); return false; } } else { - HILOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 2", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:registerPlugin fail 2", __func__); return false; } auto itPluginModules = pluginModules_.find(index); if (it == pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } pluginModules_.erase(itPluginModules); @@ -205,7 +206,7 @@ bool PluginManager::RemovePlugin(const std::string& pluginPath) bool PluginManager::LoadPlugin(const std::string& pluginName) { - HILOG_DEBUG(LOG_CORE, "%s:size = %zu", __func__, pluginIds_.size()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:size = %zu", __func__, pluginIds_.size()); auto it = pluginIds_.find(pluginName); CHECK_TRUE(it != pluginIds_.end(), false, "%s:plugin not exist", __func__); uint32_t index = it->second; @@ -223,7 +224,7 @@ bool PluginManager::UnloadPlugin(const std::string& pluginName) { auto it = pluginIds_.find(pluginName); if (it == pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } @@ -232,9 +233,9 @@ bool PluginManager::UnloadPlugin(const std::string& pluginName) bool PluginManager::UnloadPlugin(const uint32_t pluginId) { - HILOG_INFO(LOG_CORE, "%s:ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ready!", __func__); if (pluginModules_.find(pluginId) == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } if (!pluginModules_[pluginId]->Unload()) { @@ -245,17 +246,17 @@ bool PluginManager::UnloadPlugin(const uint32_t pluginId) bool PluginManager::CreatePluginSession(const std::vector& config) { - HILOG_DEBUG(LOG_CORE, "%s:ready", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ready", __func__); for (size_t idx = 0; idx < config.size(); ++idx) { - HILOG_DEBUG(LOG_CORE, "%s:config->name() = %s", __func__, config[idx].name().c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:config->name() = %s", __func__, config[idx].name().c_str()); auto it = pluginIds_.find(config[idx].name()); if (it == pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); return false; } - HILOG_INFO(LOG_CORE, "%s:index = %d, clock = %s", __func__, it->second, config[idx].clock().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:index = %d, clock = %s", __func__, it->second, config[idx].clock().c_str()); pluginModules_[it->second]->SetConfigData(config[idx].config_data()); pluginModules_[it->second]->SetClockId(COMMON::GetClockId(config[idx].clock())); } @@ -267,7 +268,7 @@ bool PluginManager::DestroyPluginSession(const std::vector& pluginIds) for (uint32_t id : pluginIds) { auto it = pluginModules_.find(id); if (it == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); return false; } } @@ -277,13 +278,13 @@ bool PluginManager::DestroyPluginSession(const std::vector& pluginIds) bool PluginManager::StartPluginSession(const std::vector& pluginIds, const std::vector& config, PluginResult& result) { - HILOG_INFO(LOG_CORE, "%s:ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ready!", __func__); size_t idx = 0; for (uint32_t id : pluginIds) { auto it = pluginModules_.find(id); if (it == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); return false; } auto plugin = pluginModules_[id]; @@ -294,17 +295,17 @@ bool PluginManager::StartPluginSession(const std::vector& pluginIds, if (plugin->GetSampleMode() == PluginModule::SampleMode::POLLING) { if (idx > config.size()) { - HILOG_WARN(LOG_CORE, "%s:idx %zu out of size %zu", __func__, idx, config.size()); + PROFILER_LOG_WARN(LOG_CORE, "%s:idx %zu out of size %zu", __func__, idx, config.size()); return false; } if (config[idx].sample_interval() == 0) { - HILOG_DEBUG(LOG_CORE, "%s:scheduleTask interval == 0 error!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:scheduleTask interval == 0 error!", __func__); return false; } auto callback = std::bind(&PluginManager::PullResult, this, id, config[idx].is_protobuf_serialize()); int32_t timerFd = scheduleTaskManager_.ScheduleTask(callback, config[idx].sample_interval()); if (timerFd == -1) { - HILOG_DEBUG(LOG_CORE, "%s:scheduleTask failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:scheduleTask failed!", __func__); return false; } scheduleTask_[config[idx].name()] = timerFd; @@ -326,16 +327,16 @@ bool PluginManager::StartPluginSession(const std::vector& pluginIds, bool PluginManager::StopPluginSession(const std::vector& pluginIds) { - HILOG_INFO(LOG_CORE, "%s:ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ready!", __func__); for (uint32_t id : pluginIds) { if (pluginModules_.find(id) == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); return false; } if (pluginModules_[id]->GetSampleMode() == PluginModule::SampleMode::POLLING) { for (const auto& it : pluginIds_) { if (it.second == id) { - HILOG_DEBUG(LOG_CORE, "%s:find plugin name = %s", __func__, it.first.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:find plugin name = %s", __func__, it.first.c_str()); if (!scheduleTaskManager_.UnscheduleTask(scheduleTask_[it.first])) { return false; } @@ -361,7 +362,7 @@ bool PluginManager::StopAllPluginSession() bool PluginManager::ReportPluginBasicData(const std::vector& pluginIds) { - HILOG_INFO(LOG_CORE, "%s:ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ready!", __func__); for (uint32_t id : pluginIds) { CHECK_TRUE(pluginModules_.find(id) != pluginModules_.end(), false, "%s:plugin not find", __func__); // notify plugin to report basic data @@ -372,7 +373,7 @@ bool PluginManager::ReportPluginBasicData(const std::vector& pluginIds bool PluginManager::SubmitResult(const PluginResult& pluginResult) { - HILOG_INFO(LOG_CORE, "%s:ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:ready!", __func__); NotifyResultRequest request; CHECK_NOTNULL(commandPoller_, false, "%s:commandPoller_ is null", __func__); request.set_request_id(commandPoller_->GetRequestId()); @@ -381,14 +382,14 @@ bool PluginManager::SubmitResult(const PluginResult& pluginResult) *p = pluginResult; NotifyResultResponse response; if (!commandPoller_->NotifyResult(request, response)) { - HILOG_DEBUG(LOG_CORE, "%s:fail 1", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:fail 1", __func__); return false; } if (response.status() != ResponseStatus::OK) { - HILOG_DEBUG(LOG_CORE, "%s:fail 2", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:fail 2", __func__); return false; } - HILOG_DEBUG(LOG_CORE, "%s:ok", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:ok", __func__); return true; } @@ -399,7 +400,7 @@ bool PluginManager::PullResult(uint32_t pluginId, bool isProtobufSerialize) std::string version = ""; auto it = pluginModules_.find(pluginId); if (it == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not find", __func__); return false; } pluginModules_[pluginId]->GetBufferSizeHint(size); @@ -470,19 +471,19 @@ bool PluginManager::CreateWriter(std::string pluginName, uint32_t bufferSize, in { auto it = pluginIds_.find(pluginName); if (it == pluginIds_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } uint32_t index = it->second; if (bufferSize > 0) { - HILOG_DEBUG(LOG_CORE, "%s:%s Use ShareMemory %d", __func__, pluginName.c_str(), bufferSize); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:%s Use ShareMemory %d", __func__, pluginName.c_str(), bufferSize); std::string pluginVersion = ""; pluginModules_[index]->GetPluginVersion(pluginVersion); pluginModules_[index]->RegisterWriter(std::make_shared (pluginName, pluginVersion, bufferSize, smbFd, eventFd, index), isProtobufSerialize); } else { - HILOG_ERROR(LOG_CORE, "%s:no shared memory buffer allocated!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:no shared memory buffer allocated!", __func__); return false; } return true; @@ -491,10 +492,10 @@ bool PluginManager::CreateWriter(std::string pluginName, uint32_t bufferSize, in bool PluginManager::ResetWriter(uint32_t pluginId) { if (pluginModules_.find(pluginId) == pluginModules_.end()) { - HILOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:plugin not exist", __func__); return false; } - HILOG_DEBUG(LOG_CORE, "%s:resetWriter %u", __func__, pluginId); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:resetWriter %u", __func__, pluginId); pluginModules_[pluginId]->RegisterWriter(nullptr); return true; } diff --git a/device/plugins/api/src/plugin_module.cpp b/device/plugins/api/src/plugin_module.cpp index 5a7ed4001..75f7ffd2a 100644 --- a/device/plugins/api/src/plugin_module.cpp +++ b/device/plugins/api/src/plugin_module.cpp @@ -35,7 +35,7 @@ bool PluginModule::Load() { char realPath[PATH_MAX + 1] = {0}; if (handle_ != nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:already open", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:already open", __func__); return false; } CHECK_TRUE((path_.length() < PATH_MAX) && (realpath(path_.c_str(), realPath) != nullptr), false, @@ -44,7 +44,7 @@ bool PluginModule::Load() std::string rpath = realPath; // for SC warning handle_ = dlopen(rpath.c_str(), RTLD_NODELETE); if (handle_ == nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:dlopen err:%s.", __func__, dlerror()); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:dlopen err:%s.", __func__, dlerror()); return false; } return true; @@ -52,10 +52,10 @@ bool PluginModule::Load() bool PluginModule::Unload() { - HILOG_INFO(LOG_CORE, "%s:unload ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:unload ready!", __func__); if (handle_ != nullptr) { int ret = dlclose(handle_); - HILOG_INFO(LOG_CORE, "%s:unload plugin ret = %d", __func__, ret); + PROFILER_LOG_INFO(LOG_CORE, "%s:unload plugin ret = %d", __func__, ret); handle_ = nullptr; structPtr_ = nullptr; return true; @@ -105,7 +105,7 @@ std::string PluginModule::GetConfigData() const void PluginModule::SetClockId(clockid_t clockId) { clockId_ = clockId; - HILOG_INFO(LOG_CORE, "SetClockId: plugin=%s, clock=%d", GetPluginName().c_str(), clockId); + PROFILER_LOG_INFO(LOG_CORE, "SetClockId: plugin=%s, clock=%d", GetPluginName().c_str(), clockId); if (writerAdapter_ != nullptr && writerAdapter_->GetWriter() != nullptr) { writerAdapter_->GetWriter()->SetClockId(clockId); } @@ -199,19 +199,19 @@ bool PluginModule::BindFunctions() if (structPtr_ == nullptr) { structPtr_ = static_cast(dlsym(handle_, "g_pluginModule")); if (structPtr_ == nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:structPtr_ == nullptr", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:structPtr_ == nullptr", __func__); return false; } } if (structPtr_->callbacks == nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:structPtr_->callbacks == nullptr", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:structPtr_->callbacks == nullptr", __func__); return false; } if ((structPtr_->callbacks->onPluginSessionStart == nullptr) || (structPtr_->callbacks->onPluginSessionStop == nullptr)) { - HILOG_DEBUG(LOG_CORE, "%s:onPluginSessionStart == nullptr", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:onPluginSessionStart == nullptr", __func__); return false; } @@ -220,7 +220,7 @@ bool PluginModule::BindFunctions() bool PluginModule::StartSession(const uint8_t* buffer, uint32_t size) { - HILOG_DEBUG(LOG_CORE, "StartSession"); + PROFILER_LOG_DEBUG(LOG_CORE, "StartSession"); CHECK_NOTNULL(handle_, false, "%s:plugin not load", __func__); if (structPtr_ != nullptr && structPtr_->callbacks != nullptr) { if (structPtr_->callbacks->onPluginSessionStart) { @@ -233,7 +233,7 @@ bool PluginModule::StartSession(const uint8_t* buffer, uint32_t size) bool PluginModule::StopSession() { - HILOG_INFO(LOG_CORE, "%s:stop Session ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop Session ready!", __func__); CHECK_NOTNULL(handle_, false, "%s:plugin not load", __func__); if (structPtr_ != nullptr && structPtr_->callbacks != nullptr) { if (structPtr_->callbacks->onPluginSessionStop != nullptr) { @@ -246,7 +246,7 @@ bool PluginModule::StopSession() bool PluginModule::ReportBasicData() { - HILOG_INFO(LOG_CORE, "%s:report basic data ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:report basic data ready!", __func__); CHECK_NOTNULL(handle_, false, "%s:plugin not load", __func__); if (structPtr_ != nullptr && structPtr_->callbacks != nullptr) { if (structPtr_->callbacks->onReportBasicDataCallback != nullptr) { diff --git a/device/plugins/api/src/plugin_watcher.cpp b/device/plugins/api/src/plugin_watcher.cpp index 2b01ebc5e..620381575 100644 --- a/device/plugins/api/src/plugin_watcher.cpp +++ b/device/plugins/api/src/plugin_watcher.cpp @@ -36,7 +36,7 @@ PluginWatcher::PluginWatcher(const PluginManagerPtr& pluginManager) { inotifyFd_ = inotify_init1(IN_CLOEXEC | IN_NONBLOCK); if (inotifyFd_ < 0) { - HILOG_INFO(LOG_CORE, "%s:inotify_init1 failed! inotifyFd_ : %d", __func__, inotifyFd_); + PROFILER_LOG_INFO(LOG_CORE, "%s:inotify_init1 failed! inotifyFd_ : %d", __func__, inotifyFd_); } else { monitorThread_ = std::thread(&PluginWatcher::Monitor, this); } @@ -61,7 +61,7 @@ bool PluginWatcher::ScanPlugins(const std::string& pluginDir) struct dirent* entry = nullptr; char fullpath[PATH_MAX + 1] = {0}; realpath(pluginDir.c_str(), fullpath); - HILOG_INFO(LOG_CORE, "%s:scan plugin from directory %s", __func__, fullpath); + PROFILER_LOG_INFO(LOG_CORE, "%s:scan plugin from directory %s", __func__, fullpath); dir = opendir(fullpath); if (dir == nullptr) { return false; @@ -69,7 +69,7 @@ bool PluginWatcher::ScanPlugins(const std::string& pluginDir) while (true) { entry = readdir(dir); if (!entry) { - HILOG_INFO(LOG_CORE, "%s:readdir finish!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:readdir finish!", __func__); break; } std::string fileName = entry->d_name; @@ -91,10 +91,10 @@ bool PluginWatcher::WatchPlugins(const std::string& pluginDir) int wd = inotify_add_watch(inotifyFd_, fullpath, IN_ALL_EVENTS); if (wd < 0) { - HILOG_INFO(LOG_CORE, "%s:inotify_add_watch add directory %s failed!", __func__, pluginDir.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:inotify_add_watch add directory %s failed!", __func__, pluginDir.c_str()); return false; } - HILOG_INFO(LOG_CORE, "%s:inotify_add_watch add directory %s success!", __func__, fullpath); + PROFILER_LOG_INFO(LOG_CORE, "%s:inotify_add_watch add directory %s success!", __func__, fullpath); std::lock_guard guard(mtx_); wdToDir_.insert(std::pair(wd, std::string(fullpath))); return true; @@ -137,7 +137,7 @@ bool PluginWatcher::MonitorIsSet() } } if (memset_s(buffer, sizeof(buffer), 0, sizeof(buffer)) != 0) { - HILOG_ERROR(LOG_CORE, "%s:memset_s error!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:memset_s error!", __func__); } return true; } @@ -171,12 +171,12 @@ void PluginWatcher::OnPluginAdded(const std::string& pluginPath) auto pluginManager = pluginManager_.lock(); if (pluginManager != nullptr) { if (pluginManager->AddPlugin(pluginPath)) { - HILOG_INFO(LOG_CORE, "%s:plugin %s add success!", __func__, pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:plugin %s add success!", __func__, pluginPath.c_str()); } else { - HILOG_INFO(LOG_CORE, "%s:pluginPath %s add failed!", __func__, pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:pluginPath %s add failed!", __func__, pluginPath.c_str()); } } else { - HILOG_INFO(LOG_CORE, "%s:weak_ptr pluginManager lock failed!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:weak_ptr pluginManager lock failed!", __func__); } } @@ -185,11 +185,11 @@ void PluginWatcher::OnPluginRemoved(const std::string& pluginPath) auto pluginManager = pluginManager_.lock(); if (pluginManager != nullptr) { if (pluginManager->RemovePlugin(pluginPath)) { - HILOG_INFO(LOG_CORE, "%s:pluginPath %s remove success!", __func__, pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:pluginPath %s remove success!", __func__, pluginPath.c_str()); } else { - HILOG_INFO(LOG_CORE, "%s:pluginPath %s remove failed!", __func__, pluginPath.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:pluginPath %s remove failed!", __func__, pluginPath.c_str()); } } else { - HILOG_INFO(LOG_CORE, "%s:weak_ptr pluginManager lock failed!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:weak_ptr pluginManager lock failed!", __func__); } } \ No newline at end of file diff --git a/device/plugins/api/test/unittest/buffer_write_test.cpp b/device/plugins/api/test/unittest/buffer_write_test.cpp index 6fba5f49f..9554c2a3d 100644 --- a/device/plugins/api/test/unittest/buffer_write_test.cpp +++ b/device/plugins/api/test/unittest/buffer_write_test.cpp @@ -44,7 +44,7 @@ int InitShareMemory1() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); return -1; } @@ -54,7 +54,7 @@ int InitShareMemory1() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr1 mmap ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr1 mmap ERR : %s", buf); return -1; } @@ -81,7 +81,7 @@ int InitShareMemory2() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); return -1; } @@ -91,7 +91,7 @@ int InitShareMemory2() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr2 mmap ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr2 mmap ERR : %s", buf); return -1; } diff --git a/device/plugins/arkts_plugin/src/arkts_plugin.cpp b/device/plugins/arkts_plugin/src/arkts_plugin.cpp index dabf858c5..8ebfe624e 100644 --- a/device/plugins/arkts_plugin/src/arkts_plugin.cpp +++ b/device/plugins/arkts_plugin/src/arkts_plugin.cpp @@ -76,7 +76,7 @@ constexpr uint32_t CPU_PROFILER_INTERVAL_DEFAULT = 1000; int32_t ArkTSPlugin::Start(const uint8_t* configData, uint32_t configSize) { if (protoConfig_.ParseFromArray(configData, configSize) <= 0) { - HILOG_ERROR(LOG_CORE, "%s:parseFromArray failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:parseFromArray failed!", __func__); return -1; } @@ -91,7 +91,7 @@ int32_t ArkTSPlugin::Start(const uint8_t* configData, uint32_t configSize) pid_ = protoConfig_.pid(); if (pid_ <= 0) { - HILOG_ERROR(LOG_CORE, "%s: pid is less than or equal to 0", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: pid is less than or equal to 0", __func__); return -1; } @@ -109,7 +109,7 @@ int32_t ArkTSPlugin::Start(const uint8_t* configData, uint32_t configSize) if (protoConfig_.enable_cpu_profiler()) { if (EnableCpuProfiler() != 0) { - HILOG_ERROR(LOG_CORE, "arkts plugin cpu profiler start failed"); + PROFILER_LOG_ERROR(LOG_CORE, "arkts plugin cpu profiler start failed"); return -1; } } @@ -122,11 +122,11 @@ int32_t ArkTSPlugin::Start(const uint8_t* configData, uint32_t configSize) return EnableTimeline(); } case static_cast(HeapType::INVALID): { - HILOG_INFO(LOG_CORE, "arkts plugin memory type is INVALID"); + PROFILER_LOG_INFO(LOG_CORE, "arkts plugin memory type is INVALID"); return 0; } default: { - HILOG_ERROR(LOG_CORE, "arkts plugin start type error"); + PROFILER_LOG_ERROR(LOG_CORE, "arkts plugin start type error"); return -1; } } @@ -146,14 +146,14 @@ int32_t ArkTSPlugin::EnableTimeline() int32_t ArkTSPlugin::EnableSnapshot() { if (protoConfig_.interval() == 0) { - HILOG_ERROR(LOG_CORE, "%s:scheduleTask interval == 0 error!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:scheduleTask interval == 0 error!", __func__); return -1; } snapshotCmd_ = SNAPSHOT_HEAD + (protoConfig_.capture_numeric_value() ? "true" : "false") + SNAPSHOT_TAIL; auto callback = std::bind(&ArkTSPlugin::Snapshot, this); snapshotScheduleTaskFd_ = scheduleTaskManager_.ScheduleTask(callback, protoConfig_.interval() * TIME_BASE); if (snapshotScheduleTaskFd_ == -1) { - HILOG_ERROR(LOG_CORE, "%s:scheduleTask failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:scheduleTask failed!", __func__); return -1; } return 0; @@ -198,7 +198,7 @@ int32_t ArkTSPlugin::Stop() break; } default: { - HILOG_ERROR(LOG_CORE, "arkts plugin stop type error"); + PROFILER_LOG_ERROR(LOG_CORE, "arkts plugin stop type error"); break; } } @@ -251,7 +251,7 @@ void ArkTSPlugin::FlushData(const std::string& command) while (true) { std::string recv = Decode(); if (recv.empty()) { - HILOG_ERROR(LOG_CORE, "%s: recv is empty", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: recv is empty", __func__); break; } ArkTSResult data; @@ -282,19 +282,20 @@ void ArkTSPlugin::FlushData(const std::string& command) bool ArkTSPlugin::ClientConnectUnixWebSocket(const std::string& sockName, uint32_t timeoutLimit) { if (socketState_ != SocketState::UNINITED) { - HILOG_ERROR(LOG_CORE, "client has inited"); + PROFILER_LOG_ERROR(LOG_CORE, "client has inited"); return true; } client_ = socket(AF_UNIX, SOCK_STREAM, 0); if (client_ < SOCKET_SUCCESS) { - HILOG_ERROR(LOG_CORE, "client socket failed, error = %d, , desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client socket failed, error = %d, , desc = %s", errno, strerror(errno)); return false; } // set send and recv timeout limit if (!SetWebSocketTimeOut(client_, timeoutLimit)) { - HILOG_ERROR(LOG_CORE, "client SetWebSocketTimeOut failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client SetWebSocketTimeOut failed, error = %d, desc = %s", + errno, strerror(errno)); close(client_); client_ = -1; return false; @@ -302,15 +303,16 @@ bool ArkTSPlugin::ClientConnectUnixWebSocket(const std::string& sockName, uint32 struct sockaddr_un serverAddr; if (memset_s(&serverAddr, sizeof(serverAddr), 0, sizeof(serverAddr)) != EOK) { - HILOG_ERROR(LOG_CORE, "client memset_s serverAddr failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client memset_s serverAddr failed, error = %d, desc = %s", + errno, strerror(errno)); close(client_); client_ = -1; return false; } serverAddr.sun_family = AF_UNIX; if (strcpy_s(serverAddr.sun_path + 1, sizeof(serverAddr.sun_path) - 1, sockName.c_str()) != EOK) { - HILOG_ERROR(LOG_CORE, "client strcpy_s serverAddr.sun_path failed, error = %d, , desc = %s", errno, - strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client strcpy_s serverAddr.sun_path failed, error = %d, , desc = %s", + errno, strerror(errno)); close(client_); client_ = -1; return false; @@ -320,56 +322,56 @@ bool ArkTSPlugin::ClientConnectUnixWebSocket(const std::string& sockName, uint32 uint32_t len = offsetof(struct sockaddr_un, sun_path) + strlen(sockName.c_str()) + 1; int ret = connect(client_, reinterpret_cast(&serverAddr), static_cast(len)); if (ret != SOCKET_SUCCESS) { - HILOG_ERROR(LOG_CORE, "client connect failed, error, error = %d, , desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client connect failed, error, error = %d, , desc = %s", errno, strerror(errno)); close(client_); client_ = -1; return false; } socketState_ = SocketState::INITED; - HILOG_INFO(LOG_CORE, "client connect success..."); + PROFILER_LOG_INFO(LOG_CORE, "client connect success..."); return true; } bool ArkTSPlugin::ClientSendWSUpgradeReq() { if (socketState_ == SocketState::UNINITED) { - HILOG_ERROR(LOG_CORE, "client has not inited"); + PROFILER_LOG_ERROR(LOG_CORE, "client has not inited"); return false; } if (socketState_ == SocketState::CONNECTED) { - HILOG_ERROR(LOG_CORE, "client has connected"); + PROFILER_LOG_ERROR(LOG_CORE, "client has connected"); return true; } int msgLen = strlen(CLIENT_WEBSOCKET_UPGRADE_REQ); int32_t sendLen = send(client_, CLIENT_WEBSOCKET_UPGRADE_REQ, msgLen, 0); if (sendLen != msgLen) { - HILOG_ERROR(LOG_CORE, "client send wsupgrade req failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client send wsupgrade req failed, error = %d, desc = %s", errno, strerror(errno)); socketState_ = SocketState::UNINITED; shutdown(client_, SHUT_RDWR); close(client_); client_ = -1; return false; } - HILOG_INFO(LOG_CORE, "client send wsupgrade req success"); + PROFILER_LOG_INFO(LOG_CORE, "client send wsupgrade req success"); return true; } bool ArkTSPlugin::ClientRecvWSUpgradeRsp() { if (socketState_ == SocketState::UNINITED) { - HILOG_ERROR(LOG_CORE, "client has not inited"); + PROFILER_LOG_ERROR(LOG_CORE, "client has not inited"); return false; } if (socketState_ == SocketState::CONNECTED) { - HILOG_ERROR(LOG_CORE, "ClientRecvWSUpgradeRsp::client has connected"); + PROFILER_LOG_ERROR(LOG_CORE, "ClientRecvWSUpgradeRsp::client has connected"); return true; } char recvBuf[CLIENT_WEBSOCKET_UPGRADE_RSP_LEN + 1] = {0}; int32_t bufLen = recv(client_, recvBuf, CLIENT_WEBSOCKET_UPGRADE_RSP_LEN, 0); if (bufLen != CLIENT_WEBSOCKET_UPGRADE_RSP_LEN) { - HILOG_ERROR(LOG_CORE, "client recv wsupgrade rsp failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client recv wsupgrade rsp failed, error = %d, desc = %s", errno, strerror(errno)); socketState_ = SocketState::UNINITED; shutdown(client_, SHUT_RDWR); close(client_); @@ -377,14 +379,14 @@ bool ArkTSPlugin::ClientRecvWSUpgradeRsp() return false; } socketState_ = SocketState::CONNECTED; - HILOG_INFO(LOG_CORE, "client recv wsupgrade rsp success"); + PROFILER_LOG_INFO(LOG_CORE, "client recv wsupgrade rsp success"); return true; } bool ArkTSPlugin::ClientSendReq(const std::string& message) { if (socketState_ != SocketState::CONNECTED) { - HILOG_ERROR(LOG_CORE, "client has not connected"); + PROFILER_LOG_ERROR(LOG_CORE, "client has not connected"); return false; } @@ -417,7 +419,7 @@ bool ArkTSPlugin::ClientSendReq(const std::string& message) } if (memcpy_s(sendBuf + sendMsgLen, SOCKET_MASK_LEN, MASK_KEY, SOCKET_MASK_LEN) != EOK) { - HILOG_ERROR(LOG_CORE, "client memcpy_s MASK_KEY failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client memcpy_s MASK_KEY failed, error = %d, desc = %s", errno, strerror(errno)); return false; } sendMsgLen += SOCKET_MASK_LEN; @@ -428,23 +430,24 @@ bool ArkTSPlugin::ClientSendReq(const std::string& message) maskMessage.push_back(message[i] ^ MASK_KEY[j]); } if (memcpy_s(sendBuf + sendMsgLen, msgLen, maskMessage.c_str(), msgLen) != EOK) { - HILOG_ERROR(LOG_CORE, "client memcpy_s maskMessage failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client memcpy_s maskMessage failed, error = %d, desc = %s", + errno, strerror(errno)); return false; } msgBuf[sendMsgLen + msgLen] = '\0'; if (send(client_, sendBuf, sendMsgLen + msgLen, 0) != static_cast(sendMsgLen + msgLen)) { - HILOG_ERROR(LOG_CORE, "client send msg req failed, error = %d, desc = %s", errno, strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "client send msg req failed, error = %d, desc = %s", errno, strerror(errno)); return false; } - HILOG_INFO(LOG_CORE, "ClientRecvWSUpgradeRsp::client send msg req success..."); + PROFILER_LOG_INFO(LOG_CORE, "ClientRecvWSUpgradeRsp::client send msg req success..."); return true; } void ArkTSPlugin::Close() { if (socketState_ == SocketState::UNINITED) { - HILOG_ERROR(LOG_CORE, "client has not inited"); + PROFILER_LOG_ERROR(LOG_CORE, "client has not inited"); return; } shutdown(client_, SHUT_RDWR); @@ -470,12 +473,12 @@ bool ArkTSPlugin::SetWebSocketTimeOut(int32_t fd, uint32_t timeoutLimit) std::string ArkTSPlugin::Decode() { if (socketState_ != SocketState::CONNECTED) { - HILOG_ERROR(LOG_CORE, "client has not connected"); + PROFILER_LOG_ERROR(LOG_CORE, "client has not connected"); return {}; } char recvbuf[SOCKET_HEADER_LEN + 1]; if (!Recv(client_, recvbuf, SOCKET_HEADER_LEN, 0)) { - HILOG_ERROR(LOG_CORE, "Decode failed, client websocket disconnect"); + PROFILER_LOG_ERROR(LOG_CORE, "Decode failed, client websocket disconnect"); socketState_ = SocketState::INITED; shutdown(client_, SHUT_RDWR); close(client_); @@ -514,7 +517,7 @@ bool ArkTSPlugin::HandleFrame(WebSocketFrame& wsFrame) if (wsFrame.payloadLen == 126) { // 126: the payloadLen read from frame char recvbuf[PAYLOAD_LEN + 1] = {0}; if (!Recv(client_, recvbuf, PAYLOAD_LEN, 0)) { - HILOG_ERROR(LOG_CORE, "HandleFrame: Recv payloadLen == 126 failed"); + PROFILER_LOG_ERROR(LOG_CORE, "HandleFrame: Recv payloadLen == 126 failed"); return false; } recvbuf[PAYLOAD_LEN] = '\0'; @@ -526,7 +529,7 @@ bool ArkTSPlugin::HandleFrame(WebSocketFrame& wsFrame) } else if (wsFrame.payloadLen > 126) { // 126: the payloadLen read from frame char recvbuf[EXTEND_PAYLOAD_LEN + 1] = {0}; if (!Recv(client_, recvbuf, EXTEND_PAYLOAD_LEN, 0)) { - HILOG_ERROR(LOG_CORE, "HandleFrame: Recv payloadLen > 127 failed"); + PROFILER_LOG_ERROR(LOG_CORE, "HandleFrame: Recv payloadLen > 127 failed"); return false; } recvbuf[EXTEND_PAYLOAD_LEN] = '\0'; diff --git a/device/plugins/arkts_plugin/test/unittest/arkts_plugin_unittest.cpp b/device/plugins/arkts_plugin/test/unittest/arkts_plugin_unittest.cpp index d3e9c431e..c1ca305db 100755 --- a/device/plugins/arkts_plugin/test/unittest/arkts_plugin_unittest.cpp +++ b/device/plugins/arkts_plugin/test/unittest/arkts_plugin_unittest.cpp @@ -52,7 +52,7 @@ public: if (std::regex_search(result, match, pattern)) { std::string matchedString = match[1].str(); pid_ = std::stoi(matchedString); - HILOG_INFO(LOG_CORE, "ArkTSPluginTest: pid_ is %d", pid_); + PROFILER_LOG_INFO(LOG_CORE, "ArkTSPluginTest: pid_ is %d", pid_); } } } diff --git a/device/plugins/bytrace_plugin/src/bytrace_module.cpp b/device/plugins/bytrace_plugin/src/bytrace_module.cpp index e72624cb8..d4dd735c5 100644 --- a/device/plugins/bytrace_plugin/src/bytrace_module.cpp +++ b/device/plugins/bytrace_plugin/src/bytrace_module.cpp @@ -65,7 +65,7 @@ void ParseConfig(const BytracePluginConfig& config) bool RunCommand(const std::string& cmd) { - HILOG_INFO(LOG_CORE, "%s:start running commond: %s", __func__, cmd.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:start running commond: %s", __func__, cmd.c_str()); std::unique_ptr pipe(popen(cmd.data(), "r"), pclose); CHECK_TRUE(pipe, false, "BytraceCall::RunCommand: create popen FAILED!"); @@ -74,7 +74,7 @@ bool RunCommand(const std::string& cmd) while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { result += buffer.data(); } - HILOG_INFO(LOG_CORE, "%s:runCommand result: %s", __func__, result.data()); + PROFILER_LOG_INFO(LOG_CORE, "%s:runCommand result: %s", __func__, result.data()); return true; } @@ -153,7 +153,7 @@ int BytracePluginSessionStop() int BytraceRegisterWriterStruct(const WriterStruct* writer) { - HILOG_INFO(LOG_CORE, "%s:writer %p", __func__, writer); + PROFILER_LOG_INFO(LOG_CORE, "%s:writer %p", __func__, writer); return 0; } diff --git a/device/plugins/cpu_plugin/src/cpu_data_plugin.cpp b/device/plugins/cpu_plugin/src/cpu_data_plugin.cpp index 253679083..064f35faa 100644 --- a/device/plugins/cpu_plugin/src/cpu_data_plugin.cpp +++ b/device/plugins/cpu_plugin/src/cpu_data_plugin.cpp @@ -54,7 +54,7 @@ CpuDataPlugin::CpuDataPlugin() CpuDataPlugin::~CpuDataPlugin() { - HILOG_INFO(LOG_CORE, "%s:~CpuDataPlugin!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:~CpuDataPlugin!", __func__); if (buffer_ != nullptr) { free(buffer_); buffer_ = nullptr; @@ -79,12 +79,12 @@ int CpuDataPlugin::Start(const uint8_t* configData, uint32_t configSize) if (protoConfig_.pid() > 0) { pid_ = protoConfig_.pid(); } else if (protoConfig_.report_process_info()) { - HILOG_INFO(LOG_CORE, "%s:need report process info", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:need report process info", __func__); } else { - HILOG_ERROR(LOG_CORE, "%s:invalid pid", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:invalid pid", __func__); return RET_FAIL; } - HILOG_INFO(LOG_CORE, "%s:start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:start success!", __func__); return RET_SUCC; } @@ -143,7 +143,7 @@ template bool CpuDataPlugin::WriteProcnum(T& cpuData) while (int32_t tid = GetValidTid(procDir)) { if (tid <= 0) { closedir(procDir); - HILOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, tid); + PROFILER_LOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, tid); return false; } i++; @@ -165,7 +165,7 @@ int CpuDataPlugin::Stop() prevThreadCpuTimeMap_.clear(); prevCoreSystemCpuTimeMap_.clear(); prevCoreSystemBootTimeMap_.clear(); - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } @@ -180,14 +180,14 @@ int32_t CpuDataPlugin::ReadFile(std::string& fileName) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "snprintf_s(%s) error, errno(%d:%s)", fileName.c_str(), errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "snprintf_s(%s) error, errno(%d:%s)", fileName.c_str(), errno, buf); return RET_FAIL; } if (realpath(filePath, realPath) == nullptr) { const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "realpath(%s) failed, errno(%d:%s)", fileName.c_str(), errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "realpath(%s) failed, errno(%d:%s)", fileName.c_str(), errno, buf); return RET_FAIL; } @@ -196,12 +196,12 @@ int32_t CpuDataPlugin::ReadFile(std::string& fileName) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, realPath, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, realPath, errno, buf); err_ = errno; return RET_FAIL; } if (buffer_ == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); err_ = RET_NULL_ADDR; close(fd); return RET_FAIL; @@ -209,7 +209,7 @@ int32_t CpuDataPlugin::ReadFile(std::string& fileName) bytesRead = read(fd, buffer_, READ_BUFFER_SIZE - 1); if (bytesRead <= 0) { close(fd); - HILOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, realPath, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, realPath, errno); err_ = errno; return RET_FAIL; } @@ -276,7 +276,7 @@ template void CpuDataPlugin::WriteProcessCpuUsage(T& cpuUsageInfo, // 获取到的数据不包含utime、stime、cutime、cstime四个数值时返回 if (cpuUsageVec.size() != PROCESS_UNSPECIFIED) { - HILOG_ERROR(LOG_CORE, "%s:failed to get process cpu usage, size=%zu", __func__, cpuUsageVec.size()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to get process cpu usage, size=%zu", __func__, cpuUsageVec.size()); return; } @@ -604,7 +604,7 @@ template void CpuDataPlugin::WriteThread(T& threadInfo, const char* // 获取到的数据不包含utime、stime、cutime、cstime四个数值时返回 if (cpuUsageVec.size() != PROCESS_UNSPECIFIED) { - HILOG_ERROR(LOG_CORE, "%s:failed to get thread cpu usage, size=%zu", __func__, cpuUsageVec.size()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to get thread cpu usage, size=%zu", __func__, cpuUsageVec.size()); return; } diff --git a/device/plugins/cpu_plugin/src/test_main.cpp b/device/plugins/cpu_plugin/src/test_main.cpp index 46768d128..d862db5d3 100644 --- a/device/plugins/cpu_plugin/src/test_main.cpp +++ b/device/plugins/cpu_plugin/src/test_main.cpp @@ -89,7 +89,7 @@ int main(int agrc, char* agrv[]) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "test:dlopen err, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "test:dlopen err, errno(%d:%s)", errno, buf); return 0; } diff --git a/device/plugins/diskio_plugin/src/diskio_data_plugin.cpp b/device/plugins/diskio_plugin/src/diskio_data_plugin.cpp index f9b2dec3c..717728105 100644 --- a/device/plugins/diskio_plugin/src/diskio_data_plugin.cpp +++ b/device/plugins/diskio_plugin/src/diskio_data_plugin.cpp @@ -39,7 +39,7 @@ DiskioDataPlugin::DiskioDataPlugin() DiskioDataPlugin::~DiskioDataPlugin() { - HILOG_INFO(LOG_CORE, "%s:~DiskioDataPlugin!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:~DiskioDataPlugin!", __func__); if (buffer_ != nullptr) { free(buffer_); buffer_ = nullptr; @@ -57,7 +57,7 @@ int DiskioDataPlugin::Start(const uint8_t* configData, uint32_t configSize) if (protoConfig_.report_io_stats()) { ioEntry_ = std::make_shared(protoConfig_.report_io_stats()); } - HILOG_INFO(LOG_CORE, "%s:start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:start success!", __func__); return RET_SUCC; } @@ -109,7 +109,7 @@ int DiskioDataPlugin::Stop() ioEntry_.reset(); ioEntry_ = nullptr; } - HILOG_INFO(LOG_CORE, "%s:plugin:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:plugin:stop success!", __func__); return 0; } @@ -122,12 +122,12 @@ int32_t DiskioDataPlugin::ReadFile(std::string& fileName) "%s:path is invalid: %s, errno=%d", __func__, fileName.c_str(), errno); fd = open(realPath, O_RDONLY | O_CLOEXEC); if (fd == -1) { - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno=%d", __func__, fileName.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno=%d", __func__, fileName.c_str(), errno); err_ = errno; return RET_FAIL; } if (buffer_ == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); err_ = RET_NULL_ADDR; close(fd); return RET_FAIL; @@ -135,7 +135,7 @@ int32_t DiskioDataPlugin::ReadFile(std::string& fileName) bytesRead = read(fd, buffer_, READ_BUFFER_SIZE - 1); if (bytesRead <= 0) { close(fd); - HILOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, fileName.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, fileName.c_str(), errno); err_ = errno; return RET_FAIL; } @@ -171,14 +171,16 @@ template void DiskioDataPlugin::SetDiskioData(T& diskioData, const std::string curWord = std::string(totalbuffer.CurWord(), totalbuffer.CurWordSize()); if (strcmp(curWord.c_str(), "pgpgin") == 0) { if (!totalbuffer.NextWord('\n')) { - HILOG_ERROR(LOG_CORE, "%s:failed to get pgpgin, CurWord() = %s", __func__, totalbuffer.CurWord()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to get pgpgin, CurWord() = %s", + __func__, totalbuffer.CurWord()); break; } curWord = std::string(totalbuffer.CurWord(), totalbuffer.CurWordSize()); rd_sectors_kb = atoi(curWord.c_str()); } else if (strcmp(curWord.c_str(), "pgpgout") == 0) { if (!totalbuffer.NextWord('\n')) { - HILOG_ERROR(LOG_CORE, "%s:failed to get pgpgout, CurWord() = %s", __func__, totalbuffer.CurWord()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to get pgpgout, CurWord() = %s", + __func__, totalbuffer.CurWord()); break; } curWord = std::string(totalbuffer.CurWord(), totalbuffer.CurWordSize()); diff --git a/device/plugins/ftrace_plugin/include/sub_event_parser.h b/device/plugins/ftrace_plugin/include/sub_event_parser.h index 3e2533873..c08798f4a 100644 --- a/device/plugins/ftrace_plugin/include/sub_event_parser.h +++ b/device/plugins/ftrace_plugin/include/sub_event_parser.h @@ -36,12 +36,12 @@ public: SubEventParser() { - HILOG_INFO(LOG_CORE, "SubEventParser create!"); + PROFILER_LOG_INFO(LOG_CORE, "SubEventParser create!"); } ~SubEventParser() { - HILOG_INFO(LOG_CORE, "SubEventParser destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "SubEventParser destroy!"); } static SubEventParser& GetInstance() @@ -59,7 +59,7 @@ public: { auto it = nameToFunctions_.find(format.eventName); if (it == nameToFunctions_.end()) { - HILOG_INFO(LOG_CORE, "SetupEvent: event(%s) is not supported", format.eventName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "SetupEvent: event(%s) is not supported", format.eventName.c_str()); return false; } diff --git a/device/plugins/ftrace_plugin/src/file_utils.cpp b/device/plugins/ftrace_plugin/src/file_utils.cpp index af908dbe1..811af9e04 100644 --- a/device/plugins/ftrace_plugin/src/file_utils.cpp +++ b/device/plugins/ftrace_plugin/src/file_utils.cpp @@ -59,7 +59,7 @@ std::string FileUtils::ReadFile(const std::string& path) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_WARN(LOG_CORE, "open file %s FAILED: %s!", path.c_str(), buf); + PROFILER_LOG_WARN(LOG_CORE, "open file %s FAILED: %s!", path.c_str(), buf); return ""; } std::string content = ReadFile(fd); diff --git a/device/plugins/ftrace_plugin/src/flow_controller.cpp b/device/plugins/ftrace_plugin/src/flow_controller.cpp index a95e8c8d7..c638a9f0a 100644 --- a/device/plugins/ftrace_plugin/src/flow_controller.cpp +++ b/device/plugins/ftrace_plugin/src/flow_controller.cpp @@ -63,7 +63,7 @@ FlowController::FlowController() FlowController::~FlowController(void) { - HILOG_INFO(LOG_CORE, "FlowController destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "FlowController destroy!"); } int FlowController::SetWriter(const WriterStructPtr& writer) @@ -124,7 +124,7 @@ bool FlowController::CreateRawDataReaders() bool FlowController::CreatePagedMemoryPool() { - HILOG_INFO(LOG_CORE, "create memory pool, buffer_size_kb = %u", bufferSizeKb_); + PROFILER_LOG_INFO(LOG_CORE, "create memory pool, buffer_size_kb = %u", bufferSizeKb_); size_t bufferSizePages = bufferSizeKb_ / KB_PER_PAGE; size_t pagesPerBlock = bufferSizePages / static_cast(platformCpuNum_); if (pagesPerBlock < MIN_BLOCK_SIZE_PAGES) { @@ -182,7 +182,7 @@ bool FlowController::ParseBasicData() CHECK_NOTNULL(ctx, false, "%s: get RandomWriteCtx FAILED!", __func__); auto traceResult = std::make_unique(ctx); if (!ReportClockTimes(traceResult)) { - HILOG_ERROR(LOG_CORE, "report clock times FAILED!"); + PROFILER_LOG_ERROR(LOG_CORE, "report clock times FAILED!"); } int32_t msgSize = traceResult->Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -201,7 +201,7 @@ bool FlowController::ParseBasicData() CHECK_NOTNULL(ctx, false, "%s: get RandomWriteCtx FAILED!", __func__); auto traceResult = std::make_unique(ctx); if (!ParseKernelSymbols(traceResult)) { - HILOG_ERROR(LOG_CORE, "parse kernel symbols FAILED!"); + PROFILER_LOG_ERROR(LOG_CORE, "parse kernel symbols FAILED!"); } int32_t msgSize = traceResult->Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -219,7 +219,7 @@ bool FlowController::ParseBasicData() CHECK_NOTNULL(ctx, false, "%s: get RandomWriteCtx FAILED!", __func__); auto traceResult = std::make_unique(ctx); if (!ParsePerCpuStatus(traceResult, TRACE_START)) { - HILOG_ERROR(LOG_CORE, "parse TRACE_START stats failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "parse TRACE_START stats failed!"); } int32_t msgSize = traceResult->Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -246,7 +246,7 @@ std::string FlowController::ReloadTraceArgs() if (bufferSizeKb_ > 0) { args += (" bufferSize:" + std::to_string(bufferSizeKb_)); } - HILOG_INFO(LOG_CORE, "trace args: %s", args.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "trace args: %s", args.c_str()); return args; } @@ -271,7 +271,7 @@ int FlowController::StartCapture(void) uint32_t savedCmdlinesSize = platformCpuNum_ < OCTA_CORE_CPU ? SAVED_CMDLINE_SIZE_SMALL : SAVED_CMDLINE_SIZE_LARGE; if (!FtraceFsOps::GetInstance().SetSavedCmdLinesSize(savedCmdlinesSize)) { - HILOG_ERROR(LOG_CORE, "SetSavedCmdLinesSize %u fail.", savedCmdlinesSize); + PROFILER_LOG_ERROR(LOG_CORE, "SetSavedCmdLinesSize %u fail.", savedCmdlinesSize); } // enable additional record options @@ -287,14 +287,14 @@ int FlowController::StartCapture(void) CHECK_TRUE(CreateRawDataCaches(), -1, "create raw data caches failed!"); pollThread_ = std::thread(&FlowController::CaptureWorkOnDelayMode, this); } else { - HILOG_ERROR(LOG_CORE, "ParseMode is Illegal parameter!"); + PROFILER_LOG_ERROR(LOG_CORE, "ParseMode is Illegal parameter!"); return -1; } // set trace_clock and enable all tag categories with hiview::TraceCollector auto openRet = traceCollector_->OpenRecording(ReloadTraceArgs()); if (openRet.retCode != OHOS::HiviewDFX::UCollect::UcError::SUCCESS) { - HILOG_ERROR(LOG_CORE, "Enable tag categories failed, trace error code is %d!", openRet.retCode); + PROFILER_LOG_ERROR(LOG_CORE, "Enable tag categories failed, trace error code is %d!", openRet.retCode); return -1; } EnableTraceEvents(); @@ -304,7 +304,7 @@ int FlowController::StartCapture(void) void FlowController::CaptureWorkOnNomalModeInner() { pthread_setname_np(pthread_self(), "TraceReader"); - HILOG_INFO(LOG_CORE, "FlowController::CaptureWorkOnNomalMode start!"); + PROFILER_LOG_INFO(LOG_CORE, "FlowController::CaptureWorkOnNomalMode start!"); auto tracePeriod = std::chrono::milliseconds(tracePeriodMs_); std::vector rawDataBytes(platformCpuNum_, 0); @@ -315,7 +315,7 @@ void FlowController::CaptureWorkOnNomalModeInner() // read data from percpu trace_pipe_raw, consume kernel ring buffers for (size_t i = 0; i < rawDataBytes.size(); i++) { if (flushCacheData_ && !keepRunning_) { - HILOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); + PROFILER_LOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); return; } long nbytes = ReadEventData(i); @@ -328,11 +328,11 @@ void FlowController::CaptureWorkOnNomalModeInner() // parse ftrace percpu event data for (size_t i = 0; i < rawDataBytes.size(); i++) { if (flushCacheData_ && !keepRunning_) { - HILOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); + PROFILER_LOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); return; } if (rawDataBytes[i] == 0) { - HILOG_INFO(LOG_CORE, "Get raw data from CPU%zu is 0 bytes.", i); + PROFILER_LOG_INFO(LOG_CORE, "Get raw data from CPU%zu is 0 bytes.", i); continue; } CHECK_TRUE(ParseEventDataOnNomalMode(i, rawDataBytes[i]), NO_RETVAL, "ParseEventData failed!"); @@ -345,7 +345,7 @@ void FlowController::CaptureWorkOnNomalModeInner() } tansporter_->Flush(); - HILOG_DEBUG(LOG_CORE, "FlowController::CaptureWorkOnNomalMode done!"); + PROFILER_LOG_DEBUG(LOG_CORE, "FlowController::CaptureWorkOnNomalMode done!"); } long FlowController::HmReadEventData() @@ -362,7 +362,8 @@ long FlowController::HmReadEventData() rest -= nbytes; } if (used == bufferSize) { - HILOG_WARN(LOG_CORE, "hm trace raw data may overwrite. current buffer size = %u.", (unsigned int)bufferSize); + PROFILER_LOG_WARN(LOG_CORE, "hm trace raw data may overwrite. current buffer size = %u.", + (unsigned int)bufferSize); } return used; } @@ -370,13 +371,13 @@ long FlowController::HmReadEventData() void FlowController::HmCaptureWorkOnNomalModeInner() { pthread_setname_np(pthread_self(), "HmTraceReader"); - HILOG_INFO(LOG_CORE, "FlowController::HmCaptureWorkOnNomalMode start!"); + PROFILER_LOG_INFO(LOG_CORE, "FlowController::HmCaptureWorkOnNomalMode start!"); auto tracePeriod = std::chrono::milliseconds(tracePeriodMs_); while (keepRunning_) { std::this_thread::sleep_for(tracePeriod); if (flushCacheData_ && !keepRunning_) { - HILOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); + PROFILER_LOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); return; } @@ -385,11 +386,11 @@ void FlowController::HmCaptureWorkOnNomalModeInner() ftraceParser_->ParseSavedCmdlines(FtraceFsOps::GetInstance().GetSavedCmdLines()); if (flushCacheData_ && !keepRunning_) { - HILOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); + PROFILER_LOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); return; } if (rawDataBytes == 0) { - HILOG_INFO(LOG_CORE, "Get hm raw data is 0 bytes."); + PROFILER_LOG_INFO(LOG_CORE, "Get hm raw data is 0 bytes."); continue; } @@ -397,7 +398,7 @@ void FlowController::HmCaptureWorkOnNomalModeInner() } tansporter_->Flush(); - HILOG_DEBUG(LOG_CORE, "FlowController::HmCaptureWorkOnNomalMode done!"); + PROFILER_LOG_DEBUG(LOG_CORE, "FlowController::HmCaptureWorkOnNomalMode done!"); } void FlowController::CaptureWorkOnNomalMode() @@ -412,7 +413,7 @@ void FlowController::CaptureWorkOnNomalMode() void FlowController::CaptureWorkOnDelayMode() { pthread_setname_np(pthread_self(), "TraceReader"); - HILOG_INFO(LOG_CORE, "FlowController::CaptureWorkOnDelayMode start!"); + PROFILER_LOG_INFO(LOG_CORE, "FlowController::CaptureWorkOnDelayMode start!"); auto tracePeriod = std::chrono::milliseconds(tracePeriodMs_); int writeDataCount = 0; @@ -422,12 +423,12 @@ void FlowController::CaptureWorkOnDelayMode() // read data from percpu trace_pipe_raw, consume kernel ring buffers for (int cpuIdx = 0; cpuIdx < platformCpuNum_; cpuIdx++) { if (flushCacheData_ && !keepRunning_) { - HILOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); + PROFILER_LOG_INFO(LOG_CORE, "flushCacheData_ is true, return"); return; } long nbytes = ReadEventData(cpuIdx); if (nbytes == 0) { - HILOG_INFO(LOG_CORE, "Get raw data from CPU%d is 0 bytes.", cpuIdx); + PROFILER_LOG_INFO(LOG_CORE, "Get raw data from CPU%d is 0 bytes.", cpuIdx); continue; } fwrite(&cpuIdx, sizeof(uint8_t), 1, rawDataFile_.get()); @@ -444,7 +445,7 @@ void FlowController::CaptureWorkOnDelayMode() CHECK_TRUE(ParseEventDataOnDelayMode(), NO_RETVAL, "ParseEventData failed!"); tansporter_->Flush(); - HILOG_DEBUG(LOG_CORE, "FlowController::CaptureWorkOnDelayMode done!"); + PROFILER_LOG_DEBUG(LOG_CORE, "FlowController::CaptureWorkOnDelayMode done!"); } static inline int RmqEntryTotalSize(unsigned int size) @@ -512,7 +513,7 @@ bool FlowController::HmParseEventDataOnNomalMode(long dataSize) traceResult.Reset(ctx, &msgPool); ProtoEncoder::FtraceEvent* event = nullptr; if (!HmParseEventData(&traceResult, data, event)) { - HILOG_ERROR(LOG_CORE, "hm parse raw data failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "hm parse raw data failed!"); } int32_t msgSize = traceResult.Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -539,7 +540,7 @@ long FlowController::ReadEventData(int cpuid) } if (used == bufferSize) { - HILOG_INFO(LOG_CORE, + PROFILER_LOG_INFO(LOG_CORE, "used(%ld) equals bufferSize(%ld), please expand buffer_size_kb, otherwise the kernel may lose data\n", used, bufferSize); } @@ -563,7 +564,7 @@ bool FlowController::ParseEventData(int cpuid, uint8_t* page) traceResult.Reset(ctx, &msgPool); ProtoEncoder::FtraceEvent* event = nullptr; // Used to distinguish between SubEventParser instance types. if (!ParseFtraceEvent(&traceResult, cpuid, page, event)) { - HILOG_ERROR(LOG_CORE, "parse raw event for cpu-%d failed!", cpuid); + PROFILER_LOG_ERROR(LOG_CORE, "parse raw event for cpu-%d failed!", cpuid); } int32_t msgSize = traceResult.Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -615,9 +616,9 @@ int FlowController::StopCapture(void) // stop ftrace event data polling thread keepRunning_ = false; if (pollThread_.joinable()) { - HILOG_INFO(LOG_CORE, "join thread start!\n"); + PROFILER_LOG_INFO(LOG_CORE, "join thread start!\n"); pollThread_.join(); - HILOG_INFO(LOG_CORE, "join thread done!\n"); + PROFILER_LOG_INFO(LOG_CORE, "join thread done!\n"); } // parse per cpu stats @@ -630,7 +631,7 @@ int FlowController::StopCapture(void) CHECK_NOTNULL(ctx, -1, "%s: get RandomWriteCtx FAILED!", __func__); auto traceResult = std::make_unique(ctx); if (!ParsePerCpuStatus(traceResult, TRACE_END)) { - HILOG_ERROR(LOG_CORE, "parse TRACE_END stats FAILED!"); + PROFILER_LOG_ERROR(LOG_CORE, "parse TRACE_END stats FAILED!"); } int32_t msgSize = traceResult->Finish(); resultWriter_->finishReport(resultWriter_, msgSize); @@ -669,7 +670,7 @@ template bool FlowController::ParsePerCpuStatus(T& tracePluginResul } for (int i = 0; i < platformCpuNum_; i++) { - HILOG_INFO(LOG_CORE, "[%d] ParsePerCpuStatus %d!", i, stage); + PROFILER_LOG_INFO(LOG_CORE, "[%d] ParsePerCpuStatus %d!", i, stage); PerCpuStats stats = {}; stats.cpuIndex = i; ftraceParser_->ParsePerCpuStatus(stats, FtraceFsOps::GetInstance().GetPerCpuStats(i)); @@ -728,7 +729,7 @@ template bool FlowController::ParseKernelSymbols(T& tracePluginResu symbolDetail->set_symbol_addr(symbol.addr); symbolDetail->set_symbol_name(symbol.name); }); - HILOG_INFO(LOG_CORE, "parse kernel symbol message done!"); + PROFILER_LOG_INFO(LOG_CORE, "parse kernel symbol message done!"); return true; } @@ -748,7 +749,7 @@ bool FlowController::AddPlatformEventsToParser(void) { CHECK_TRUE(ftraceSupported_, false, "current kernel not support ftrace!"); - HILOG_INFO(LOG_CORE, "Add platform events to parser start!"); + PROFILER_LOG_INFO(LOG_CORE, "Add platform events to parser start!"); for (auto& typeName : FtraceFsOps::GetInstance().GetPlatformEvents()) { std::string type = typeName.first; std::string name = typeName.second; @@ -756,7 +757,7 @@ bool FlowController::AddPlatformEventsToParser(void) supportedEvents_.push_back(typeName); } } - HILOG_INFO(LOG_CORE, "Add platform events to parser done, events: %zu!", supportedEvents_.size()); + PROFILER_LOG_INFO(LOG_CORE, "Add platform events to parser done, events: %zu!", supportedEvents_.size()); return true; } diff --git a/device/plugins/ftrace_plugin/src/ftrace_data_reader.cpp b/device/plugins/ftrace_plugin/src/ftrace_data_reader.cpp index 63e739783..fbe79139a 100644 --- a/device/plugins/ftrace_plugin/src/ftrace_data_reader.cpp +++ b/device/plugins/ftrace_plugin/src/ftrace_data_reader.cpp @@ -31,7 +31,7 @@ FtraceDataReader::FtraceDataReader(const std::string& path) : path_(path), readF char realPath[PATH_MAX + 1] = {0}; if ((path.length() >= PATH_MAX) || (realpath(path.c_str(), realPath) == nullptr)) { - HILOG_ERROR(LOG_CORE, "%s:so filename invalid, errno=%d", __func__, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:so filename invalid, errno=%d", __func__, errno); } readFd_ = open(realPath, O_CLOEXEC | O_NONBLOCK); CHECK_TRUE(readFd_ >= 0, NO_RETVAL, "open %s failed, %d", realPath, errno); diff --git a/device/plugins/ftrace_plugin/src/ftrace_fs_ops.cpp b/device/plugins/ftrace_plugin/src/ftrace_fs_ops.cpp index 7f5e2b6bf..c5275df3f 100644 --- a/device/plugins/ftrace_plugin/src/ftrace_fs_ops.cpp +++ b/device/plugins/ftrace_plugin/src/ftrace_fs_ops.cpp @@ -32,12 +32,12 @@ FtraceFsOps& FtraceFsOps::GetInstance() FtraceFsOps::FtraceFsOps() : ftraceRoot_(GetFtraceRoot()), hmTraceDir_(GetHmTraceDir()) { - HILOG_INFO(LOG_CORE, "FtraceFsOps create!"); + PROFILER_LOG_INFO(LOG_CORE, "FtraceFsOps create!"); } FtraceFsOps::~FtraceFsOps() { - HILOG_INFO(LOG_CORE, "FtraceFsOps destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "FtraceFsOps destroy!"); } std::string FtraceFsOps::GetFtraceRoot() @@ -299,7 +299,7 @@ std::vector> FtraceFsOps::GetPlatformEvents( AddPlatformEvents(eventSet, ftraceRoot_ + hmTraceDir_ + "/events"); } AddPlatformEvents(eventSet, ftraceRoot_ + "/events"); - HILOG_INFO(LOG_CORE, "get platform event formats done, types: %zu!", eventSet.size()); + PROFILER_LOG_INFO(LOG_CORE, "get platform event formats done, types: %zu!", eventSet.size()); return {eventSet.begin(), eventSet.end()}; } diff --git a/device/plugins/ftrace_plugin/src/ftrace_module.cpp b/device/plugins/ftrace_plugin/src/ftrace_module.cpp index 472d3cc72..c8e854ead 100644 --- a/device/plugins/ftrace_plugin/src/ftrace_module.cpp +++ b/device/plugins/ftrace_plugin/src/ftrace_module.cpp @@ -34,7 +34,7 @@ int TracePluginRegisterWriter(const WriterStruct* writer) g_mainController = std::make_unique(); int result = g_mainController->SetWriter(const_cast(writer)); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); return result; } @@ -43,13 +43,13 @@ int TracePluginStartSession(const uint8_t configData[], const uint32_t configSiz std::unique_lock lock(g_mutex); CHECK_NOTNULL(g_mainController, -1, "%s: no FlowController created!", __func__); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); int retval = g_mainController->LoadConfig(configData, configSize); CHECK_TRUE(retval == 0, retval, "LoadConfig failed!"); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); int result = g_mainController->StartCapture(); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); return result; } @@ -58,9 +58,9 @@ int TracePluginReportBasicData() std::unique_lock lock(g_mutex); CHECK_NOTNULL(g_mainController, -1, "%s: no FlowController created!", __func__); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); g_mainController->SetReportBasicData(true); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); return 0; } @@ -69,9 +69,9 @@ int TracePluginStopSession() std::unique_lock lock(g_mutex); CHECK_NOTNULL(g_mainController, -1, "%s: no FlowController created!", __func__); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); int result = g_mainController->StopCapture(); - HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); + PROFILER_LOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__); g_mainController.reset(); return result; diff --git a/device/plugins/ftrace_plugin/src/ftrace_parser.cpp b/device/plugins/ftrace_plugin/src/ftrace_parser.cpp index d3e3ad4f9..a484ed582 100644 --- a/device/plugins/ftrace_plugin/src/ftrace_parser.cpp +++ b/device/plugins/ftrace_plugin/src/ftrace_parser.cpp @@ -35,7 +35,7 @@ #define HILOG_DEBUG(LOG_CORE, fmt, ...) \ if (debugOn_) { \ - HILOG_INFO(LOG_CORE, ":DEBUG: " fmt, ##__VA_ARGS__); \ + PROFILER_LOG_INFO(LOG_CORE, ":DEBUG: " fmt, ##__VA_ARGS__); \ } namespace { @@ -58,7 +58,7 @@ inline uint64_t GetTimestampIncrements(uint64_t ext) FTRACE_NS_BEGIN FtraceParser::FtraceParser() { - HILOG_INFO(LOG_CORE, "FtraceParser create!"); + PROFILER_LOG_INFO(LOG_CORE, "FtraceParser create!"); } bool FtraceParser::Init() @@ -77,7 +77,7 @@ bool FtraceParser::Init() FtraceParser::~FtraceParser() { - HILOG_INFO(LOG_CORE, "FtraceParser destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "FtraceParser destroy!"); } bool FtraceParser::SetupEvent(const std::string& type, const std::string& name) @@ -142,7 +142,7 @@ bool FtraceParser::ParseHeaderPageFormat(const std::string& formatDesc) } } - HILOG_INFO(LOG_CORE, "page header info:"); + PROFILER_LOG_INFO(LOG_CORE, "page header info:"); PrintFieldInfo(pageHeaderFormat_.timestamp); PrintFieldInfo(pageHeaderFormat_.commit); PrintFieldInfo(pageHeaderFormat_.overwrite); @@ -228,10 +228,10 @@ void FtraceParser::PrintFieldInfo(const FieldFormat& info) { UNUSED_PARAMETER(GetProtoTypeName); UNUSED_PARAMETER(GetFieldTypeName); - HILOG_DEBUG(LOG_CORE, - "FieldFormat { offset: %u, size:%u, sign: %u fieldType: %s, protoType:%s, typeName: %s, name: %s}", - info.offset, info.size, info.isSigned, GetFieldTypeName(info.filedType).c_str(), - GetProtoTypeName(info.protoType).c_str(), info.typeName.c_str(), info.name.c_str()); + PROFILER_LOG_INFO(LOG_CORE, + "FieldFormat { offset: %u, size:%u, sign: %u fieldType: %s, protoType:%s, typeName: %s, name: %s}", + info.offset, info.size, info.isSigned, GetFieldTypeName(info.filedType).c_str(), + GetProtoTypeName(info.protoType).c_str(), info.typeName.c_str(), info.name.c_str()); } static std::string SplitNameFromTypeName(const std::string& typeName) @@ -561,7 +561,7 @@ bool FtraceParser::ParseSavedTgid(const std::string& savedTgid) } if (tgidDict_.size() == 0) { - HILOG_WARN(LOG_CORE, "ParseSavedTgid: parsed tigds: %zu", tgidDict_.size()); + PROFILER_LOG_WARN(LOG_CORE, "ParseSavedTgid: parsed tigds: %zu", tgidDict_.size()); } return true; } @@ -587,7 +587,7 @@ bool FtraceParser::ParseSavedCmdlines(const std::string& savedCmdlines) } if (commDict_.size() == 0) { - HILOG_WARN(LOG_CORE, "ParseSavedCmdlines: parsed cmdlines: %zu", commDict_.size()); + PROFILER_LOG_WARN(LOG_CORE, "ParseSavedCmdlines: parsed cmdlines: %zu", commDict_.size()); } return retval; } @@ -611,7 +611,7 @@ bool FtraceParser::ParseTimeExtend(const FtraceEventHeader& eventHeader) CHECK_TRUE(ReadInc(&cur_, endOfData_, &deltaExt, sizeof(deltaExt)), false, "read time delta failed!"); timestamp_ += GetTimestampIncrements(deltaExt); - HILOG_INFO(LOG_CORE, "ParseTimeExtend: update ts with %u to %" PRIu64, deltaExt, timestamp_); + PROFILER_LOG_INFO(LOG_CORE, "ParseTimeExtend: update ts with %u to %" PRIu64, deltaExt, timestamp_); return true; } @@ -622,7 +622,7 @@ bool FtraceParser::ParseTimeStamp(const FtraceEventHeader& eventHeader) // refers kernel function rb_update_write_stamp in ring_buffer.c timestamp_ = eventHeader.timeDelta + GetTimestampIncrements(deltaExt); - HILOG_INFO(LOG_CORE, "ParseTimeStamp: update ts with %u to %" PRIu64, deltaExt, timestamp_); + PROFILER_LOG_INFO(LOG_CORE, "ParseTimeStamp: update ts with %u to %" PRIu64, deltaExt, timestamp_); return true; } @@ -645,6 +645,6 @@ bool FtraceParser::IsValidIndex(int idx) void FtraceParser::SetDebugOn(bool value) { debugOn_ = value; - HILOG_INFO(LOG_CORE, "debugOption: %s", debugOn_ ? "true" : "false"); + PROFILER_LOG_INFO(LOG_CORE, "debugOption: %s", debugOn_ ? "true" : "false"); } FTRACE_NS_END diff --git a/device/plugins/ftrace_plugin/src/kernel_symbols_parser.cpp b/device/plugins/ftrace_plugin/src/kernel_symbols_parser.cpp index 01a49e4f5..5e02f3a03 100644 --- a/device/plugins/ftrace_plugin/src/kernel_symbols_parser.cpp +++ b/device/plugins/ftrace_plugin/src/kernel_symbols_parser.cpp @@ -30,12 +30,12 @@ constexpr int MAX_BUFFER_SIZE = 10 * 1000; FTRACE_NS_BEGIN KernelSymbolsParser::KernelSymbolsParser() { - HILOG_INFO(LOG_CORE, "KernelSymbolsParser create!"); + PROFILER_LOG_INFO(LOG_CORE, "KernelSymbolsParser create!"); } KernelSymbolsParser::~KernelSymbolsParser() { - HILOG_INFO(LOG_CORE, "KernelSymbolsParser destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "KernelSymbolsParser destroy!"); } void KernelSymbolsParser::Accept(const std::function& visitor) diff --git a/device/plugins/ftrace_plugin/src/paged_mem_pool.cpp b/device/plugins/ftrace_plugin/src/paged_mem_pool.cpp index d3c361abd..2e022ab40 100644 --- a/device/plugins/ftrace_plugin/src/paged_mem_pool.cpp +++ b/device/plugins/ftrace_plugin/src/paged_mem_pool.cpp @@ -30,7 +30,7 @@ FTRACE_NS_BEGIN PagedMemPool::PagedMemPool(size_t pagePerBlock, size_t maxCacheSize) : blockSize_(pagePerBlock * PAGE_SIZE), maxCacheSize_(maxCacheSize) { - HILOG_INFO(LOG_CORE, "PagedMemPool init with %zu ppb, %zu slots!", pagePerBlock, maxCacheSize); + PROFILER_LOG_INFO(LOG_CORE, "PagedMemPool init with %zu ppb, %zu slots!", pagePerBlock, maxCacheSize); } PagedMemPool::~PagedMemPool() @@ -40,7 +40,7 @@ PagedMemPool::~PagedMemPool() Free(*it); it = blockSet_.erase(it); } - HILOG_INFO(LOG_CORE, "PagedMemPool deinit!"); + PROFILER_LOG_INFO(LOG_CORE, "PagedMemPool deinit!"); } size_t PagedMemPool::GetBlockSize() const @@ -60,7 +60,7 @@ void* PagedMemPool::Allocate() block = mmap(nullptr, blockSize_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); CHECK_NOTNULL(block, nullptr, "mmap failed, %d", errno); blockSet_.insert(block); - HILOG_INFO(LOG_CORE, "PagedMemPool::Allocate %zuB block done!", blockSize_); + PROFILER_LOG_INFO(LOG_CORE, "PagedMemPool::Allocate %zuB block done!", blockSize_); return block; } diff --git a/device/plugins/ftrace_plugin/src/printk_formats_parser.cpp b/device/plugins/ftrace_plugin/src/printk_formats_parser.cpp index 8023f8bc6..1d099ad92 100644 --- a/device/plugins/ftrace_plugin/src/printk_formats_parser.cpp +++ b/device/plugins/ftrace_plugin/src/printk_formats_parser.cpp @@ -33,12 +33,12 @@ PrintkFormatsParser& PrintkFormatsParser::GetInstance() PrintkFormatsParser::PrintkFormatsParser() { - HILOG_INFO(LOG_CORE, "PrintkFormatsParser create!"); + PROFILER_LOG_INFO(LOG_CORE, "PrintkFormatsParser create!"); } PrintkFormatsParser::~PrintkFormatsParser() { - HILOG_INFO(LOG_CORE, "PrintkFormatsParser destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "PrintkFormatsParser destroy!"); } std::string PrintkFormatsParser::GetSymbol(uint64_t addr) diff --git a/device/plugins/ftrace_plugin/src/process_utils.cpp b/device/plugins/ftrace_plugin/src/process_utils.cpp index 64b6bcc04..3082587c5 100644 --- a/device/plugins/ftrace_plugin/src/process_utils.cpp +++ b/device/plugins/ftrace_plugin/src/process_utils.cpp @@ -51,7 +51,7 @@ private: int Init() { handler_ = signal(sig_, &PipedSigHandler::SigHandler); - HILOG_INFO(LOG_CORE, "set signal handler for sig %d done!", sig_); + PROFILER_LOG_INFO(LOG_CORE, "set signal handler for sig %d done!", sig_); CHECK_TRUE(pipe(pipe_) != -1, -1, "create pipe failed, %d", errno); CHECK_TRUE(fcntl(pipe_[RD], F_SETFL, O_NONBLOCK) != -1, -1, "set non block to pipe[WR] failed!"); @@ -63,7 +63,7 @@ private: CHECK_TRUE(close(pipe_[RD]) != -1, -1, "close pipe_[RD] failed, %d", errno); CHECK_TRUE(close(pipe_[WR]) != -1, -1, "close pipe_[WR] failed, %d", errno); signal(sig_, nullptr); - HILOG_INFO(LOG_CORE, "restore signal handler for sig %d done!", sig_); + PROFILER_LOG_INFO(LOG_CORE, "restore signal handler for sig %d done!", sig_); return 0; } @@ -90,7 +90,7 @@ struct Poller { pfd.events = events; pollSet_.push_back(pfd); callbacks_[fd] = onEvent; - HILOG_INFO(LOG_CORE, "Add fd %d to poll set done!", fd); + PROFILER_LOG_INFO(LOG_CORE, "Add fd %d to poll set done!", fd); } int PollEvents(int timeout) @@ -98,7 +98,7 @@ struct Poller { int nready = poll(pollSet_.data(), pollSet_.size(), timeout); CHECK_TRUE(nready >= 0, -1, "poll failed, %d", errno); if (nready == 0) { - HILOG_INFO(LOG_CORE, "poll %dms timeout!", timeout); + PROFILER_LOG_INFO(LOG_CORE, "poll %dms timeout!", timeout); return 0; } return nready; @@ -177,14 +177,14 @@ static std::string ReceiveOutputAndSigchld(int pipeFd, const PipedSigHandler& ha childExit = true; int sig = 0; read(handler.GetNotifyFd(), &sig, sizeof(sig)); - HILOG_INFO(LOG_CORE, "sig %d received!", sig); + PROFILER_LOG_INFO(LOG_CORE, "sig %d received!", sig); }); while (!childExit) { int timeout = 1000; int events = poller.PollEvents(timeout); if (events < 0) { - HILOG_INFO(LOG_CORE, "poll failed!"); + PROFILER_LOG_INFO(LOG_CORE, "poll failed!"); break; } poller.DispatchEvents(events); @@ -203,13 +203,13 @@ static int GetProcessExitCode(int pid) int retval = 0; if (WIFEXITED(wstatus)) { retval = WEXITSTATUS(wstatus); - HILOG_INFO(LOG_CORE, "process %d exited with status %d", pid, retval); + PROFILER_LOG_INFO(LOG_CORE, "process %d exited with status %d", pid, retval); } else if (WIFSIGNALED(wstatus)) { retval = -1; - HILOG_INFO(LOG_CORE, "process %d killed by signal %d\n", pid, WTERMSIG(wstatus)); + PROFILER_LOG_INFO(LOG_CORE, "process %d killed by signal %d\n", pid, WTERMSIG(wstatus)); } else { retval = -1; - HILOG_WARN(LOG_CORE, "process %d exited with unknow status!", pid); + PROFILER_LOG_WARN(LOG_CORE, "process %d exited with unknow status!", pid); } return retval; } @@ -224,7 +224,7 @@ int ProcessUtils::Execute(const ExecuteArgs& args, std::string& output) CHECK_TRUE(fcntl(pipeFds[RD], F_SETFL, O_NONBLOCK) != -1, -1, "set non block to pipe[WR] failed!"); std::string cmdline = StringUtils::Join(args.argv_, " "); - HILOG_INFO(LOG_CORE, "ExecuteCommand(%s): prepare ...", cmdline.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "ExecuteCommand(%s): prepare ...", cmdline.c_str()); PipedSigHandler sigChldHandler(SIGCHLD); pid_t pid = fork(); @@ -240,17 +240,17 @@ int ProcessUtils::Execute(const ExecuteArgs& args, std::string& output) output = ReceiveOutputAndSigchld(pipeFds[RD], sigChldHandler); auto lines = StringUtils::Split(output, "\n"); - HILOG_INFO(LOG_CORE, "ExecuteCommand(%s): output %zuB, %zuLn", cmdline.c_str(), output.size(), lines.size()); + PROFILER_LOG_INFO(LOG_CORE, "ExecuteCommand(%s): output %zuB, %zuLn", cmdline.c_str(), output.size(), lines.size()); int retval = GetProcessExitCode(pid); // close pipe fds CHECK_TRUE(close(pipeFds[RD]) != -1, -1, "close pipe[RD] failed, %d", errno); if (retval != 0 && cmdline != "hitrace -l") { - HILOG_ERROR(LOG_CORE, "ExecuteCommand(%s): exit with %d, hitrace output is %s", cmdline.c_str(), + PROFILER_LOG_ERROR(LOG_CORE, "ExecuteCommand(%s): exit with %d, hitrace output is %s", cmdline.c_str(), retval, output.c_str()); } else { - HILOG_INFO(LOG_CORE, "ExecuteCommand(%s): exit with %d", cmdline.c_str(), retval); + PROFILER_LOG_INFO(LOG_CORE, "ExecuteCommand(%s): exit with %d", cmdline.c_str(), retval); } return retval; } diff --git a/device/plugins/ftrace_plugin/src/result_transporter.cpp b/device/plugins/ftrace_plugin/src/result_transporter.cpp index db074d318..b334f5c48 100644 --- a/device/plugins/ftrace_plugin/src/result_transporter.cpp +++ b/device/plugins/ftrace_plugin/src/result_transporter.cpp @@ -35,18 +35,18 @@ ResultTransporter::ResultTransporter(const std::string& name, WriterStructPtr wr ResultTransporter::~ResultTransporter(void) { - HILOG_INFO(LOG_CORE, "ResultTransporter destroy!"); + PROFILER_LOG_INFO(LOG_CORE, "ResultTransporter destroy!"); } void ResultTransporter::SetFlushInterval(int ms) { - HILOG_INFO(LOG_CORE, "ResultTransporter set flush interval to %d", ms); + PROFILER_LOG_INFO(LOG_CORE, "ResultTransporter set flush interval to %d", ms); flushInterval_ = std::chrono::milliseconds(ms); } void ResultTransporter::SetFlushThreshold(uint32_t nbytes) { - HILOG_INFO(LOG_CORE, "ResultTransporter set flush threshold to %u", nbytes); + PROFILER_LOG_INFO(LOG_CORE, "ResultTransporter set flush threshold to %u", nbytes); flushThreshold_ = nbytes; } @@ -91,7 +91,7 @@ void ResultTransporter::Flush() auto count = bytesCount_.load(); auto pending = bytesPending_.load(); bytesPending_ = 0; - HILOG_DEBUG(LOG_CORE, "ResultTransporter TX stats B: %" PRIu64 ", P: %u", count, pending); + PROFILER_LOG_DEBUG(LOG_CORE, "ResultTransporter TX stats B: %" PRIu64 ", P: %u", count, pending); } bool ResultTransporter::Submit(ResultPtr&& packet) @@ -99,7 +99,7 @@ bool ResultTransporter::Submit(ResultPtr&& packet) std::unique_lock lock(mutex_); long nbytes = Write(std::move(packet)); if (nbytes < 0) { - HILOG_ERROR(LOG_CORE, "send result FAILED!"); + PROFILER_LOG_ERROR(LOG_CORE, "send result FAILED!"); lock.unlock(); return false; } diff --git a/device/plugins/ftrace_plugin/src/trace_ops.cpp b/device/plugins/ftrace_plugin/src/trace_ops.cpp index e299b4951..cd8c5b6af 100644 --- a/device/plugins/ftrace_plugin/src/trace_ops.cpp +++ b/device/plugins/ftrace_plugin/src/trace_ops.cpp @@ -70,7 +70,7 @@ std::vector TraceOps::ListCategories() CHECK_TRUE(PrepareListCategoriesCmd(), result, "prepare list categories command failed!"); int retval = ExecuteCommand(true, true); - HILOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); + PROFILER_LOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); std::string line; std::stringstream stream(output_); @@ -116,7 +116,7 @@ bool TraceOps::EnableCategories(const std::vector& categories, int if (HasCategory(category)) { targetCategories_.push_back(category); } else { - HILOG_ERROR(LOG_CORE, "\"%s\" is not support category on this device", category.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "\"%s\" is not support category on this device", category.c_str()); } } @@ -128,7 +128,7 @@ bool TraceOps::EnableCategories(const std::vector& categories, int CHECK_TRUE(PrepareEnableCategoriesCmd(traceTime), false, "prepare enable categories failed!"); int retval = ExecuteCommand(); - HILOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); + PROFILER_LOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); CHECK_TRUE(retval == 0, false, "exec %s failed with %d", bin_.c_str(), retval); return true; } @@ -139,7 +139,7 @@ bool TraceOps::DisableCategories() CHECK_TRUE(PrepareDisableCategoriesCmd(), false, "prepare enable categories failed!"); int retval = ExecuteCommand(); - HILOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); + PROFILER_LOG_INFO(LOG_CORE, "exec %s exit %d!", bin_.c_str(), retval); targetCategories_.clear(); CHECK_TRUE(retval == 0, false, "exec %s failed with %d", bin_.c_str(), retval); diff --git a/device/plugins/ftrace_plugin/test/unittest/printk_formats_parser_test.cpp b/device/plugins/ftrace_plugin/test/unittest/printk_formats_parser_test.cpp index 7d80a89a6..ba9be3804 100644 --- a/device/plugins/ftrace_plugin/test/unittest/printk_formats_parser_test.cpp +++ b/device/plugins/ftrace_plugin/test/unittest/printk_formats_parser_test.cpp @@ -175,7 +175,7 @@ HWTEST_F(PrintkFormatsParserTest, PrintkFormatsParserNormal, TestSize.Level1) for (auto& entry : PrintkFormatsParser::GetInstance().printkFormats_) { uint64_t addr = entry.first; std::string symbol = entry.second; - HILOG_INFO(LOG_CORE, "%" PRIx64 " : %s", addr, symbol.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%" PRIx64 " : %s", addr, symbol.c_str()); } std::string symbol = PrintkFormatsParser::GetInstance().GetSymbol(CPU_ON_ADDR); EXPECT_EQ(symbol, CPU_ON_STR); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_binder_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_binder_event_formatter.cpp index 9d80be455..5754a76eb 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_binder_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_binder_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_alloc_lru_end: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_alloc_lru_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -47,7 +47,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_alloc_lru_start: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_alloc_lru_start) msg had be cut off in outfile"); } return std::string(buffer); @@ -62,7 +62,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_alloc_page_end: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_alloc_page_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -77,7 +77,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_alloc_page_start: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_alloc_page_start) msg had be cut off in outfile"); } return std::string(buffer); @@ -91,7 +91,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_command: cmd=0x%x", msg.cmd()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_command) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_command) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -105,7 +106,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_free_lru_end: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_free_lru_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -120,7 +121,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_free_lru_start: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_free_lru_start) msg had be cut off in outfile"); } return std::string(buffer); @@ -135,7 +136,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_ioctl: cmd=0x%x arg=0x%" PRIx64 "", msg.cmd(), msg.arg()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_ioctl) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_ioctl) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -148,7 +150,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_ioctl_done: ret=%d", msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_ioctl_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_ioctl_done) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -161,7 +164,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_lock: tag=%s", msg.tag().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_lock) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_lock) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -174,7 +178,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_locked: tag=%s", msg.tag().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_locked) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_locked) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -187,7 +192,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_read_done: ret=%d", msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_read_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_read_done) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -200,7 +206,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_return: cmd=0x%x", msg.cmd()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_return) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_return) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -215,7 +222,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "binder_transaction: transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x code=0x%x", msg.debug_id(), msg.target_node(), msg.to_proc(), msg.to_thread(), msg.reply(), msg.flags(), msg.code()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_transaction) msg had be cut off in outfile"); } return std::string(buffer); @@ -232,7 +239,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( " extra_buffers_size=%" PRIu64 "", msg.debug_id(), msg.data_size(), msg.offsets_size(), msg.extra_buffers_size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_alloc_buf) msg had be cut off in outfile"); } return std::string(buffer); @@ -249,7 +256,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( " extra_buffers_size=%" PRIu64 "", msg.debug_id(), msg.data_size(), msg.offsets_size(), msg.extra_buffers_size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_buffer_release) msg had be cut off in outfile"); } return std::string(buffer); @@ -268,7 +275,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( " extra_buffers_size=%" PRIu64 "", msg.debug_id(), msg.data_size(), msg.offsets_size(), msg.extra_buffers_size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_failed_buffer_release) msg had be cut off in " "outfile"); } @@ -285,7 +292,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "binder_transaction_node_to_ref: transaction=%d node=%d src_ptr=0x%016llx ==> dest_ref=%d dest_desc=%d", msg.debug_id(), msg.node_debug_id(), (u64)msg.node_ptr(), msg.ref_debug_id(), msg.ref_desc()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_node_to_ref) msg had be cut off in outfile"); } return std::string(buffer); @@ -300,7 +307,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_transaction_received: transaction=%d", msg.debug_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_received) msg had be cut off in outfile"); } return std::string(buffer); @@ -316,7 +323,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "binder_transaction_ref_to_node: transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ptr=0x%016llx", msg.debug_id(), msg.node_debug_id(), msg.ref_debug_id(), msg.ref_desc(), (u64)msg.node_ptr()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_ref_to_node) msg had be cut off in outfile"); } return std::string(buffer); @@ -333,7 +340,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.debug_id(), msg.node_debug_id(), msg.src_ref_debug_id(), msg.src_ref_desc(), msg.dest_ref_debug_id(), msg.dest_ref_desc()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_transaction_ref_to_ref) msg had be cut off in outfile"); } return std::string(buffer); @@ -347,7 +354,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_unlock: tag=%s", msg.tag().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_unlock) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_unlock) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -361,7 +369,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_unmap_kernel_end: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_unmap_kernel_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -376,7 +384,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_unmap_kernel_start: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_unmap_kernel_start) msg had be cut off in outfile"); } return std::string(buffer); @@ -391,7 +399,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_unmap_user_end: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_unmap_user_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -406,7 +414,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_unmap_user_start: proc=%d page_index=%" PRIu64 "", msg.proc(), msg.page_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_unmap_user_start) msg had be cut off in outfile"); } return std::string(buffer); @@ -422,7 +430,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "binder_update_page_range: proc=%d allocate=%d offset=%" PRIu64 " size=%" PRIu64 "", msg.proc(), msg.allocate(), msg.offset(), msg.size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_update_page_range) msg had be cut off in outfile"); } return std::string(buffer); @@ -438,7 +446,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "binder_wait_for_work: proc_work=%d transaction_stack=%d thread_todo=%d", msg.proc_work(), msg.transaction_stack(), msg.thread_todo()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(binder_wait_for_work) msg had be cut off in outfile"); } return std::string(buffer); @@ -452,7 +460,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "binder_write_done: ret=%d", msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(binder_write_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(binder_write_done) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_block_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_block_event_formatter.cpp index 6b2ae9f94..b11157d9f 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_block_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_block_event_formatter.cpp @@ -33,7 +33,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(block_bio_backmerge) msg had be cut off in outfile"); } return std::string(buffer); @@ -49,7 +49,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_bio_bounce) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_bio_bounce) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -64,7 +65,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.error()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(block_bio_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -81,7 +82,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(block_bio_frontmerge) msg had be cut off in outfile"); } return std::string(buffer); @@ -97,7 +98,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_bio_queue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_bio_queue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -114,7 +116,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.old_dev()) >> 20)), ((unsigned int)((msg.old_dev()) & ((1U << 20) - 1))), msg.old_sector()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_bio_remap) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_bio_remap) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -129,7 +132,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "block_dirty_buffer: %d,%d sector=%" PRIu64 " size=%" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.sector(), msg.size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(block_dirty_buffer) msg had be cut off in outfile"); } return std::string(buffer); @@ -145,7 +148,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_getrq) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_getrq) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -158,7 +162,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "block_plug: [%s]", msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_plug) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(block_plug) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -174,7 +178,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.cmd().c_str(), msg.sector(), msg.nr_sector(), msg.error()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_rq_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_rq_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -190,7 +195,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.bytes(), msg.cmd().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_rq_insert) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_rq_insert) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -206,7 +212,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.bytes(), msg.cmd().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_rq_issue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_rq_issue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -223,7 +230,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.old_dev()) >> 20)), ((unsigned int)((msg.old_dev()) & ((1U << 20) - 1))), msg.old_sector(), msg.nr_bios()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_rq_remap) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_rq_remap) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -239,7 +247,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.cmd().c_str(), msg.sector(), msg.nr_sector(), 0); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_rq_requeue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_rq_requeue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -254,7 +263,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.nr_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_sleeprq) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_sleeprq) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -270,7 +280,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.rwbs().c_str(), msg.sector(), msg.new_sector(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_split) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_split) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -285,7 +296,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "block_touch_buffer: %d,%d sector=%" PRIu64 " size=%" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.sector(), msg.size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(block_touch_buffer) msg had be cut off in outfile"); } return std::string(buffer); @@ -300,7 +311,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "block_unplug: [%s] %d", msg.comm().c_str(), msg.nr_rq()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(block_unplug) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(block_unplug) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cgroup_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cgroup_event_formatter.cpp index fb159fb61..7ec421c2d 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cgroup_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cgroup_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "cgroup_attach_task: dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s", msg.dst_root(), msg.dst_id(), msg.dst_level(), msg.dst_path().c_str(), msg.pid(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(cgroup_attach_task) msg had be cut off in outfile"); } return std::string(buffer); @@ -47,7 +47,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_destroy_root: root=%d ss_mask=%#x name=%s", msg.root(), msg.ss_mask(), msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(cgroup_destroy_root) msg had be cut off in outfile"); } return std::string(buffer); @@ -62,7 +62,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_freeze: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_freeze) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_freeze) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -76,7 +77,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_mkdir: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_mkdir) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_mkdir) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -91,7 +93,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "cgroup_notify_frozen: root=%d id=%d level=%d path=%s val=%d", msg.root(), msg.id(), msg.level(), msg.path().c_str(), msg.val()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(cgroup_notify_frozen) msg had be cut off in outfile"); } return std::string(buffer); @@ -107,7 +109,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "cgroup_notify_populated: root=%d id=%d level=%d path=%s val=%d", msg.root(), msg.id(), msg.level(), msg.path().c_str(), msg.val()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(cgroup_notify_populated) msg had be cut off in outfile"); } return std::string(buffer); @@ -122,7 +124,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_release: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_release) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_release) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -136,7 +139,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_remount: root=%d ss_mask=%#x name=%s", msg.root(), msg.ss_mask(), msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_remount) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_remount) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -150,7 +154,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_rename: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_rename) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_rename) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -164,7 +169,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_rmdir: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_rmdir) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_rmdir) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -178,7 +184,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_setup_root: root=%d ss_mask=%#x name=%s", msg.root(), msg.ss_mask(), msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_setup_root) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_setup_root) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -193,7 +200,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "cgroup_transfer_tasks: dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s", msg.dst_root(), msg.dst_id(), msg.dst_level(), msg.dst_path().c_str(), msg.pid(), msg.comm().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(cgroup_transfer_tasks) msg had be cut off in outfile"); } return std::string(buffer); @@ -208,7 +215,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cgroup_unfreeze: root=%d id=%d level=%d path=%s", msg.root(), msg.id(), msg.level(), msg.path().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cgroup_unfreeze) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cgroup_unfreeze) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_clk_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_clk_event_formatter.cpp index bee79437c..69af49b07 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_clk_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_clk_event_formatter.cpp @@ -30,7 +30,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_disable: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_disable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_disable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -43,7 +44,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_disable_complete: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_disable_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -57,7 +58,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_enable: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_enable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_enable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -70,7 +71,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_enable_complete: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_enable_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -84,7 +85,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_prepare: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_prepare) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_prepare) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -97,7 +99,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_prepare_complete: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_prepare_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -112,7 +114,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_parent: %s %s", msg.name().c_str(), msg.pname().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_set_parent) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_set_parent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -126,7 +129,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_parent_complete: %s %s", msg.name().c_str(), msg.pname().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_set_parent_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -141,7 +144,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_phase: %s %d", msg.name().c_str(), (int)msg.phase()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_set_phase) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_set_phase) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -155,7 +159,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_phase_complete: %s %d", msg.name().c_str(), (int)msg.phase()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_set_phase_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -170,7 +174,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_rate: %s %lu", msg.name().c_str(), (unsigned long)msg.rate()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_set_rate) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_set_rate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -184,7 +189,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_set_rate_complete: %s %lu", msg.name().c_str(), (unsigned long)msg.rate()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_set_rate_complete) msg had be cut off in outfile"); } return std::string(buffer); @@ -198,7 +203,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_unprepare: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clk_unprepare) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(clk_unprepare) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -211,7 +217,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clk_unprepare_complete: %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(clk_unprepare_complete) msg had be cut off in outfile"); } return std::string(buffer); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_compaction_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_compaction_event_formatter.cpp index 42d7f36b7..4ddf13381 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_compaction_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_compaction_event_formatter.cpp @@ -34,7 +34,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( " nr_taken==0x%" PRIu64 "", msg.start_pfn(), msg.end_pfn(), msg.nr_scanned(), msg.nr_taken()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_compaction_isolate_freepages) msg had be cut off in outfile"); } return std::string(buffer); @@ -51,7 +51,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( " nr_taken==0x%" PRIu64 "", msg.start_pfn(), msg.end_pfn(), msg.nr_scanned(), msg.nr_taken()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_compaction_isolate_migratepages) msg had be cut off in outfile"); } return std::string(buffer); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cpuhp_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cpuhp_event_formatter.cpp index e91cfd7ea..c0032678d 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cpuhp_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_cpuhp_event_formatter.cpp @@ -42,7 +42,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.cpu(), msg.target(), msg.idx(), msg.fun()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cpuhp_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cpuhp_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -56,7 +57,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cpuhp_exit: cpu: %04u state: %3d step: %3d ret: %d", msg.cpu(), msg.state(), msg.idx(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cpuhp_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(cpuhp_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -83,7 +84,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.fun()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cpuhp_multi_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(cpuhp_multi_enter) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_dma_fence_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_dma_fence_event_formatter.cpp index c99ed2b34..c7f147008 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_dma_fence_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_dma_fence_event_formatter.cpp @@ -32,7 +32,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_destroy: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(dma_fence_destroy) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(dma_fence_destroy) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -47,7 +48,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_emit: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(dma_fence_emit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(dma_fence_emit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -62,7 +64,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_enable_signal: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(dma_fence_enable_signal) msg had be cut off in outfile"); } return std::string(buffer); @@ -78,7 +80,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_init: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(dma_fence_init) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(dma_fence_init) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -93,7 +96,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_signaled: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(dma_fence_signaled) msg had be cut off in outfile"); } return std::string(buffer); @@ -109,7 +112,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_wait_end: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(dma_fence_wait_end) msg had be cut off in outfile"); } return std::string(buffer); @@ -125,7 +128,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "dma_fence_wait_start: driver=%s timeline=%s context=%u seqno=%u", msg.driver().c_str(), msg.timeline().c_str(), msg.context(), msg.seqno()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(dma_fence_wait_start) msg had be cut off in outfile"); } return std::string(buffer); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ext4_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ext4_event_formatter.cpp index 76bb64331..645830795 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ext4_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ext4_event_formatter.cpp @@ -33,8 +33,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.data_blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_alloc_da_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_alloc_da_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -56,8 +56,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x4000, "STRICT_CHECK"}), msg.len(), msg.block(), msg.logical(), msg.goal(), msg.lleft(), msg.lright(), msg.pleft(), msg.pright()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_allocate_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_allocate_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -73,8 +73,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.dir(), msg.mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_allocate_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_allocate_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -90,8 +90,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.new_size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_begin_ordered_truncate) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_begin_ordered_truncate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -107,8 +107,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.offset(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_collapse_range) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_collapse_range) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -125,8 +125,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.mode(), msg.i_blocks(), msg.freed_blocks(), msg.reserved_data_blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_da_release_space) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_da_release_space) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -142,8 +142,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.mode(), msg.i_blocks(), msg.reserved_data_blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_da_reserve_space) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_da_reserve_space) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -160,8 +160,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.mode(), msg.i_blocks(), msg.used_blocks(), msg.reserved_data_blocks(), msg.quota_claim()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_da_update_reserve_space) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_da_update_reserve_space) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -177,8 +177,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.flags()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_da_write_begin) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_da_write_begin) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -194,7 +194,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.copied()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_da_write_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_da_write_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -211,8 +211,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.first_page(), msg.nr_to_write(), msg.sync_mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_da_write_pages) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_da_write_pages) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -230,8 +230,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.flags(), "", {((((1UL))) << (5)), "N"}, {((((1UL))) << (4)), "M"}, {((((1UL))) << (11)), "U"}, {((((1UL))) << (9)), "B"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_da_write_pages_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_da_write_pages_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -247,8 +247,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.rw()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_direct_IO_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_direct_IO_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -264,8 +264,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.rw(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_direct_IO_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_direct_IO_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -280,8 +280,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_discard_blocks: dev %d,%d blk %" PRIu64 " count %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.blk(), msg.count()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_discard_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_discard_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -296,8 +296,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_discard_preallocations: dev %d,%d ino %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_discard_preallocations) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_discard_preallocations) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -312,7 +312,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.drop()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_drop_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_drop_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -330,8 +330,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags( msg.status(), "", {(1 << 0), "W"}, {(1 << 1), "U"}, {(1 << 2), "D"}, {(1 << 3), "H"}, {(1 << 4), "R"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_es_cache_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_es_cache_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -349,8 +349,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags( msg.status(), "", {(1 << 0), "W"}, {(1 << 1), "U"}, {(1 << 2), "D"}, {(1 << 3), "H"}, {(1 << 4), "R"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_es_insert_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_es_insert_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -365,8 +365,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_es_lookup_extent_enter: dev %d,%d ino %" PRIu64 " lblk %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.lblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_es_lookup_extent_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_es_lookup_extent_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -384,8 +384,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.found() ? msg.status() : 0, "", {(1 << 0), "W"}, {(1 << 1), "U"}, {(1 << 2), "D"}, {(1 << 3), "H"}, {(1 << 4), "R"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_es_lookup_extent_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_es_lookup_extent_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -401,8 +401,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.lblk(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_es_remove_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_es_remove_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -418,7 +418,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.nr_shrunk(), msg.scan_time(), msg.nr_skipped(), msg.retried()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_es_shrink) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_es_shrink) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -433,8 +433,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_es_shrink_count: dev %d,%d nr_to_scan %d cache_cnt %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.nr_to_scan(), msg.cache_cnt()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_es_shrink_count) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_es_shrink_count) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -449,8 +449,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_es_shrink_scan_enter: dev %d,%d nr_to_scan %d cache_cnt %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.nr_to_scan(), msg.cache_cnt()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_es_shrink_scan_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_es_shrink_scan_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -465,8 +465,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_es_shrink_scan_exit: dev %d,%d nr_shrunk %d cache_cnt %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.nr_shrunk(), msg.cache_cnt()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_es_shrink_scan_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_es_shrink_scan_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -481,7 +481,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_evict_inode: dev %d,%d ino %" PRIu64 " nlink %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.nlink()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_evict_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_evict_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -500,8 +500,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.m_lblk(), msg.m_len(), msg.u_lblk(), msg.u_len(), msg.u_pblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ext_convert_to_initialized_enter) msg had be cut off in " + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ext_convert_to_initialized_enter) msg had be cut off in " "outfile"); } return std::string(buffer); @@ -522,8 +522,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.m_lblk(), msg.m_len(), msg.u_lblk(), msg.u_len(), msg.u_pblk(), msg.i_lblk(), msg.i_len(), msg.i_pblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ext_convert_to_initialized_fastpath) msg had be cut off in " + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ext_convert_to_initialized_fastpath) msg had be cut off in " "outfile"); } return std::string(buffer); @@ -545,8 +545,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0100, "CONVERT_UNWRITTEN"}, {0x0200, "ZERO"}, {0x0400, "IO_SUBMIT"}, {0x40000000, "EX_NOCACHE"}), (unsigned int)msg.allocated(), msg.newblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ext_handle_unwritten_extents) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ext_handle_unwritten_extents) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -561,7 +561,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_ext_in_cache: dev %d,%d ino %" PRIu64 " lblk %u ret %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.lblk(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_ext_in_cache) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_ext_in_cache) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -577,8 +577,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.lblk(), msg.pblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ext_load_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ext_load_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -597,8 +597,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0008, "PRE_IO"}, {0x0010, "CONVERT"}, {0x0020, "METADATA_NOFAIL"}, {0x0040, "NO_NORMALIZE"}, {0x0100, "CONVERT_UNWRITTEN"}, {0x0200, "ZERO"}, {0x0400, "IO_SUBMIT"}, {0x40000000, "EX_NOCACHE"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ext_map_blocks_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ext_map_blocks_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -621,8 +621,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {((((1UL))) << (11)), "U"}, {((((1UL))) << (9)), "B"}), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ext_map_blocks_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ext_map_blocks_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -638,8 +638,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.lblk(), msg.len(), msg.start()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ext_put_in_cache) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ext_put_in_cache) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -655,8 +655,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.start(), (unsigned)msg.end(), msg.depth()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ext_remove_space) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ext_remove_space) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -673,8 +673,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.start(), (unsigned)msg.end(), msg.depth(), msg.partial(), (unsigned short)msg.eh_entries()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ext_remove_space_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ext_remove_space_done) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -689,7 +689,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_ext_rm_idx: dev %d,%d ino %" PRIu64 " index_pblk %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pblk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_ext_rm_idx) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_ext_rm_idx) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -706,7 +706,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.start(), (unsigned)msg.ee_lblk(), msg.ee_pblk(), (unsigned short)msg.ee_len(), msg.partial()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_ext_rm_leaf) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_ext_rm_leaf) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -722,8 +722,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.lblk(), msg.pblk(), (unsigned short)msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ext_show_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ext_show_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -741,8 +741,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.mode(), "|", {0x01, "KEEP_SIZE"}, {0x02, "PUNCH_HOLE"}, {0x04, "NO_HIDE_STALE"}, {0x08, "COLLAPSE_RANGE"}, {0x10, "ZERO_RANGE"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_fallocate_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_fallocate_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -758,8 +758,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.blocks(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_fallocate_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_fallocate_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -775,8 +775,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.from(), (unsigned)msg.to(), msg.reverse(), msg.found(), (unsigned)msg.found_blk()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_find_delalloc_range) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_find_delalloc_range) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -792,7 +792,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.mode(), msg.is_metadata(), msg.block()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_forget) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_forget) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -810,7 +810,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.flags(), "|", {0x0001, "METADATA"}, {0x0002, "FORGET"}, {0x0004, "VALIDATED"}, {0x0008, "NO_QUOTA"}, {0x0010, "1ST_CLUSTER"}, {0x0020, "LAST_CLUSTER"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_free_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_free_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -826,7 +826,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.mode(), msg.uid(), msg.gid(), msg.blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_free_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_free_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -847,8 +847,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {((((1UL))) << (11)), "U"}, {((((1UL))) << (9)), "B"}), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_get_implied_cluster_alloc_exit) msg had be cut off in " + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_get_implied_cluster_alloc_exit) msg had be cut off in " "outfile"); } return std::string(buffer); @@ -865,8 +865,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (unsigned)msg.lblk(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_get_reserved_cluster_alloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_get_reserved_cluster_alloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -885,8 +885,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0008, "PRE_IO"}, {0x0010, "CONVERT"}, {0x0020, "METADATA_NOFAIL"}, {0x0040, "NO_NORMALIZE"}, {0x0100, "CONVERT_UNWRITTEN"}, {0x0200, "ZERO"}, {0x0400, "IO_SUBMIT"}, {0x40000000, "EX_NOCACHE"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_ind_map_blocks_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_ind_map_blocks_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -909,8 +909,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {((((1UL))) << (11)), "U"}, {((((1UL))) << (9)), "B"}), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_ind_map_blocks_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_ind_map_blocks_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -926,7 +926,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.offset(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_insert_range) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_insert_range) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -942,8 +942,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.index(), msg.offset(), msg.length()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_invalidatepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_invalidatepage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -958,8 +958,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_journal_start: dev %d,%d blocks %d, rsv_blocks %d, caller %p", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.blocks(), msg.rsv_blocks(), (void*)msg.ip()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_journal_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_journal_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -974,8 +974,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_journal_start_reserved: dev %d,%d blocks, %d caller %p", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.blocks(), (void*)msg.ip()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_journal_start_reserved) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_journal_start_reserved) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -991,8 +991,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.index(), msg.offset(), msg.length()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_journalled_invalidatepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_journalled_invalidatepage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1008,8 +1008,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.copied()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_journalled_write_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_journalled_write_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1023,7 +1023,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_load_inode: dev %d,%d ino %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_load_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_load_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1037,8 +1037,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_load_inode_bitmap: dev %d,%d group %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.group()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_load_inode_bitmap) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_load_inode_bitmap) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1053,8 +1053,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_mark_inode_dirty: dev %d,%d ino %" PRIu64 " caller %p", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), (void*)msg.ip()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mark_inode_dirty) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mark_inode_dirty) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1068,8 +1068,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_mb_bitmap_load: dev %d,%d group %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.group()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mb_bitmap_load) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mb_bitmap_load) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1083,8 +1083,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_mb_buddy_bitmap_load: dev %d,%d group %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.group()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_mb_buddy_bitmap_load) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_mb_buddy_bitmap_load) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1099,8 +1099,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_mb_discard_preallocations: dev %d,%d needed %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.needed()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_mb_discard_preallocations) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_mb_discard_preallocations) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1116,8 +1116,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pa_pstart(), msg.pa_len(), msg.pa_lstart()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mb_new_group_pa) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mb_new_group_pa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1133,8 +1133,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pa_pstart(), msg.pa_len(), msg.pa_lstart()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mb_new_inode_pa) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mb_new_inode_pa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1149,8 +1149,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_mb_release_group_pa: dev %d,%d pstart %" PRIu64 " len %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.pa_pstart(), msg.pa_len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mb_release_group_pa) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mb_release_group_pa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1166,8 +1166,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.block(), msg.count()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mb_release_inode_pa) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mb_release_inode_pa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1192,8 +1192,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x4000, "STRICT_CHECK"}), msg.tail(), msg.buddy() ? 1 << msg.buddy() : 0); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mballoc_alloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mballoc_alloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1209,8 +1209,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.result_group(), msg.result_start(), msg.result_len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mballoc_discard) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mballoc_discard) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1226,7 +1226,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.result_group(), msg.result_start(), msg.result_len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_mballoc_free) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_mballoc_free) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1243,8 +1243,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.orig_group(), msg.orig_start(), msg.orig_len(), msg.orig_logical(), msg.result_group(), msg.result_start(), msg.result_len(), msg.result_logical()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_mballoc_prealloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_mballoc_prealloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1260,8 +1260,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.orig_ino(), msg.ino(), msg.mode(), msg.uid(), msg.gid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_other_inode_update_time) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_other_inode_update_time) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1279,7 +1279,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.mode(), "|", {0x01, "KEEP_SIZE"}, {0x02, "PUNCH_HOLE"}, {0x04, "NO_HIDE_STALE"}, {0x08, "COLLAPSE_RANGE"}, {0x10, "ZERO_RANGE"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_punch_hole) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_punch_hole) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1293,8 +1293,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_read_block_bitmap_load: dev %d,%d group %u", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.group()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(ext4_read_block_bitmap_load) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(ext4_read_block_bitmap_load) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1309,7 +1309,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_readpage: dev %d,%d ino %" PRIu64 " page_index %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_readpage) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_readpage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1324,7 +1324,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_releasepage: dev %d,%d ino %" PRIu64 " page_index %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_releasepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_releasepage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1342,8 +1342,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( (unsigned)msg.ee_lblk(), msg.ee_pblk(), (unsigned short)msg.ee_len(), (unsigned)msg.from(), (unsigned)msg.to(), msg.partial()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_remove_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_remove_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1365,8 +1365,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x4000, "STRICT_CHECK"}), msg.len(), msg.logical(), msg.goal(), msg.lleft(), msg.lright(), msg.pleft(), msg.pright()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_request_blocks) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_request_blocks) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1381,8 +1381,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_request_inode: dev %d,%d dir %" PRIu64 " mode 0%o", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.dir(), msg.mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_request_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_request_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1398,8 +1398,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.parent(), msg.datasync()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_sync_file_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_sync_file_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1414,8 +1414,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_sync_file_exit: dev %d,%d ino %" PRIu64 " ret %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_sync_file_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_sync_file_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1429,7 +1429,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_sync_fs: dev %d,%d wait %d", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.wait()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_sync_fs) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_sync_fs) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1444,8 +1444,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_trim_all_free: dev %d,%d group %u, start %d, len %d", msg.dev_major(), msg.dev_minor(), msg.group(), msg.start(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_trim_all_free) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_trim_all_free) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1460,7 +1460,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ext4_trim_extent: dev %d,%d group %u, start %d, len %d", msg.dev_major(), msg.dev_minor(), msg.group(), msg.start(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_trim_extent) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_trim_extent) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1475,8 +1475,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_truncate_enter: dev %d,%d ino %" PRIu64 " blocks %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_truncate_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_truncate_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1491,8 +1491,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_truncate_exit: dev %d,%d ino %" PRIu64 " blocks %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.blocks()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_truncate_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_truncate_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1508,7 +1508,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.size(), msg.parent()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_unlink_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_unlink_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1523,7 +1523,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_unlink_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_unlink_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1539,7 +1539,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.flags()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_write_begin) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_write_begin) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1555,7 +1555,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.pos(), msg.len(), msg.copied()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_write_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_write_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1570,7 +1570,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "ext4_writepage: dev %d,%d ino %" PRIu64 " page_index %" PRIu64 "", ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_writepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_writepage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1589,7 +1589,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.nr_to_write(), msg.pages_skipped(), msg.range_start(), msg.range_end(), msg.sync_mode(), msg.for_kupdate(), msg.range_cyclic(), msg.writeback_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_writepages) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_writepages) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1606,8 +1606,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), msg.ino(), msg.ret(), msg.pages_written(), msg.pages_skipped(), msg.sync_mode(), msg.writeback_index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(ext4_writepages_result) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(ext4_writepages_result) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -1625,7 +1625,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_flags(msg.mode(), "|", {0x01, "KEEP_SIZE"}, {0x02, "PUNCH_HOLE"}, {0x04, "NO_HIDE_STALE"}, {0x08, "COLLAPSE_RANGE"}, {0x10, "ZERO_RANGE"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ext4_zero_range) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(ext4_zero_range) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_f2fs_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_f2fs_event_formatter.cpp index 5ffa629a1..9ab194292 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_f2fs_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_f2fs_event_formatter.cpp @@ -36,7 +36,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (unsigned long)msg.ino(), (unsigned long)msg.pino(), msg.mode(), msg.size(), (unsigned int)msg.nlink(), msg.blocks(), (unsigned char)msg.advise()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(f2fs_sync_file_enter) msg had be cut off in outfile"); } return std::string(buffer); @@ -59,7 +59,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {CP_SPEC_LOG_NUM, "log type is 2"}, {CP_RECOVER_DIR, "dir needs recovery"}), msg.datasync(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(f2fs_sync_file_exit) msg had be cut off in outfile"); } return std::string(buffer); @@ -76,7 +76,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), (unsigned long)msg.ino(), msg.pos(), msg.len(), msg.flags()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(f2fs_write_begin) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(f2fs_write_begin) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -92,7 +93,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.dev()) >> 20)), ((unsigned int)((msg.dev()) & ((1U << 20) - 1))), (unsigned long)msg.ino(), msg.pos(), msg.len(), msg.copied()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(f2fs_write_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "maybe, the contents of print event(f2fs_write_end) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filelock_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filelock_event_formatter.cpp index 6ab054156..bf9a38e32 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filelock_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filelock_event_formatter.cpp @@ -39,7 +39,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"}), msg.fl_break_time(), msg.fl_downgrade_time()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(break_lease_block) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(break_lease_block) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -61,8 +61,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"}), msg.fl_break_time(), msg.fl_downgrade_time()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(break_lease_noblock) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(break_lease_noblock) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -84,8 +84,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"}), msg.fl_break_time(), msg.fl_downgrade_time()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(break_lease_unblock) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(break_lease_unblock) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -106,7 +106,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {512, "FL_UNLOCK_PENDING"}, {1024, "FL_OFDLCK"}), __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(generic_add_lease) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(generic_add_lease) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -128,8 +128,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"}), msg.fl_break_time(), msg.fl_downgrade_time()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(generic_delete_lease) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(generic_delete_lease) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -151,7 +151,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.fl_type(), {0, "F_RDLCK"}, {1, "F_WRLCK"}, {2, "F_UNLCK"}), msg.fl_break_time(), msg.fl_downgrade_time()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(time_out_leases) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(time_out_leases) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filemap_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filemap_event_formatter.cpp index c76e45935..8de4016de 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filemap_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_filemap_event_formatter.cpp @@ -33,7 +33,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( ((unsigned int)((msg.s_dev()) >> 20)), ((unsigned int)((msg.s_dev()) & ((1U << 20) - 1))), msg.i_ino(), msg.old(), msg.seq_new()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(file_check_and_advance_wb_err) msg had be cut off in outfile"); } return std::string(buffer); @@ -49,7 +49,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "filemap_set_wb_err: dev=%d:%d ino=0x%" PRIx64 " errseq=0x%x", ((unsigned int)((msg.s_dev()) >> 20)), ((unsigned int)((msg.s_dev()) & ((1U << 20) - 1))), msg.i_ino(), msg.errseq()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(filemap_set_wb_err) msg had be cut off in outfile"); } return std::string(buffer); @@ -66,7 +66,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (((msg.s_dev()) >> 20)), (((msg.s_dev()) & ((1U << 20) - 1))), msg.i_ino(), "0000000000000000", msg.pfn(), msg.index() << 12); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_filemap_add_to_page_cache) msg had be cut off in outfile"); } return std::string(buffer); @@ -84,7 +84,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (((msg.s_dev()) >> 20)), (((msg.s_dev()) & ((1U << 20) - 1))), msg.i_ino(), "0000000000000000", msg.pfn(), msg.index() << 12); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_filemap_delete_from_page_cache) msg had be cut off in outfile"); } return std::string(buffer); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ftrace_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ftrace_event_formatter.cpp index c5d494949..8a75712a5 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ftrace_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ftrace_event_formatter.cpp @@ -41,7 +41,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "bputs: %p: %s", (void*)msg.ip(), msg.str().c_str()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(bputs) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(bputs) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -55,7 +55,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "branch: %u:%s:%s (%u)%s", msg.line(), msg.func().c_str(), msg.file().c_str(), msg.correct(), msg.constant() ? " CONSTANT" : ""); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(branch) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(branch) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -70,7 +70,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.prev_pid(), msg.prev_prio(), msg.prev_state(), msg.next_pid(), msg.next_prio(), msg.next_state(), msg.next_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(context_switch) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(context_switch) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -95,7 +95,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "funcgraph_entry: --> %p (%d)", (void*)msg.func(), msg.depth()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(funcgraph_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(funcgraph_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -122,7 +122,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.depth(), msg.calltime(), msg.rettime(), msg.depth()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(funcgraph_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(funcgraph_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -147,7 +147,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "function: %p <-- %p", (void*)msg.ip(), (void*)msg.parent_ip()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(function) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(function) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -182,7 +182,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (void*)msg.caller()[4], (void*)msg.caller()[5], (void*)msg.caller()[6], (void*)msg.caller()[7]); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kernel_stack) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kernel_stack) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -197,7 +197,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mmiotrace_map: %" PRIx64 " %" PRIx64 " %" PRIx64 " %d %x", msg.phys(), msg.virt(), msg.len(), msg.map_id(), msg.opcode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mmiotrace_map) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mmiotrace_map) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -212,7 +212,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "mmiotrace_rw: %" PRIx64 " %" PRIx64 " %" PRIx64 " %d %x %x", msg.phys(), msg.value(), msg.pc(), msg.map_id(), msg.opcode(), msg.width()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mmiotrace_rw) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mmiotrace_rw) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -229,7 +229,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( } int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "print: %s", fieldBuf.c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(print) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(print) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -264,7 +264,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (void*)msg.caller()[4], (void*)msg.caller()[5], (void*)msg.caller()[6], (void*)msg.caller()[7]); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(user_stack) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(user_stack) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -279,7 +279,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "wakeup: %u:%u:%u ==+ %u:%u:%u [%03u]", msg.prev_pid(), msg.prev_prio(), msg.prev_state(), msg.next_pid(), msg.next_prio(), msg.next_state(), msg.next_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(wakeup) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(wakeup) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpio_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpio_event_formatter.cpp index f9e5e3cfa..3de66c90d 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpio_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpio_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "gpio_direction: %u %3s (%d)", msg.gpio(), msg.in() ? "in" : "out", msg.err()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(gpio_direction) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(gpio_direction) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -45,7 +45,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "gpio_value: %u %3s %d", msg.gpio(), msg.get() ? "get" : "set", msg.value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(gpio_value) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(gpio_value) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpu_mem_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpu_mem_event_formatter.cpp index 13f300d73..9c7543184 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpu_mem_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_gpu_mem_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "gpu_mem_total: gpu_id=%u pid=%u size=%" PRIu64 "", msg.gpu_id(), msg.pid(), msg.size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(gpu_mem_total) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(gpu_mem_total) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_i2c_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_i2c_event_formatter.cpp index 916f307e1..8f2431719 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_i2c_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_i2c_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "i2c_read: i2c-%d #%u a=%03x f=%04x l=%u", msg.adapter_nr(), msg.msg_nr(), msg.addr(), msg.flags(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_read) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_read) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -46,7 +46,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "i2c_reply: i2c-%d #%u a=%03x f=%04x l=%" PRId32 " [%" PRId32 "]", msg.adapter_nr(), msg.msg_nr(), msg.addr(), msg.flags(), msg.len(), msg.buf()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_reply) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_reply) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -60,7 +60,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "i2c_result: i2c-%d n=%u ret=%d", msg.adapter_nr(), msg.nr_msgs(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_result) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_result) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -75,7 +75,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "i2c_write: i2c-%d #%u a=%03x f=%04x l=%" PRId32 " [%" PRId32 "]", msg.adapter_nr(), msg.msg_nr(), msg.addr(), msg.flags(), msg.len(), msg.buf()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_write) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(i2c_write) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ipi_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ipi_event_formatter.cpp index 978a72631..b05aec738 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ipi_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_ipi_event_formatter.cpp @@ -30,7 +30,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ipi_entry: (%s)", msg.reason().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -43,7 +43,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ipi_exit: (%s)", msg.reason().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -57,7 +57,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "ipi_raise: target_mask=%" PRIu64 " (%s)", msg.target_cpus(), msg.reason().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_raise) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(ipi_raise) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_irq_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_irq_event_formatter.cpp index a05ea07f4..90686167a 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_irq_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_irq_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "irq_handler_entry: irq=%d name=%s", msg.irq(), msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(irq_handler_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(irq_handler_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -45,7 +45,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "irq_handler_exit: irq=%d ret=%s", msg.irq(), msg.ret() ? "handled" : "unhandled"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(irq_handler_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(irq_handler_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -60,7 +60,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.vec(), {0, "HI"}, {1, "TIMER"}, {2, "NET_TX"}, {3, "NET_RX"}, {4, "BLOCK"}, {5, "IRQ_POLL"}, {6, "TASKLET"}, {7, "SCHED"}, {8, "HRTIMER"}, {9, "RCU"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(softirq_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(softirq_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -75,7 +75,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.vec(), {0, "HI"}, {1, "TIMER"}, {2, "NET_TX"}, {3, "NET_RX"}, {4, "BLOCK"}, {5, "IRQ_POLL"}, {6, "TASKLET"}, {7, "SCHED"}, {8, "HRTIMER"}, {9, "RCU"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(softirq_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(softirq_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -90,7 +90,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.vec(), {0, "HI"}, {1, "TIMER"}, {2, "NET_TX"}, {3, "NET_RX"}, {4, "BLOCK"}, {5, "IRQ_POLL"}, {6, "TASKLET"}, {7, "SCHED"}, {8, "HRTIMER"}, {9, "RCU"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(softirq_raise) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(softirq_raise) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_kmem_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_kmem_event_formatter.cpp index 41f2763be..bc3ebeac6 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_kmem_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_kmem_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "kfree: call_site=%p ptr=%p", msg.call_site(), msg.ptr()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kfree) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kfree) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -104,7 +104,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(unsigned long)((gfp_t)0x800u), "__GFP_KSWAPD_RECLAIM"}) : "none"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kmalloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kmalloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -177,7 +177,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( : "none", msg.node()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kmalloc_node) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kmalloc_node) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -249,7 +249,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(unsigned long)((gfp_t)0x800u), "__GFP_KSWAPD_RECLAIM"}) : "none"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kmem_cache_alloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kmem_cache_alloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -323,8 +323,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( : "none", msg.node()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(kmem_cache_alloc_node) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(kmem_cache_alloc_node) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -338,7 +338,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "kmem_cache_free: call_site=%p ptr=%p", msg.call_site(), msg.ptr()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(kmem_cache_free) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(kmem_cache_free) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -410,7 +410,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(unsigned long)((gfp_t)0x800u), "__GFP_KSWAPD_RECLAIM"}) : "none"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_page_alloc) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mm_page_alloc) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -428,8 +428,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "0000000000000000", msg.pfn(), msg.alloc_order(), msg.fallback_order(), (11 - 1), msg.alloc_migratetype(), msg.fallback_migratetype(), msg.fallback_order() < (11 - 1), msg.change_ownership()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_page_alloc_extfrag) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_page_alloc_extfrag) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -444,8 +444,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "mm_page_alloc_zone_locked: page=%s pfn=%" PRIu64 " order=%u migratetype=%d percpu_refill=%d", "0000000000000000", msg.pfn() != -1UL ? msg.pfn() : 0, msg.order(), msg.migratetype(), msg.order() == 0); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(mm_page_alloc_zone_locked) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(mm_page_alloc_zone_locked) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -459,7 +459,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_page_free: page=%s pfn=%" PRIu64 " order=%d", "0000000000000000", msg.pfn(), msg.order()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_page_free) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mm_page_free) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -473,8 +473,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_page_free_batched: page=%s pfn=%" PRIu64 " order=0", "0000000000000000", msg.pfn()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_page_free_batched) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_page_free_batched) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -489,8 +489,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "mm_page_pcpu_drain: page=%s pfn=%" PRIu64 " order=%d migratetype=%d", "0000000000000000", msg.pfn(), msg.order(), msg.migratetype()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_page_pcpu_drain) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_page_pcpu_drain) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -505,7 +505,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "rss_stat: mm_id=%u curr=%d member=%d size=%" PRIu64 "B", msg.mm_id(), msg.curr(), msg.member(), msg.size()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rss_stat) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rss_stat) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_mmc_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_mmc_event_formatter.cpp index 086e15d09..1ad824b57 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_mmc_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_mmc_event_formatter.cpp @@ -40,7 +40,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.sbc_retries(), msg.bytes_xfered(), msg.data_err(), msg.tag(), msg.can_retune(), msg.doing_retune(), msg.retune_now(), msg.need_retune(), msg.hold_retune(), msg.retune_period()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mmc_request_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mmc_request_done) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -62,7 +62,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.can_retune(), msg.doing_retune(), msg.retune_now(), msg.need_retune(), msg.hold_retune(), msg.retune_period()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mmc_request_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mmc_request_start) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_net_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_net_event_formatter.cpp index 785c05996..7ff2aa4ed 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_net_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_net_event_formatter.cpp @@ -36,8 +36,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.vlan_tci(), msg.protocol(), msg.ip_summed(), msg.hash(), msg.l4_hash(), msg.len(), msg.data_len(), msg.truesize(), msg.mac_header_valid(), msg.mac_header(), msg.nr_frags(), msg.gso_size(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(napi_gro_frags_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(napi_gro_frags_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -56,8 +56,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.vlan_tci(), msg.protocol(), msg.ip_summed(), msg.hash(), msg.l4_hash(), msg.len(), msg.data_len(), msg.truesize(), msg.mac_header_valid(), msg.mac_header(), msg.nr_frags(), msg.gso_size(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(napi_gro_receive_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(napi_gro_receive_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -71,7 +71,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "net_dev_queue: dev=%s skbaddr=%p len=%u", msg.name().c_str(), msg.skbaddr(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(net_dev_queue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(net_dev_queue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -91,8 +91,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.transport_offset_valid(), msg.transport_offset(), msg.tx_flags(), msg.gso_size(), msg.gso_segs(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(net_dev_start_xmit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(net_dev_start_xmit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -106,7 +106,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "net_dev_xmit: dev=%s skbaddr=%p len=%u rc=%d", msg.name().c_str(), msg.skbaddr(), msg.len(), msg.rc()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(net_dev_xmit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(net_dev_xmit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -120,7 +120,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "netif_receive_skb: dev=%s skbaddr=%p len=%u", msg.name().c_str(), msg.skbaddr(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(netif_receive_skb) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(netif_receive_skb) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -139,8 +139,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.vlan_tci(), msg.protocol(), msg.ip_summed(), msg.hash(), msg.l4_hash(), msg.len(), msg.data_len(), msg.truesize(), msg.mac_header_valid(), msg.mac_header(), msg.nr_frags(), msg.gso_size(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(netif_receive_skb_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(netif_receive_skb_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -154,7 +154,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "netif_rx: dev=%s skbaddr=%p len=%u", msg.name().c_str(), msg.skbaddr(), msg.len()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(netif_rx) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(netif_rx) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -173,7 +173,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.vlan_tci(), msg.protocol(), msg.ip_summed(), msg.hash(), msg.l4_hash(), msg.len(), msg.data_len(), msg.truesize(), msg.mac_header_valid(), msg.mac_header(), msg.nr_frags(), msg.gso_size(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(netif_rx_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(netif_rx_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -192,7 +192,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.vlan_tci(), msg.protocol(), msg.ip_summed(), msg.hash(), msg.l4_hash(), msg.len(), msg.data_len(), msg.truesize(), msg.mac_header_valid(), msg.mac_header(), msg.nr_frags(), msg.gso_size(), msg.gso_type()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(netif_rx_ni_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(netif_rx_ni_entry) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_oom_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_oom_event_formatter.cpp index 77600baab..d30082c8b 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_oom_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_oom_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "oom_score_adj_update: pid=%d comm=%s oom_score_adj=%" PRId32 "", msg.pid(), msg.comm().c_str(), msg.oom_score_adj()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( + PROFILER_LOG_WARN( LOG_CORE, "maybe, the contents of print event(oom_score_adj_update) msg had be cut off in outfile"); } return std::string(buffer); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_pagemap_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_pagemap_event_formatter.cpp index 71e6f1545..a494cf50e 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_pagemap_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_pagemap_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_lru_activate: page=%p pfn=%" PRIu64 "", msg.page(), msg.pfn()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_lru_activate) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mm_lru_activate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -47,7 +47,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.flags() & 0x0001u ? "M" : " ", msg.flags() & 0x0002u ? "a" : "f", msg.flags() & 0x0008u ? "s" : " ", msg.flags() & 0x0010u ? "b" : " ", msg.flags() & 0x0020u ? "d" : " ", msg.flags() & 0x0040u ? "B" : " "); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(mm_lru_insertion) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(mm_lru_insertion) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_power_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_power_event_formatter.cpp index e1c7cfcce..69c79fc96 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_power_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_power_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clock_disable: %s state=%lu cpu_id=%lu", msg.name().c_str(), (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clock_disable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(clock_disable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -46,7 +46,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clock_enable: %s state=%lu cpu_id=%lu", msg.name().c_str(), (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clock_enable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(clock_enable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -60,7 +60,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "clock_set_rate: %s state=%lu cpu_id=%lu", msg.name().c_str(), (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(clock_set_rate) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(clock_set_rate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -74,7 +74,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cpu_frequency: state=%lu cpu_id=%lu", (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cpu_frequency) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(cpu_frequency) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -88,8 +88,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cpu_frequency_limits: min=%lu max=%lu cpu_id=%lu", (unsigned long)msg.min_freq(), (unsigned long)msg.max_freq(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(cpu_frequency_limits) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(cpu_frequency_limits) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -103,7 +103,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "cpu_idle: state=%lu cpu_id=%lu", (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(cpu_idle) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(cpu_idle) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -120,8 +120,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS"}), msg.new_value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(dev_pm_qos_add_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(dev_pm_qos_add_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -138,8 +138,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS"}), msg.new_value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(dev_pm_qos_remove_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(dev_pm_qos_remove_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -156,8 +156,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS"}), msg.new_value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(dev_pm_qos_update_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(dev_pm_qos_update_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -171,8 +171,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "device_pm_callback_end: %s %s, err=%d", msg.driver().c_str(), msg.device().c_str(), msg.error()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(device_pm_callback_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(device_pm_callback_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -190,8 +190,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0008, "quiesce"}, {0x0004, "hibernate"}, {0x0020, "thaw"}, {0x0040, "restore"}, {0x0080, "recover"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(device_pm_callback_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(device_pm_callback_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -205,8 +205,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "pm_qos_add_request: CPU_DMA_LATENCY value=%d", msg.value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(pm_qos_add_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(pm_qos_add_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -220,8 +220,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "pm_qos_remove_request: CPU_DMA_LATENCY value=%d", msg.value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(pm_qos_remove_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(pm_qos_remove_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -238,8 +238,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {PM_QOS_REMOVE_REQ, "REMOVE_REQ"}), msg.prev_value(), msg.curr_value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(pm_qos_update_flags) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(pm_qos_update_flags) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -253,8 +253,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "pm_qos_update_request: CPU_DMA_LATENCY value=%d", msg.value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(pm_qos_update_request) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(pm_qos_update_request) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -271,8 +271,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {PM_QOS_REMOVE_REQ, "REMOVE_REQ"}), msg.prev_value(), msg.curr_value()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(pm_qos_update_target) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(pm_qos_update_target) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -286,8 +286,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "power_domain_target: %s state=%lu cpu_id=%lu", msg.name().c_str(), (unsigned long)msg.state(), (unsigned long)msg.cpu_id()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(power_domain_target) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(power_domain_target) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -305,7 +305,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( (unsigned long)msg.to(), msg.mperf(), msg.aperf(), msg.tsc(), (unsigned long)msg.freq(), (unsigned long)msg.io_boost()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(pstate_sample) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(pstate_sample) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -319,7 +319,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "suspend_resume: %s[%u] %s", msg.action().c_str(), (unsigned int)msg.val(), (msg.start()) ? "begin" : "end"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(suspend_resume) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(suspend_resume) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -333,8 +333,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "wakeup_source_activate: %s state=0x%" PRIx64 "", msg.name().c_str(), msg.state()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(wakeup_source_activate) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(wakeup_source_activate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -348,8 +348,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "wakeup_source_deactivate: %s state=0x%" PRIx64 "", msg.name().c_str(), msg.state()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(wakeup_source_deactivate) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(wakeup_source_deactivate) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_printk_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_printk_event_formatter.cpp index 8086ac8e2..10d05cf94 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_printk_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_printk_event_formatter.cpp @@ -30,7 +30,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "console: %s", msg.msg().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(console) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(console) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_raw_syscalls_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_raw_syscalls_event_formatter.cpp index e58e50851..4a5d65c37 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_raw_syscalls_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_raw_syscalls_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "sys_enter: NR %" PRIu64 " (%" PRIx64 ", %" PRIx64 ", %" PRIx64 ", %" PRIx64 ", %" PRIx64 ", %" PRIx64 ")", msg.id(), msg.args()[0], msg.args()[1], msg.args()[2], msg.args()[3], msg.args()[4], msg.args()[5]); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sys_enter) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(sys_enter) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -46,7 +46,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sys_exit: NR %" PRIu64 " = %" PRIu64 "", msg.id(), msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sys_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event(sys_exit) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_rcu_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_rcu_event_formatter.cpp index d9a3a1731..4307fa431 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_rcu_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_rcu_event_formatter.cpp @@ -30,7 +30,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "rcu_utilization: %s", msg.s().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rcu_utilization) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rcu_utilization) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_regulator_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_regulator_event_formatter.cpp index cfdc2c3c8..5ac9b8585 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_regulator_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_regulator_event_formatter.cpp @@ -31,8 +31,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_bypass_disable: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(regulator_bypass_disable) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(regulator_bypass_disable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -46,8 +46,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_bypass_disable_complete: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(regulator_bypass_disable_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(regulator_bypass_disable_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -61,8 +61,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_bypass_enable: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(regulator_bypass_enable) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(regulator_bypass_enable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -76,8 +76,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_bypass_enable_complete: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(regulator_bypass_enable_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(regulator_bypass_enable_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -90,7 +90,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_disable: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(regulator_disable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(regulator_disable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -104,8 +104,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_disable_complete: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(regulator_disable_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(regulator_disable_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -118,7 +118,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_enable: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(regulator_enable) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(regulator_enable) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -132,8 +132,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_enable_complete: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(regulator_enable_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(regulator_enable_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -147,8 +147,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_enable_delay: name=%s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(regulator_enable_delay) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(regulator_enable_delay) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -162,8 +162,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_set_voltage: name=%s (%d-%d)", msg.name().c_str(), (int)msg.min(), (int)msg.max()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(regulator_set_voltage) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(regulator_set_voltage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -177,8 +177,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "regulator_set_voltage_complete: name=%s, val=%u", msg.name().c_str(), (int)msg.val()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(regulator_set_voltage_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(regulator_set_voltage_complete) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sched_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sched_event_formatter.cpp index f7a899e4e..9bae70b39 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sched_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sched_event_formatter.cpp @@ -31,8 +31,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_blocked_reason: pid=%d iowait=%d caller=%p", msg.pid(), msg.io_wait(), msg.caller()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_blocked_reason) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_blocked_reason) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -46,8 +46,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_kthread_stop: comm=%s pid=%d", msg.comm().c_str(), msg.pid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_kthread_stop) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_kthread_stop) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -60,8 +60,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_kthread_stop_ret: ret=%d", msg.ret()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_kthread_stop_ret) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_kthread_stop_ret) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -76,8 +76,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "sched_migrate_task: comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", msg.comm().c_str(), msg.pid(), msg.prio(), msg.orig_cpu(), msg.dest_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_migrate_task) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_migrate_task) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -92,7 +92,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "sched_move_numa: pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", msg.pid(), msg.tgid(), msg.ngid(), msg.src_cpu(), msg.src_nid(), msg.dst_cpu(), msg.dst_nid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_move_numa) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_move_numa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -107,7 +107,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_pi_setprio: comm=%s pid=%d oldprio=%d newprio=%d", msg.comm().c_str(), msg.pid(), msg.oldprio(), msg.newprio()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_pi_setprio) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_pi_setprio) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -121,8 +121,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_process_exec: filename=%s pid=%d old_pid=%d", msg.filename().c_str(), msg.pid(), msg.old_pid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_process_exec) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_process_exec) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -136,8 +136,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_process_exit: comm=%s pid=%d prio=%d", msg.comm().c_str(), msg.pid(), msg.prio()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_process_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_process_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -152,8 +152,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "sched_process_fork: comm=%s pid=%d child_comm=%s child_pid=%d", msg.parent_comm().c_str(), msg.parent_pid(), msg.child_comm().c_str(), msg.child_pid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_process_fork) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_process_fork) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -167,8 +167,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_process_free: comm=%s pid=%d prio=%d", msg.comm().c_str(), msg.pid(), msg.prio()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_process_free) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_process_free) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -182,8 +182,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_process_wait: comm=%s pid=%d prio=%d", msg.comm().c_str(), msg.pid(), msg.prio()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_process_wait) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_process_wait) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -197,8 +197,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_stat_blocked: comm=%s pid=%d delay=%" PRIu64 " [ns]", msg.comm().c_str(), msg.pid(), msg.delay()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_stat_blocked) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_stat_blocked) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -212,7 +212,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_stat_iowait: comm=%s pid=%d delay=%" PRIu64 " [ns]", msg.comm().c_str(), msg.pid(), msg.delay()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_stat_iowait) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_stat_iowait) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -227,8 +227,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "sched_stat_runtime: comm=%s pid=%d runtime=%" PRIu64 " [ns] vruntime=%" PRIu64 " [ns]", msg.comm().c_str(), msg.pid(), msg.runtime(), msg.vruntime()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(sched_stat_runtime) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(sched_stat_runtime) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -242,7 +242,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_stat_sleep: comm=%s pid=%d delay=%" PRIu64 " [ns]", msg.comm().c_str(), msg.pid(), msg.delay()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_stat_sleep) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_stat_sleep) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -256,7 +256,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_stat_wait: comm=%s pid=%d delay=%" PRIu64 " [ns]", msg.comm().c_str(), msg.pid(), msg.delay()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_stat_wait) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_stat_wait) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -273,7 +273,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.pid(), msg.tgid(), msg.ngid(), msg.src_cpu(), msg.src_nid(), msg.pid(), msg.tgid(), msg.ngid(), msg.dst_cpu(), msg.dst_nid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_stick_numa) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_stick_numa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -290,7 +290,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.src_pid(), msg.src_tgid(), msg.src_ngid(), msg.src_cpu(), msg.src_nid(), msg.dst_pid(), msg.dst_tgid(), msg.dst_ngid(), msg.dst_cpu(), msg.dst_nid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_swap_numa) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_swap_numa) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -328,7 +328,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.next_comm().c_str(), msg.next_pid(), msg.next_prio()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_switch) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_switch) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -342,7 +342,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_wait_task: comm=%s pid=%d prio=%d", msg.comm().c_str(), msg.pid(), msg.prio()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_wait_task) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_wait_task) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -355,8 +355,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_wake_idle_without_ipi: cpu=%d", msg.cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(sched_wake_idle_without_ipi) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(sched_wake_idle_without_ipi) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -371,7 +371,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_wakeup: comm=%s pid=%d prio=%d target_cpu=%03d", msg.comm().c_str(), msg.pid(), msg.prio(), msg.target_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_wakeup) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_wakeup) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -386,7 +386,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_wakeup_new: comm=%s pid=%d prio=%d target_cpu=%03d", msg.comm().c_str(), msg.pid(), msg.prio(), msg.target_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_wakeup_new) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_wakeup_new) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -401,7 +401,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "sched_waking: comm=%s pid=%d prio=%d target_cpu=%03d", msg.comm().c_str(), msg.pid(), msg.prio(), msg.target_cpu()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(sched_waking) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(sched_waking) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_signal_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_signal_event_formatter.cpp index bbe140dba..082ec4981 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_signal_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_signal_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "signal_deliver: sig=%d errno=%d code=%d sa_handler=%" PRIx64 " sa_flags=%" PRIx64 "", msg.sig(), msg.error_code(), msg.code(), msg.sig_handler(), msg.sig_flags()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(signal_deliver) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(signal_deliver) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -47,7 +47,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "signal_generate: sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d", msg.sig(), msg.error_code(), msg.code(), msg.comm().c_str(), msg.pid(), msg.group(), msg.result()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(signal_generate) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(signal_generate) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sunrpc_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sunrpc_event_formatter.cpp index da63774b2..1f64f33de 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sunrpc_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_sunrpc_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "rpc_call_status: task:%u@%u status=%d", msg.task_id(), msg.client_id(), msg.status()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_call_status) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_call_status) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -45,8 +45,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "rpc_connect_status: task:%u@%u status=%d", msg.task_id(), msg.client_id(), msg.status()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(rpc_connect_status) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(rpc_connect_status) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -67,7 +67,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_socket_close) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_socket_close) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -88,8 +88,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(rpc_socket_connect) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(rpc_socket_connect) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -110,7 +110,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_socket_error) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_socket_error) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -131,8 +131,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(rpc_socket_reset_connection) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(rpc_socket_reset_connection) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -153,8 +153,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(rpc_socket_shutdown) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(rpc_socket_shutdown) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -175,8 +175,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {5, "FIN_WAIT2"}, {6, "TIME_WAIT"}, {7, "CLOSE"}, {8, "CLOSE_WAIT"}, {9, "LAST_ACK"}, {10, "LISTEN"}, {11, "CLOSING"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(rpc_socket_state_change) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(rpc_socket_state_change) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -217,7 +217,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.status(), msg.action()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_task_begin) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_task_begin) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -260,7 +260,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.status(), msg.action()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_task_complete) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_task_complete) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -303,8 +303,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.status(), msg.action()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(rpc_task_run_action) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(rpc_task_run_action) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -327,7 +327,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1UL << 6), "SIGNALLED"}), msg.status(), msg.timeout(), msg.q_name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_task_sleep) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_task_sleep) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -350,7 +350,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1UL << 6), "SIGNALLED"}), msg.status(), msg.timeout(), msg.q_name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(rpc_task_wakeup) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(rpc_task_wakeup) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -369,7 +369,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1UL << 10), "XPT_LISTENER"}, {(1UL << 11), "XPT_CACHE_AUTH"}, {(1UL << 12), "XPT_LOCAL"}, {(1UL << 13), "XPT_KILL_TEMP"}, {(1UL << 14), "XPT_CONG_CTRL"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_handle_xprt) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_handle_xprt) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -384,7 +384,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "svc_process: addr=%s xid=0x%08x service=%s vers=%u proc=%u", msg.addr().c_str(), msg.xid(), msg.service().c_str(), msg.vers(), msg.proc()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_process) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_process) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -402,7 +402,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {((((1UL))) << ((4))), "SPLICE_OK"}, {((((1UL))) << ((5))), "VICTIM"}, {((((1UL))) << ((6))), "BUSY"}, {((((1UL))) << ((7))), "DATA"}, {((((1UL))) << ((8))), "AUTHERR"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_recv) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_recv) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -420,7 +420,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {((((1UL))) << ((4))), "SPLICE_OK"}, {((((1UL))) << ((5))), "VICTIM"}, {((((1UL))) << ((6))), "BUSY"}, {((((1UL))) << ((7))), "DATA"}, {((((1UL))) << ((8))), "AUTHERR"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_send) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_send) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -433,7 +433,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "svc_wake_up: pid=%d", msg.pid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_wake_up) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_wake_up) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -453,7 +453,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1UL << 13), "XPT_KILL_TEMP"}, {(1UL << 14), "XPT_CONG_CTRL"}), msg.wakeup()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(svc_xprt_dequeue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(svc_xprt_dequeue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -472,8 +472,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1UL << 10), "XPT_LISTENER"}, {(1UL << 11), "XPT_CACHE_AUTH"}, {(1UL << 12), "XPT_LOCAL"}, {(1UL << 13), "XPT_KILL_TEMP"}, {(1UL << 14), "XPT_CONG_CTRL"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(svc_xprt_do_enqueue) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(svc_xprt_do_enqueue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -488,7 +488,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "xprt_lookup_rqst: peer=[%s]:%s xid=0x%08x status=%d", msg.addr().c_str(), msg.port().c_str(), msg.xid(), msg.status()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(xprt_lookup_rqst) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(xprt_lookup_rqst) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -502,7 +502,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "xprt_transmit: xid=0x%08x status=%d", msg.xid(), msg.status()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(xprt_transmit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(xprt_transmit) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_task_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_task_event_formatter.cpp index f7e2bcd6c..20a5e7b12 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_task_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_task_event_formatter.cpp @@ -32,7 +32,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "task_newtask: pid=%d comm=%s clone_flags=%" PRIx64 " oom_score_adj=%d", msg.pid(), msg.comm().c_str(), msg.clone_flags(), msg.oom_score_adj()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(task_newtask) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(task_newtask) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -47,7 +47,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "task_rename: pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d", msg.pid(), msg.oldcomm().c_str(), msg.newcomm().c_str(), msg.oom_score_adj()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(task_rename) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(task_rename) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_timer_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_timer_event_formatter.cpp index 8a53e8158..40457e1c4 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_timer_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_timer_event_formatter.cpp @@ -31,7 +31,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "hrtimer_cancel: hrtimer=%p", msg.hrtimer()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(hrtimer_cancel) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(hrtimer_cancel) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -58,8 +58,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.now()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(hrtimer_expire_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(hrtimer_expire_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -72,8 +72,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "hrtimer_expire_exit: hrtimer=%p", msg.hrtimer()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(hrtimer_expire_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(hrtimer_expire_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -93,7 +93,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {HRTIMER_MODE_ABS_SOFT, "ABS|SOFT"}, {HRTIMER_MODE_REL_SOFT, "REL|SOFT"}, {HRTIMER_MODE_ABS_PINNED_SOFT, "ABS|PINNED|SOFT"}, {HRTIMER_MODE_REL_PINNED_SOFT, "REL|PINNED|SOFT"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(hrtimer_init) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(hrtimer_init) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -130,7 +130,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {HRTIMER_MODE_REL_PINNED_SOFT, "REL|PINNED|SOFT"})); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(hrtimer_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(hrtimer_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -144,7 +144,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "itimer_expire: which=%d pid=%d now=%" PRIu64 "", msg.which(), (int)msg.pid(), msg.now()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(itimer_expire) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(itimer_expire) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -159,7 +159,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( "itimer_state: which=%d expires=%" PRIu64 " it_value=%" PRIu64 "it_interval=%" PRIu64 "", msg.which(), msg.expires(), msg.value_sec(), msg.interval_sec()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(itimer_state) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(itimer_state) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -172,7 +172,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "timer_cancel: timer=%p", msg.timer()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(timer_cancel) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(timer_cancel) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -198,8 +198,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "timer_expire_entry: timer=%p function=%p now=%" PRIu64 "", msg.timer(), msg.function(), msg.now()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(timer_expire_entry) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(timer_expire_entry) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -212,7 +212,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "timer_expire_exit: timer=%p", msg.timer()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(timer_expire_exit) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(timer_expire_exit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -225,7 +225,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "timer_init: timer=%p", msg.timer()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(timer_init) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(timer_init) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -258,7 +258,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x00080000, "D"}, {0x00100000, "P"}, {0x00200000, "I"})); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(timer_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(timer_start) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_v4l2_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_v4l2_event_formatter.cpp index f62c0837c..1f6f77cf3 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_v4l2_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_v4l2_event_formatter.cpp @@ -54,7 +54,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(v4l2_dqbuf) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(v4l2_dqbuf) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -90,7 +90,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(v4l2_qbuf) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(v4l2_qbuf) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -121,7 +121,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(vb2_v4l2_buf_done) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(vb2_v4l2_buf_done) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -152,8 +152,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(vb2_v4l2_buf_queue) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(vb2_v4l2_buf_queue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -184,7 +184,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(vb2_v4l2_dqbuf) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(vb2_v4l2_dqbuf) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -215,7 +215,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.timecode_userbits0(), msg.timecode_userbits1(), msg.timecode_userbits2(), msg.timecode_userbits3(), msg.sequence()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(vb2_v4l2_qbuf) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(vb2_v4l2_qbuf) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_vmscan_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_vmscan_event_formatter.cpp index 4aec05cd5..52f3bda6d 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_vmscan_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_vmscan_event_formatter.cpp @@ -34,8 +34,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( " total_scan %" PRIu64 " last shrinker return val %d", msg.shrink(), msg.shr(), msg.nid(), msg.unused_scan(), msg.new_scan(), msg.total_scan(), msg.retval()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_shrink_slab_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_shrink_slab_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -109,8 +109,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( : "none", msg.cache_items(), msg.delta(), msg.total_scan(), msg.priority()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_shrink_slab_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_shrink_slab_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -181,8 +181,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(unsigned long)((gfp_t)0x800u), "__GFP_KSWAPD_RECLAIM"}) : "none"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(mm_vmscan_direct_reclaim_begin) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(mm_vmscan_direct_reclaim_begin) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -196,8 +196,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_vmscan_direct_reclaim_end: nr_reclaimed=%" PRIu64 "", msg.nr_reclaimed()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(mm_vmscan_direct_reclaim_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(mm_vmscan_direct_reclaim_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -210,8 +210,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_vmscan_kswapd_sleep: nid=%d", msg.nid()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_vmscan_kswapd_sleep) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_vmscan_kswapd_sleep) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -225,8 +225,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s( buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "mm_vmscan_kswapd_wake: nid=%d order=%d", msg.nid(), msg.order()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_vmscan_kswapd_wake) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_vmscan_kswapd_wake) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -245,8 +245,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( __print_symbolic(msg.lru(), {0, "inactive_anon"}, {1, "active_anon"}, {2, "inactive_file"}, {3, "active_file"}, {4, "unevictable"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_vmscan_lru_isolate) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_vmscan_lru_isolate) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -268,8 +268,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0010u, "RECLAIM_WB_MIXED"}, {0x0004u, "RECLAIM_WB_SYNC"}, {0x0008u, "RECLAIM_WB_ASYNC"}) : "RECLAIM_WB_NONE"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(mm_vmscan_lru_shrink_inactive) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(mm_vmscan_lru_shrink_inactive) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -340,8 +340,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(unsigned long)((gfp_t)0x800u), "__GFP_KSWAPD_RECLAIM"}) : "none"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_vmscan_wakeup_kswapd) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_vmscan_wakeup_kswapd) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -359,8 +359,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {0x0010u, "RECLAIM_WB_MIXED"}, {0x0004u, "RECLAIM_WB_SYNC"}, {0x0008u, "RECLAIM_WB_ASYNC"}) : "RECLAIM_WB_NONE"); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(mm_vmscan_writepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(mm_vmscan_writepage) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_workqueue_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_workqueue_event_formatter.cpp index 302951545..ad1ca744a 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_workqueue_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_workqueue_event_formatter.cpp @@ -31,8 +31,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "workqueue_activate_work: work struct %p", msg.work()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(workqueue_activate_work) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(workqueue_activate_work) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -45,8 +45,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "workqueue_execute_end: work struct %p", msg.work()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(workqueue_execute_end) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(workqueue_execute_end) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -71,8 +71,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "workqueue_execute_start: work struct %p: function %p", msg.work(), msg.function()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(workqueue_execute_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(workqueue_execute_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -99,8 +99,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.function(), msg.workqueue(), msg.req_cpu(), msg.cpu()); } if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(workqueue_queue_work) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(workqueue_queue_work) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_writeback_event_formatter.cpp b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_writeback_event_formatter.cpp index fb46f4635..5e8b193e6 100755 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_writeback_event_formatter.cpp +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/event_formatters/ftrace_writeback_event_formatter.cpp @@ -38,8 +38,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.dirty_ratelimit(), msg.task_ratelimit(), msg.dirtied(), msg.dirtied_pause(), msg.paused(), msg.pause(), msg.period(), msg.think(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(balance_dirty_pages) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(balance_dirty_pages) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -57,8 +57,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.bdi().c_str(), msg.write_bw(), msg.avg_write_bw(), msg.dirty_rate(), msg.dirty_ratelimit(), msg.task_ratelimit(), msg.balanced_dirty_ratelimit(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(bdi_dirty_ratelimit) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(bdi_dirty_ratelimit) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -75,8 +75,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.nr_dirty(), msg.nr_writeback(), msg.background_thresh(), msg.dirty_thresh(), msg.dirty_limit(), msg.nr_dirtied(), msg.nr_written()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(global_dirty_state) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(global_dirty_state) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -94,7 +94,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.for_background(), msg.for_reclaim(), msg.range_cyclic(), msg.range_start(), msg.range_end(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(wbc_writepage) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(wbc_writepage) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -108,8 +108,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "writeback_bdi_register: bdi %s", msg.name().c_str()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_bdi_register) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_bdi_register) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -123,8 +123,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "writeback_congestion_wait: usec_timeout=%u usec_delayed=%u", msg.usec_timeout(), msg.usec_delayed()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_congestion_wait) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_congestion_wait) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -144,8 +144,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 2), "I_DIRTY_PAGES"}, {(1 << 3), "I_NEW"}, {(1 << 4), "I_WILL_FREE"}, {(1 << 5), "I_FREEING"}, {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_dirty_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_dirty_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -165,8 +165,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"}), msg.mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_dirty_inode_enqueue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_dirty_inode_enqueue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -186,8 +186,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 2), "I_DIRTY_PAGES"}, {(1 << 3), "I_NEW"}, {(1 << 4), "I_WILL_FREE"}, {(1 << 5), "I_FREEING"}, {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_dirty_inode_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_dirty_inode_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -202,8 +202,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "writeback_dirty_page: bdi %s: ino=%" PRIu64 " index=%" PRIu64 "", msg.name().c_str(), msg.ino(), msg.index()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_dirty_page) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_dirty_page) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -224,7 +224,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(writeback_exec) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(writeback_exec) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -244,8 +244,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"}), msg.mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_lazytime) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_lazytime) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -265,8 +265,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"}), msg.mode()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_lazytime_iput) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_lazytime_iput) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -286,8 +286,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 2), "I_DIRTY_PAGES"}, {(1 << 3), "I_NEW"}, {(1 << 4), "I_WILL_FREE"}, {(1 << 5), "I_FREEING"}, {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"})); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_mark_inode_dirty) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_mark_inode_dirty) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -300,8 +300,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( char buffer[BUFFER_SIZE]; int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "writeback_pages_written: %" PRIu64 "", msg.pages()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_pages_written) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_pages_written) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -322,7 +322,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(writeback_queue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(writeback_queue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -340,8 +340,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_queue_io) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_queue_io) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -361,8 +361,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( {(1 << 6), "I_CLEAR"}, {(1 << 7), "I_SYNC"}, {(1 << 11), "I_DIRTY_TIME"}, {(1 << 8), "I_REFERENCED"}), msg.dirtied_when(), (jiffies - msg.dirtied_when()) / 300, msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_sb_inodes_requeue) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_sb_inodes_requeue) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -383,8 +383,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.dirtied_when(), (jiffies - msg.dirtied_when()) / 300, msg.writeback_index(), msg.nr_to_write(), msg.wrote(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_single_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_single_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -405,8 +405,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( msg.dirtied_when(), (jiffies - msg.dirtied_when()) / 300, msg.writeback_index(), msg.nr_to_write(), msg.wrote(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_single_inode_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_single_inode_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -427,7 +427,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(writeback_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(writeback_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -448,7 +448,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(writeback_wait) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(writeback_wait) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -462,8 +462,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "writeback_wait_iff_congested: usec_timeout=%u usec_delayed=%u", msg.usec_timeout(), msg.usec_delayed()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_wait_iff_congested) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_wait_iff_congested) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -477,8 +477,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( int len = snprintf_s(buffer, BUFFER_SIZE, BUFFER_SIZE - 1, "writeback_wake_background: bdi %s: cgroup_ino=%" PRId32 "", msg.name().c_str(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_wake_background) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_wake_background) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -493,8 +493,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "writeback_write_inode: bdi %s: ino=%" PRIu64 " sync_mode=%d cgroup_ino=%" PRId32 "", msg.name().c_str(), msg.ino(), msg.sync_mode(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN( - LOG_CORE, "maybe, the contents of print event(writeback_write_inode) msg had be cut off in outfile"); + PROFILER_LOG_WARN( + LOG_CORE, "the contents of print event(writeback_write_inode) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -509,8 +509,8 @@ REGISTER_FTRACE_EVENT_FORMATTER( "writeback_write_inode_start: bdi %s: ino=%" PRIu64 " sync_mode=%d cgroup_ino=%" PRId32 "", msg.name().c_str(), msg.ino(), msg.sync_mode(), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, - "maybe, the contents of print event(writeback_write_inode_start) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, + "the contents of print event(writeback_write_inode_start) msg had be cut off in outfile"); } return std::string(buffer); }); @@ -531,7 +531,7 @@ REGISTER_FTRACE_EVENT_FORMATTER( {4, "laptop_timer"}, {5, "fs_free_space"}, {6, "forker_thread"}), msg.cgroup_ino()); if (len >= BUFFER_SIZE - 1) { - HILOG_WARN(LOG_CORE, "maybe, the contents of print event(writeback_written) msg had be cut off in outfile"); + PROFILER_LOG_WARN(LOG_CORE, "the contents of print event(writeback_written) msg had be cut off in outfile"); } return std::string(buffer); }); diff --git a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/ftrace_cpp_generator.py b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/ftrace_cpp_generator.py index b72b56d34..fec825e63 100644 --- a/device/plugins/ftrace_plugin/tools/device_kernel_version/default/ftrace_cpp_generator.py +++ b/device/plugins/ftrace_plugin/tools/device_kernel_version/default/ftrace_cpp_generator.py @@ -725,7 +725,7 @@ class EventFormatterCodeGenerator(FtraceEventCodeGenerator): f.write(" if (len >= BUFFER_SIZE - 1) {\n") f.write( - ' HILOG_WARN(LOG_CORE, "maybe, the contents of print event({}) msg had be cut off ' + ' PROFILER_LOG_WARN(LOG_CORE, "maybe, the contents of print event({}) msg had be cut off ' 'in outfile");\n'.format(event.name) ) f.write(" }\n") diff --git a/device/plugins/gpu_plugin/src/gpu_data_plugin.cpp b/device/plugins/gpu_plugin/src/gpu_data_plugin.cpp index 820d69210..094a9a412 100644 --- a/device/plugins/gpu_plugin/src/gpu_data_plugin.cpp +++ b/device/plugins/gpu_plugin/src/gpu_data_plugin.cpp @@ -33,10 +33,10 @@ int GpuDataPlugin::Start(const uint8_t* configData, uint32_t configSize) file_.open(GPU_PATH); if (!file_.is_open()) { - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s)", __func__, GPU_PATH.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s)", __func__, GPU_PATH.c_str()); return RET_FAIL; } - HILOG_INFO(LOG_CORE, "%s:start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:start success!", __func__); return RET_SUCC; } @@ -67,7 +67,7 @@ int GpuDataPlugin::Report(uint8_t* data, uint32_t dataSize) int GpuDataPlugin::Stop() { file_.close(); - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } @@ -79,7 +79,7 @@ int GpuDataPlugin::ReadFile() std::getline(file_, line); for (char charac : line) { if (!isdigit(charac)) { - HILOG_ERROR(LOG_CORE, "invalid file content for (%s)", GPU_PATH.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "invalid file content for (%s)", GPU_PATH.c_str()); return RET_FAIL; } } diff --git a/device/plugins/hidump_plugin/src/hidump_plugin.cpp b/device/plugins/hidump_plugin/src/hidump_plugin.cpp index b18e6d934..957a82ca5 100755 --- a/device/plugins/hidump_plugin/src/hidump_plugin.cpp +++ b/device/plugins/hidump_plugin/src/hidump_plugin.cpp @@ -48,7 +48,7 @@ HidumpPlugin::HidumpPlugin() : fp_(nullptr, nullptr) {} HidumpPlugin::~HidumpPlugin() { - HILOG_INFO(LOG_CORE, "%s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s: ready!", __func__); std::unique_lock locker(mutex_); if (running_) { running_ = false; @@ -61,12 +61,12 @@ HidumpPlugin::~HidumpPlugin() if (fp_ != nullptr) { fp_.reset(); } - HILOG_INFO(LOG_CORE, "%s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s: success!", __func__); } int HidumpPlugin::Start(const uint8_t* configData, uint32_t configSize) { - HILOG_INFO(LOG_CORE, "HidumpPlugin:Start ----> !"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin:Start ----> !"); CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, -1, "HidumpPlugin: ParseFromArray failed"); fp_ = std::unique_ptr(CustomPopen(g_fpsFormat, "r"), CustomPclose); @@ -74,7 +74,7 @@ int HidumpPlugin::Start(const uint8_t* configData, uint32_t configSize) const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "HidumpPlugin: CustomPopen(%s) Failed, errno(%d:%s)", g_fpsFormat, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "HidumpPlugin: CustomPopen(%s) Failed, errno(%d:%s)", g_fpsFormat, errno, buf); return -1; } CHECK_NOTNULL(resultWriter_, -1, "HidumpPlugin: Writer is no set!"); @@ -84,7 +84,7 @@ int HidumpPlugin::Start(const uint8_t* configData, uint32_t configSize) running_ = true; writeThread_ = std::thread(&HidumpPlugin::Loop, this); - HILOG_INFO(LOG_CORE, "HidumpPlugin: ---> Start success!"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin: ---> Start success!"); return 0; } @@ -96,11 +96,11 @@ int HidumpPlugin::Stop() if (writeThread_.joinable()) { writeThread_.join(); } - HILOG_INFO(LOG_CORE, "HidumpPlugin:stop thread success!"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin:stop thread success!"); if (fp_ != nullptr) { fp_.reset(); } - HILOG_INFO(LOG_CORE, "HidumpPlugin: stop success!"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin: stop success!"); return 0; } @@ -112,7 +112,7 @@ int HidumpPlugin::SetWriter(WriterStruct* writer) void HidumpPlugin::Loop(void) { - HILOG_INFO(LOG_CORE, "HidumpPlugin: Loop start"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin: Loop start"); CHECK_NOTNULL(resultWriter_, NO_RETVAL, "%s: resultWriter_ nullptr", __func__); fcntl(fileno(fp_.get()), F_SETFL, O_NONBLOCK); @@ -137,7 +137,7 @@ void HidumpPlugin::Loop(void) } else { ProtoEncoder::HidumpInfo hidumpInfo(resultWriter_->startReport(resultWriter_)); if (!ParseHidumpInfo(hidumpInfo, buf)) { - HILOG_ERROR(LOG_CORE, "parse hidump info failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "parse hidump info failed!"); } int messageLen = hidumpInfo.Finish(); resultWriter_->finishReport(resultWriter_, messageLen); @@ -145,7 +145,7 @@ void HidumpPlugin::Loop(void) } } - HILOG_INFO(LOG_CORE, "HidumpPlugin: Loop exit"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPlugin: Loop exit"); } template @@ -154,9 +154,9 @@ bool HidumpPlugin::ParseHidumpInfo(T& hidumpInfoProto, char *buf) // format: fps:123|1501960484673 if (strncmp(buf, "fps:", strlen("fps:")) != 0) { if (strstr(buf, "inaccessible or not found") != nullptr) { - HILOG_ERROR(LOG_CORE, "HidumpPlugin: fps command not found!"); + PROFILER_LOG_ERROR(LOG_CORE, "HidumpPlugin: fps command not found!"); } else { - HILOG_ERROR(LOG_CORE, "format error. %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "format error. %s", buf); } return false; } @@ -235,7 +235,7 @@ int HidumpPlugin::CustomPclose(FILE* fp) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "HidumpPlugin:%s fclose failed! errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "HidumpPlugin:%s fclose failed! errno(%d:%s)", __func__, errno, buf); return -1; } kill(g_child, SIGKILL); diff --git a/device/plugins/hidump_plugin/test/unittest/hidump_plugin_unittest.cpp b/device/plugins/hidump_plugin/test/unittest/hidump_plugin_unittest.cpp index 908bf286b..90aed5622 100755 --- a/device/plugins/hidump_plugin/test/unittest/hidump_plugin_unittest.cpp +++ b/device/plugins/hidump_plugin/test/unittest/hidump_plugin_unittest.cpp @@ -71,12 +71,12 @@ bool PluginStart(HidumpPlugin& plugin, HidumpConfig& config) std::vector configData(size); int ret = config.SerializeToArray(configData.data(), configData.size()); CHECK_TRUE(ret > 0, false, "HidumpPluginUnittest: SerializeToArray fail!!!"); - HILOG_INFO(LOG_CORE, "HidumpPluginUnittest: SerializeToArray success"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPluginUnittest: SerializeToArray success"); // start ret = plugin.Start(configData.data(), configData.size()); CHECK_TRUE(ret == 0, false, "HidumpPluginUnittest: start plugin fail!!!"); - HILOG_INFO(LOG_CORE, "HidumpPluginUnittest: Start success"); + PROFILER_LOG_INFO(LOG_CORE, "HidumpPluginUnittest: Start success"); return true; } @@ -221,14 +221,14 @@ bool RecordFileExist(std::string& file) std::string cmd = "cat " + file; std::unique_ptr fp(popen(cmd.c_str(), "r"), pclose); if (!fp) { - HILOG_ERROR(LOG_CORE, "%s:: popen error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:: popen error", __func__); return false; } char buff[BUF_MAX_LEN] = {0}; char* pRet = fgets(buff, BUF_MAX_LEN - 1, fp.get()); if (pRet == nullptr) { - HILOG_ERROR(LOG_CORE, "%s: fgets Failed, errno(%d)", __func__, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s: fgets Failed, errno(%d)", __func__, errno); return false; } buff[BUF_MAX_LEN - 1] = '\0'; diff --git a/device/plugins/hiebpf_plugin/src/hiebpf_module.cpp b/device/plugins/hiebpf_plugin/src/hiebpf_module.cpp index 22f45da59..b3722a68c 100644 --- a/device/plugins/hiebpf_plugin/src/hiebpf_module.cpp +++ b/device/plugins/hiebpf_plugin/src/hiebpf_module.cpp @@ -38,7 +38,7 @@ void RunCmd(std::string& cmd) { std::unique_ptr pipe(popen(cmd.c_str(), "r"), pclose); if (pipe == nullptr) { - HILOG_ERROR(LOG_CORE, "HiebpfPlugin::RunCmd: create popen FAILED!"); + PROFILER_LOG_ERROR(LOG_CORE, "HiebpfPlugin::RunCmd: create popen FAILED!"); return; } constexpr uint32_t readBufferSize = 4096; @@ -47,7 +47,7 @@ void RunCmd(std::string& cmd) while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { result += buffer.data(); } - HILOG_INFO(LOG_CORE, "HiebpfPlugin::run command result: %s", result.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "HiebpfPlugin::run command result: %s", result.c_str()); } } // namespace @@ -55,9 +55,9 @@ static int32_t HiebpfSessionStart(const uint8_t* configData, uint32_t configSize { std::lock_guard guard(g_taskMutex); CHECK_TRUE(!g_releaseResources, 0, "%s: hiebpf released resources, return", __func__); - HILOG_DEBUG(LOG_CORE, "enter"); + PROFILER_LOG_DEBUG(LOG_CORE, "enter"); if (configData == nullptr || configSize < 0) { - HILOG_ERROR(LOG_CORE, "Parameter error"); + PROFILER_LOG_ERROR(LOG_CORE, "Parameter error"); return RET_ERR; } @@ -80,7 +80,7 @@ static int32_t HiebpfSessionStart(const uint8_t* configData, uint32_t configSize std::string cmd = g_config.cmd_line(); cmd += " --start true --output_file " + g_config.outfile_name(); RunCmd(cmd); - HILOG_DEBUG(LOG_CORE, "leave"); + PROFILER_LOG_DEBUG(LOG_CORE, "leave"); return RET_OK; } @@ -88,7 +88,7 @@ static int32_t HiebpfSessionStop() { std::lock_guard guard(g_taskMutex); CHECK_TRUE(!g_releaseResources, 0, "%s: hiebpf released resources, return", __func__); - HILOG_DEBUG(LOG_CORE, "enter"); + PROFILER_LOG_DEBUG(LOG_CORE, "enter"); if (!g_config.split_outfile_name().empty()) { CHECK_NOTNULL(g_splitTraceWriter, -1, "%s: writer is nullptr, SetDurationTime failed", __func__); @@ -106,7 +106,7 @@ static int32_t HiebpfSessionStop() g_splitTraceWriter.reset(); g_splitTraceWriter = nullptr; } - HILOG_DEBUG(LOG_CORE, "leave"); + PROFILER_LOG_DEBUG(LOG_CORE, "leave"); return RET_OK; } diff --git a/device/plugins/hilog_plugin/src/file_cache.cpp b/device/plugins/hilog_plugin/src/file_cache.cpp index 558152179..c6f5bf910 100644 --- a/device/plugins/hilog_plugin/src/file_cache.cpp +++ b/device/plugins/hilog_plugin/src/file_cache.cpp @@ -17,7 +17,7 @@ FileCache::FileCache(const std::string& path) : path_(path), fp_(nullptr) { - HILOG_INFO(LOG_CORE, "FileCache: path(%s)!", path_.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "FileCache: path(%s)!", path_.c_str()); } FileCache::~FileCache() diff --git a/device/plugins/hilog_plugin/src/hilog_plugin.cpp b/device/plugins/hilog_plugin/src/hilog_plugin.cpp index 7f9b0da7b..c310d0b55 100644 --- a/device/plugins/hilog_plugin/src/hilog_plugin.cpp +++ b/device/plugins/hilog_plugin/src/hilog_plugin.cpp @@ -49,7 +49,7 @@ HilogPlugin::HilogPlugin() : fp_(nullptr, nullptr) {} HilogPlugin::~HilogPlugin() { - HILOG_INFO(LOG_CORE, "%s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s: ready!", __func__); std::unique_lock locker(mutex_); if (running_) { running_ = false; @@ -65,7 +65,7 @@ HilogPlugin::~HilogPlugin() if (fp_ != nullptr) { fp_.reset(); } - HILOG_INFO(LOG_CORE, "%s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s: success!", __func__); } int HilogPlugin::Start(const uint8_t* configData, uint32_t configSize) @@ -105,7 +105,7 @@ int HilogPlugin::Start(const uint8_t* configData, uint32_t configSize) int oldPipeSize = fcntl(fileno(fp_.get()), F_GETPIPE_SZ); fcntl(fileno(fp_.get()), F_SETPIPE_SZ, oldPipeSize * PIPE_SIZE_RATIO); int pipeSize = fcntl(fileno(fp_.get()), F_GETPIPE_SZ); - HILOG_INFO(LOG_CORE, "{fp = %d, pipeSize=%d, oldPipeSize=%d}", fileno(fp_.get()), pipeSize, oldPipeSize); + PROFILER_LOG_INFO(LOG_CORE, "{fp = %d, pipeSize=%d, oldPipeSize=%d}", fileno(fp_.get()), pipeSize, oldPipeSize); workThread_ = std::thread(&HilogPlugin::Run, this); @@ -114,7 +114,7 @@ int HilogPlugin::Start(const uint8_t* configData, uint32_t configSize) int HilogPlugin::Stop() { - HILOG_INFO(LOG_CORE, "HilogPlugin: ready stop thread!"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin: ready stop thread!"); std::unique_lock locker(mutex_); running_ = false; COMMON::CustomPUnblock(pipeFds_); @@ -126,13 +126,13 @@ int HilogPlugin::Stop() g_fileCache.Write(dataBuffer_.data(), dataBuffer_.size()); dataBuffer_.erase(dataBuffer_.begin(), dataBuffer_.end()); } - HILOG_INFO(LOG_CORE, "HilogPlugin: stop thread success!"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin: stop thread success!"); if (protoConfig_.need_record()) { g_fileCache.Close(); } fp_.reset(); - HILOG_INFO(LOG_CORE, "HilogPlugin: stop success!"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin: stop success!"); return 0; } @@ -197,7 +197,7 @@ void HilogPlugin::InitHilogCmd() void HilogPlugin::Run(void) { - HILOG_INFO(LOG_CORE, "HilogPlugin::Run start!"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin::Run start!"); std::unique_ptr buffer = std::make_unique(MAX_BUFFER_LEN); std::unique_ptr dataProto = nullptr; @@ -214,7 +214,8 @@ void HilogPlugin::Run(void) } if ((strlen(reinterpret_cast(buffer.get())) + 1) == (MAX_BUFFER_LEN - 1)) { - HILOG_ERROR(LOG_CORE, "HilogPlugin:data length is greater than the MAX_BUFFER_LEN(%d)", MAX_BUFFER_LEN); + PROFILER_LOG_ERROR(LOG_CORE, + "HilogPlugin:data length is greater than the MAX_BUFFER_LEN(%d)", MAX_BUFFER_LEN); } auto cptr = reinterpret_cast(buffer.get()); @@ -249,13 +250,13 @@ void HilogPlugin::Run(void) FlushDataOptimize(hilogInfo.get()); hilogInfo.reset(); } - HILOG_INFO(LOG_CORE, "HilogPlugin::Run done!"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin::Run done!"); } template void HilogPlugin::ParseLogLineInfo(const char* data, size_t len, T& hilogLineInfo) { if (data == nullptr || len < TIME_NS_WIDTH) { - HILOG_ERROR(LOG_CORE, "HilogPlugin:%s param invalid", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "HilogPlugin:%s param invalid", __func__); return; } @@ -332,7 +333,7 @@ template bool HilogPlugin::SetHilogLineDetails(const char* data, T& if (google::protobuf::internal::IsStructurallyValidUTF8(pTmp, strlen(pTmp) - 1)) { hilogLineInfo.set_context(pTmp, strlen(pTmp) - 1); // - \n } else { - HILOG_ERROR(LOG_CORE, "HilogPlugin: log context include invalid UTF-8 data"); + PROFILER_LOG_ERROR(LOG_CORE, "HilogPlugin: log context include invalid UTF-8 data"); hilogLineInfo.set_context(""); } @@ -407,7 +408,7 @@ bool HilogPlugin::TimeStringToNS(const char* data, struct timespec *tsTime) const int bufSize = 128; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "HilogPlugin: get localtime failed!, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "HilogPlugin: get localtime failed!, errno(%d:%s)", errno, buf); return false; } tmTime.tm_year = result.tm_year; @@ -415,7 +416,7 @@ bool HilogPlugin::TimeStringToNS(const char* data, struct timespec *tsTime) pTmp = const_cast(data) + TIME_HOUR_WIDTH; CHECK_TRUE(StringToL(pTmp, fixHour), false, "%s:strtol fixHour failed", __func__); if (static_cast(fixHour) != tmTime.tm_hour) { // hours since midnight - [0, 23] - HILOG_INFO(LOG_CORE, "HilogPlugin: hour(%d) <==> fix hour(%ld)!", tmTime.tm_hour, fixHour); + PROFILER_LOG_INFO(LOG_CORE, "HilogPlugin: hour(%d) <==> fix hour(%ld)!", tmTime.tm_hour, fixHour); tmTime.tm_hour = fixHour; } pTmp = const_cast(data) + TIME_SEC_WIDTH; @@ -429,7 +430,7 @@ bool HilogPlugin::TimeStringToNS(const char* data, struct timespec *tsTime) char buff[TIME_BUFF_LEN] = {0}; if (snprintf_s(buff, sizeof(buff), sizeof(buff) - 1, "%ld.%09u\n", timetTime, nsec) < 0) { - HILOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); } size_t buffSize = strlen(buff); for (size_t i = 0; i < buffSize && protoConfig_.need_record(); i++) { @@ -453,13 +454,13 @@ int HilogPlugin::GetDateTime(char* psDateTime, uint32_t size) const int bufSize = 128; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "HilogPlugin: get localtime failed!, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "HilogPlugin: get localtime failed!, errno(%d:%s)", errno, buf); return -1; } if (snprintf_s(psDateTime, size, size - 1, "%04d%02d%02d%02d%02d%02d", pTM->tm_year + BASE_YEAR, pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min, pTM->tm_sec) < 0) { - HILOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); } return 0; diff --git a/device/plugins/hilog_plugin/test/unittest/hilog_plugin_unittest.cpp b/device/plugins/hilog_plugin/test/unittest/hilog_plugin_unittest.cpp index 278e2a813..61f88d5b0 100644 --- a/device/plugins/hilog_plugin/test/unittest/hilog_plugin_unittest.cpp +++ b/device/plugins/hilog_plugin/test/unittest/hilog_plugin_unittest.cpp @@ -82,12 +82,12 @@ bool PluginStart(HilogPlugin& plugin, HilogConfig& config) std::vector configData(size); int ret = config.SerializeToArray(configData.data(), configData.size()); CHECK_TRUE(ret > 0, false, "HilogPluginTest: SerializeToArray fail!!!"); - HILOG_INFO(LOG_CORE, "HilogPluginTest: SerializeToArray success"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPluginTest: SerializeToArray success"); // start ret = plugin.Start(configData.data(), configData.size()); CHECK_TRUE(ret == 0, false, "HilogPluginTest: start plugin fail!!!"); - HILOG_INFO(LOG_CORE, "HilogPluginTest: Start success"); + PROFILER_LOG_INFO(LOG_CORE, "HilogPluginTest: Start success"); return true; } @@ -101,7 +101,7 @@ bool RecordFileExist(std::string& file) nSeconds = time(nullptr); pTM = localtime(&nSeconds); if (snprintf_s(name, sizeof(name), sizeof(name) - 1, "%04d", pTM->tm_year + BASE_YEAR) < 0) { - HILOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); } if (access(DEFAULT_RECORD_FILE.c_str(), F_OK) != 0) { return false; @@ -111,7 +111,7 @@ bool RecordFileExist(std::string& file) char buff[BUF_MAX_LEN] = {0}; std::unique_ptr fp(popen(cmd.c_str(), "r"), pclose); if (!fp) { - HILOG_ERROR(LOG_CORE, "%s:: popen error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:: popen error", __func__); return false; } @@ -132,7 +132,7 @@ uint64_t GetSec(HilogPlugin& plugin, const char* data) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "GetSec: get time failed!, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "GetSec: get time failed!, errno(%d:%s)", errno, buf); return 0; } @@ -141,7 +141,7 @@ uint64_t GetSec(HilogPlugin& plugin, const char* data) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "GetSec: get localtime failed!, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "GetSec: get localtime failed!, errno(%d:%s)", errno, buf); return 0; } @@ -152,7 +152,7 @@ uint64_t GetSec(HilogPlugin& plugin, const char* data) long fixHour; CHECK_TRUE(plugin.StringToL(pTmp, fixHour), 0, "%s:strtol fixHour failed", __func__); if (static_cast(fixHour) != tmTime.tm_hour) { // hours since midnight - [0, 23] - HILOG_INFO(LOG_CORE, "GetSec: hour(%d) <==> fix hour(%ld)!", tmTime.tm_hour, fixHour); + PROFILER_LOG_INFO(LOG_CORE, "GetSec: hour(%d) <==> fix hour(%ld)!", tmTime.tm_hour, fixHour); tmTime.tm_hour = fixHour; } diff --git a/device/plugins/hiperf_plugin/src/hiperf_module.cpp b/device/plugins/hiperf_plugin/src/hiperf_module.cpp index 89d61721f..277426311 100644 --- a/device/plugins/hiperf_plugin/src/hiperf_module.cpp +++ b/device/plugins/hiperf_plugin/src/hiperf_module.cpp @@ -84,7 +84,7 @@ bool ParseConfigToCmd(const HiperfPluginConfig& config, std::vector bool RunCommand(const std::string& cmd) { - HILOG_INFO(LOG_CORE, "run command: %s", cmd.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "run command: %s", cmd.c_str()); bool res = false; std::vector cmdArg; COMMON::SplitString(cmd, " ", cmdArg); @@ -106,7 +106,7 @@ bool RunCommand(const std::string& cmd) } } COMMON::CustomPclose(fp, pipeFds, childPid); - HILOG_INFO(LOG_CORE, "run command result: %s", result.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "run command result: %s", result.c_str()); CHECK_TRUE(res, false, "HiperfPlugin::RunCommand: execute command FAILED!"); return true; } @@ -169,7 +169,7 @@ int HiperfPluginSessionStop(void) int HiperfRegisterWriterStruct(const WriterStruct* writer) { - HILOG_INFO(LOG_CORE, "%s:writer", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:writer", __func__); return 0; } diff --git a/device/plugins/hisysevent_plugin/src/hisysevent_plugin.cpp b/device/plugins/hisysevent_plugin/src/hisysevent_plugin.cpp index b75ec9613..667eb68de 100644 --- a/device/plugins/hisysevent_plugin/src/hisysevent_plugin.cpp +++ b/device/plugins/hisysevent_plugin/src/hisysevent_plugin.cpp @@ -37,28 +37,28 @@ HisyseventPlugin::HisyseventPlugin() : fp_(nullptr, nullptr) {} HisyseventPlugin::~HisyseventPlugin() { - HILOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); Stop(); - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); } int HisyseventPlugin::SetWriter(WriterStruct* writer) { resultWriter_ = writer; - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); return 0; } int HisyseventPlugin::Start(const uint8_t* configData, uint32_t configSize) { - HILOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); CHECK_NOTNULL(configData, -1, "NOTE %s: param invalid", __func__); CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, -1, "NOTE HisyseventPlugin: ParseFromArray failed"); - HILOG_DEBUG(LOG_CORE, "config sourse data:%s domain:%s event:%s", protoConfig_.msg().c_str(), + PROFILER_LOG_DEBUG(LOG_CORE, "config sourse data:%s domain:%s event:%s", protoConfig_.msg().c_str(), protoConfig_.subscribe_domain().c_str(), protoConfig_.subscribe_event().c_str()); CHECK_TRUE(InitHisyseventCmd(), -1, "HisyseventPlugin: Init HisyseventCmd failed"); @@ -76,13 +76,13 @@ int HisyseventPlugin::Start(const uint8_t* configData, uint32_t configSize) running_ = true; workThread_ = std::thread(&HisyseventPlugin::Run, this); - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); return 0; } int HisyseventPlugin::Stop() { - HILOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); running_ = false; COMMON::CustomPUnblock(pipeFds_); @@ -94,20 +94,21 @@ int HisyseventPlugin::Stop() fp_.reset(); } - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); return 0; } void HisyseventPlugin::Run(void) { - HILOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); std::unique_ptr buffer = std::make_unique(MAX_STRING_LEN); - HILOG_INFO(LOG_CORE, "NOTE hisysevent_plugin_result.proto->HisyseventInfo:dataProto;Ready to output the result!"); + PROFILER_LOG_INFO(LOG_CORE, + "NOTE hisysevent_plugin_result.proto->HisyseventInfo:dataProto;Ready to output the result!"); fcntl(fileno(fp_.get()), F_SETPIPE_SZ, PIPE_SIZE); int aPipeSize = fcntl(fileno(fp_.get()), F_GETPIPE_SZ); - HILOG_INFO(LOG_CORE, "{fp = %d, aPipeSize=%d, PIPE_SIZE=%d}", fileno(fp_.get()), aPipeSize, PIPE_SIZE); + PROFILER_LOG_INFO(LOG_CORE, "{fp = %d, aPipeSize=%d, PIPE_SIZE=%d}", fileno(fp_.get()), aPipeSize, PIPE_SIZE); std::unique_ptr dataProto = nullptr; std::unique_ptr hisyseventInfo = nullptr; @@ -153,7 +154,7 @@ void HisyseventPlugin::Run(void) hisyseventInfo.reset(); } - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); } std::string HisyseventPlugin::GetFullCmd() @@ -172,9 +173,9 @@ std::string HisyseventPlugin::GetFullCmd() inline bool HisyseventPlugin::InitHisyseventCmd() { - HILOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "BEGN %s: ready!", __func__); if (!fullCmd_.empty()) { - HILOG_INFO(LOG_CORE, "fullCmd_ is dirty.Then clear()."); + PROFILER_LOG_INFO(LOG_CORE, "fullCmd_ is dirty.Then clear()."); fullCmd_.clear(); } @@ -190,7 +191,7 @@ inline bool HisyseventPlugin::InitHisyseventCmd() fullCmd_.emplace_back("-n"); fullCmd_.emplace_back(protoConfig_.subscribe_event()); } - HILOG_INFO(LOG_CORE, "END %s: success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "END %s: success!", __func__); return true; } @@ -205,7 +206,7 @@ inline bool HisyseventPlugin::ParseSyseventLineInfo(const char* data, size_t len info->set_context(data, strlen(data) - 1); // - \n id_++; } else { - HILOG_ERROR(LOG_CORE, "NOTE HisyseventPlugin: hisysevent context include invalid UTF-8 data"); + PROFILER_LOG_ERROR(LOG_CORE, "NOTE HisyseventPlugin: hisysevent context include invalid UTF-8 data"); return false; } diff --git a/device/plugins/hisysevent_plugin/test/unittest/hisysevent_plugin_unittest.cpp b/device/plugins/hisysevent_plugin/test/unittest/hisysevent_plugin_unittest.cpp index 20b3556e7..849ec96d4 100644 --- a/device/plugins/hisysevent_plugin/test/unittest/hisysevent_plugin_unittest.cpp +++ b/device/plugins/hisysevent_plugin/test/unittest/hisysevent_plugin_unittest.cpp @@ -78,12 +78,12 @@ bool PluginStart(HisyseventPlugin& plugin, HisyseventConfig& config) std::vector configData(size); int ret = config.SerializeToArray(configData.data(), configData.size()); CHECK_TRUE(ret > 0, false, "HisyseventPluginTest: SerializeToArray fail!!!"); - HILOG_INFO(LOG_CORE, "HisyseventPluginTest: SerializeToArray success"); + PROFILER_LOG_INFO(LOG_CORE, "HisyseventPluginTest: SerializeToArray success"); // start ret = plugin.Start(configData.data(), configData.size()); CHECK_TRUE(ret == 0, false, "HisyseventPluginTest: start plugin fail!!!"); - HILOG_INFO(LOG_CORE, "HisyseventPluginTest: Start success"); + PROFILER_LOG_INFO(LOG_CORE, "HisyseventPluginTest: Start success"); return true; } diff --git a/device/plugins/memory_plugin/src/memory_data_plugin.cpp b/device/plugins/memory_plugin/src/memory_data_plugin.cpp index eb8a2cc90..f74d91d09 100644 --- a/device/plugins/memory_plugin/src/memory_data_plugin.cpp +++ b/device/plugins/memory_plugin/src/memory_data_plugin.cpp @@ -62,7 +62,7 @@ MemoryDataPlugin::MemoryDataPlugin() MemoryDataPlugin::~MemoryDataPlugin() { - HILOG_INFO(LOG_CORE, "%s:~MemoryDataPlugin!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:~MemoryDataPlugin!", __func__); buffer_ = nullptr; @@ -120,7 +120,7 @@ int MemoryDataPlugin::InitMemVmemFd() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); return RET_FAIL; } meminfoFd_ = open(realPath, O_RDONLY | O_CLOEXEC); @@ -128,7 +128,7 @@ int MemoryDataPlugin::InitMemVmemFd() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:open failed, fileName, errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:open failed, fileName, errno(%d:%s)", __func__, errno, buf); return RET_FAIL; } } @@ -142,7 +142,7 @@ int MemoryDataPlugin::InitMemVmemFd() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); return RET_FAIL; } vmstatFd_ = open(realPath, O_RDONLY | O_CLOEXEC); @@ -150,7 +150,7 @@ int MemoryDataPlugin::InitMemVmemFd() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to open(/proc/vmstat), errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(/proc/vmstat), errno(%d:%s)", __func__, errno, buf); return RET_FAIL; } } @@ -196,7 +196,7 @@ int MemoryDataPlugin::Start(const uint8_t* configData, uint32_t configSize) } } - HILOG_INFO(LOG_CORE, "%s:start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:start success!", __func__); return RET_SUCC; } @@ -318,7 +318,7 @@ template bool MemoryDataPlugin::GetMemInfoByMemoryService(uint32_t size_t ret = fread(buffer.get(), 1, BUF_MAX_LEN, fp.get()); if (ret == 0) { - HILOG_ERROR(LOG_CORE, "%s:fread failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:fread failed", __func__); } buffer.get()[BUF_MAX_LEN - 1] = '\0'; @@ -422,7 +422,7 @@ int MemoryDataPlugin::Stop() } } } - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } @@ -453,7 +453,7 @@ int32_t MemoryDataPlugin::ReadFile(int fd) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to read(%d), errno(%d:%s)", __func__, fd, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to read(%d), errno(%d:%s)", __func__, fd, errno, buf); err_ = errno; return RET_FAIL; } @@ -470,7 +470,7 @@ std::string MemoryDataPlugin::ReadFile(const std::string& path) const int maxSize = 256; char buf[maxSize] = { 0 }; strerror_r(errno, buf, maxSize); - HILOG_WARN(LOG_CORE, "open file %s FAILED: %s!", path.c_str(), buf); + PROFILER_LOG_WARN(LOG_CORE, "open file %s FAILED: %s!", path.c_str(), buf); return ""; } @@ -501,20 +501,20 @@ std::vector MemoryDataPlugin::OpenProcPidFiles(int32_t pid) for (int i = 0; i < count; i++) { if (snprintf_s(fileName, sizeof(fileName), sizeof(fileName) - 1, "%s/%d/%s", testpath_, pid, procfdMapping[i].file) < 0) { - HILOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); } if (realpath(fileName, realPath) == nullptr) { const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); } int fd = open(realPath, O_RDONLY | O_CLOEXEC); if (fd == -1) { const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName, errno, buf); } profds.emplace(profds.begin() + i, fd); } @@ -530,7 +530,7 @@ DIR* MemoryDataPlugin::OpenDestDir(const char* dirPath) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to opendir(%s), errno(%d:%s)", __func__, dirPath, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to opendir(%s), errno(%d:%s)", __func__, dirPath, errno, buf); } return destDir; @@ -564,7 +564,7 @@ int32_t MemoryDataPlugin::ReadProcPidFile(int32_t pid, const char* pFileName) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:realpath failed, errno(%d:%s)", __func__, errno, buf); return RET_FAIL; } fd = open(realPath, O_RDONLY | O_CLOEXEC); @@ -572,12 +572,12 @@ int32_t MemoryDataPlugin::ReadProcPidFile(int32_t pid, const char* pFileName) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_INFO(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName, errno, buf); + PROFILER_LOG_INFO(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, fileName, errno, buf); err_ = errno; return RET_FAIL; } if (buffer_.get() == nullptr) { - HILOG_INFO(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); err_ = RET_NULL_ADDR; close(fd); return RET_FAIL; @@ -588,7 +588,7 @@ int32_t MemoryDataPlugin::ReadProcPidFile(int32_t pid, const char* pFileName) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_INFO(LOG_CORE, "%s:failed to read(%s), errno(%d:%s)", __func__, fileName, errno, buf); + PROFILER_LOG_INFO(LOG_CORE, "%s:failed to read(%s), errno(%d:%s)", __func__, fileName, errno, buf); err_ = errno; return RET_FAIL; } @@ -652,7 +652,7 @@ template void MemoryDataPlugin::SetProcessInfo(T& processMemoryInfo uint64_t value; if ((key >= PRO_TGID && key <= PRO_PURGPIN && key != PRO_NAME) && !StringToUll(word, value)) { - HILOG_ERROR(LOG_CORE, "MemoryDataPlugin:%s, strtoull failed, key(%d), word(%s)", __func__, key, word); + PROFILER_LOG_ERROR(LOG_CORE, "MemoryDataPlugin:%s, strtoull failed, key(%d), word(%s)", __func__, key, word); return; } @@ -733,7 +733,7 @@ template void MemoryDataPlugin::WriteOomInfo(T& processMemoryInfo, return; } if (buffer_.get() == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:invalid params, read buffer_ is NULL", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:invalid params, read buffer_ is NULL", __func__); return; } processMemoryInfo.set_oom_score_adj(static_cast(strtol(reinterpret_cast(buffer_.get()), @@ -836,7 +836,7 @@ template void MemoryDataPlugin::WriteAshmemInfo(T& dataProto) std::string file = path + "/purgeable_ashmem_trigger"; std::ifstream input(file, std::ios::in); if (input.fail()) { - HILOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); return; } @@ -927,7 +927,7 @@ template void MemoryDataPlugin::WriteDmaInfo(T& dataProto) std::string file = std::string(testpath_) + "/process_dmabuf_info"; std::ifstream input(file, std::ios::in); if (input.fail()) { - HILOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); return; } @@ -996,7 +996,7 @@ template void MemoryDataPlugin::WriteGpuMemInfo(T& dataProto) std::string file = path + "/gpu_memory"; std::ifstream input(file, std::ios::in); if (input.fail()) { - HILOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); return; } @@ -1042,7 +1042,7 @@ std::string MemoryDataPlugin::RunCommand(const std::string& cmd) std::string ret = ""; std::unique_ptr pipe(popen(cmd.c_str(), "r"), pclose); if (!pipe) { - HILOG_ERROR(LOG_CORE, "%s:popen(%s) error", __func__, cmd.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:popen(%s) error", __func__, cmd.c_str()); return ret; } @@ -1239,7 +1239,7 @@ bool MemoryDataPlugin::GetRenderServiceGlSize(int32_t pid, GraphicsMemory& graph bool ret = false; sptr memtrack = IMemoryTrackerInterface::Get(true); if (memtrack == nullptr) { - HILOG_ERROR(LOG_CORE, "%s: get IMemoryTrackerInterface failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: get IMemoryTrackerInterface failed", __func__); return ret; } @@ -1373,7 +1373,7 @@ template void MemoryDataPlugin::WriteProfileMemInfo(T& dataProto) std::ifstream input(file, std::ios::in); if (input.fail()) { - HILOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:open %s failed, errno = %d", __func__, file.c_str(), errno); return; } diff --git a/device/plugins/memory_plugin/src/test_main.cpp b/device/plugins/memory_plugin/src/test_main.cpp index af246e75a..10be42255 100644 --- a/device/plugins/memory_plugin/src/test_main.cpp +++ b/device/plugins/memory_plugin/src/test_main.cpp @@ -34,7 +34,7 @@ int main(int agrc, char* agrv[]) for (int i = 1; i < agrc; i++) { size = atoi(agrv[i]); if (size <= 0) { - HILOG_INFO(LOG_CORE, "ready malloc size(%zu)Mb invalid", size); + PROFILER_LOG_INFO(LOG_CORE, "ready malloc size(%zu)Mb invalid", size); continue; } buf = (char *)malloc(size * MB_PER_BYTE); @@ -42,7 +42,7 @@ int main(int agrc, char* agrv[]) const int bufferSize = 256; char buffer[bufferSize] = { 0 }; strerror_r(errno, buffer, bufferSize); - HILOG_ERROR(LOG_CORE, "malloc %zu fail, err(%s:%d)", size, buffer, errno); + PROFILER_LOG_ERROR(LOG_CORE, "malloc %zu fail, err(%s:%d)", size, buffer, errno); continue; } cache.emplace(cache.begin() + i - 1, buf); diff --git a/device/plugins/memory_plugin/test/unittest/memory_data_plugin_unittest.cpp b/device/plugins/memory_plugin/test/unittest/memory_data_plugin_unittest.cpp index a4188348c..85a6747d1 100644 --- a/device/plugins/memory_plugin/test/unittest/memory_data_plugin_unittest.cpp +++ b/device/plugins/memory_plugin/test/unittest/memory_data_plugin_unittest.cpp @@ -366,17 +366,17 @@ int GetPid(const std::string processName) { int pid = -1; std::string findpid = "pidof " + processName; - HILOG_INFO(LOG_CORE, "find pid command : %s", findpid.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "find pid command : %s", findpid.c_str()); std::unique_ptr pipe(popen(findpid.c_str(), "r"), pclose); char line[LINE_SIZE]; do { if (fgets(line, sizeof(line), pipe.get()) == nullptr) { - HILOG_INFO(LOG_CORE, "not find processName : %s", processName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "not find processName : %s", processName.c_str()); return pid; } else if (strlen(line) > 0 && isdigit(static_cast(line[0]))) { pid = atoi(line); - HILOG_INFO(LOG_CORE, "find processName : %s, pid: %d", processName.c_str(), pid); + PROFILER_LOG_INFO(LOG_CORE, "find processName : %s, pid: %d", processName.c_str(), pid); break; } } while (1); @@ -862,7 +862,7 @@ void OutputData(uint8_t* data, uint32_t size) MemoryData memoryData; int ret = memoryData.ParseFromArray(data, size); if (ret <= 0) { - HILOG_ERROR(LOG_CORE, "MemoryDataPluginTest, %s:parseFromArray failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "MemoryDataPluginTest, %s:parseFromArray failed!", __func__); return; } @@ -906,7 +906,7 @@ HWTEST_F(MemoryDataPluginTest, TestProcessTreeRunTime, TestSize.Level1) gettimeofday(&end, nullptr); clock_t clockend = clock(); int timeuse = US_PER_S * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec; - HILOG_INFO(LOG_CORE, "clock time=%.3fs, timeofday=%.3fs", (double)(clockend - clockstart) / CLOCKS_PER_SEC, + PROFILER_LOG_INFO(LOG_CORE, "clock time=%.3fs, timeofday=%.3fs", (double)(clockend - clockstart) / CLOCKS_PER_SEC, (double)timeuse / US_PER_S); EXPECT_EQ(plugin->callbacks->onPluginSessionStop(), 0); } diff --git a/device/plugins/native_daemon/include/debug_logger.h b/device/plugins/native_daemon/include/debug_logger.h index ff5f86146..b74aba4a8 100644 --- a/device/plugins/native_daemon/include/debug_logger.h +++ b/device/plugins/native_daemon/include/debug_logger.h @@ -109,7 +109,7 @@ private: DebugLevel GetLogLevelByTag(const std::string &) const; const std::string GetLogLevelName(DebugLevel) const; - int HiLog(std::string &buffer) const; + void HiLog(std::string &buffer) const; static std::unique_ptr logInstance_; std::string logFileBuffer_; diff --git a/device/plugins/native_daemon/include/hiperf_hilog.h b/device/plugins/native_daemon/include/hiperf_hilog.h index 6f2368c3f..395e67a1e 100755 --- a/device/plugins/native_daemon/include/hiperf_hilog.h +++ b/device/plugins/native_daemon/include/hiperf_hilog.h @@ -34,62 +34,9 @@ #ifndef CONFIG_NO_HILOG #include "hilog/log.h" -#ifdef HIPERF_HILOGF -#undef HIPERF_HILOGF -#endif - -#ifdef HIPERF_HILOGE -#undef HIPERF_HILOGE -#endif - -#ifdef HIPERF_HILOGW -#undef HIPERF_HILOGW -#endif - -#ifdef HIPERF_HILOGI -#undef HIPERF_HILOGI -#endif - -#ifdef HIPERF_HILOGD -#undef HIPERF_HILOGD -#endif - -// param of log interface, such as HIPERF_HILOGF. -enum HiperfModule { - MODULE_DEFAULT = 0, - MODULE_JS_NAPI, - MODULE_CPP_API, -}; - static constexpr unsigned int BASE_HIPERF_DOMAIN_ID = 0xD000000; static constexpr unsigned int HITRACE_TAG = 0xd03301; -static constexpr OHOS::HiviewDFX::HiLogLabel HIPERF_HILOG_LABLE[] = { - {LOG_CORE, HITRACE_TAG, "hiperf"}, - {LOG_CORE, HITRACE_TAG, "HiperfJSNAPI"}, - {LOG_CORE, HITRACE_TAG, "HiperfCPPAPI"}, -}; - -// In order to improve performance, do not check the module range - -#define HIPERF_HILOGF(module, ...) \ - (void)OHOS::HiviewDFX::HiLog::Fatal(HIPERF_HILOG_LABLE[module], FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGE(module, ...) \ - (void)OHOS::HiviewDFX::HiLog::Error(HIPERF_HILOG_LABLE[module], FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGW(module, ...) \ - (void)OHOS::HiviewDFX::HiLog::Warn(HIPERF_HILOG_LABLE[module], FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGI(module, ...) \ - (void)OHOS::HiviewDFX::HiLog::Info(HIPERF_HILOG_LABLE[module], FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGD(module, ...) \ - (void)OHOS::HiviewDFX::HiLog::Debug(HIPERF_HILOG_LABLE[module], FORMATED(__VA_ARGS__)) -#else - -#define HIPERF_HILOGF(module, ...) printf(FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGE(module, ...) printf(FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGW(module, ...) printf(FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGI(module, ...) printf(FORMATED(__VA_ARGS__)) -#define HIPERF_HILOGD(module, ...) printf(FORMATED(__VA_ARGS__)) - #endif // CONFIG_NO_HILOG #endif // HIPERF_HILOG diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_client_manager.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_client_manager.cpp index aaf776a90..805236844 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_client_manager.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_client_manager.cpp @@ -30,7 +30,7 @@ int32_t NativeMemoryProfilerSaClientManager::Start(std::shared_ptr(); @@ -62,7 +62,7 @@ int32_t NativeMemoryProfilerSaClientManager::Stop(uint32_t pid) CHECK_TRUE(pid != 0, RET_ERR, "NativeMemoryProfilerSaClientManager: pid is 0"); auto service = GetRemoteService(); if (service == nullptr) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); return RET_ERR; } NativeMemoryProfilerSaProxy proxy(service); @@ -74,7 +74,7 @@ int32_t NativeMemoryProfilerSaClientManager::Stop(const std::string& name) CHECK_TRUE(!name.empty(), RET_ERR, "NativeMemoryProfilerSaClientManager: name is empty"); auto service = GetRemoteService(); if (service == nullptr) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); return RET_ERR; } NativeMemoryProfilerSaProxy proxy(service); @@ -89,7 +89,7 @@ int32_t NativeMemoryProfilerSaClientManager::DumpData(uint32_t fd, CHECK_TRUE(CheckConfig(config), RET_ERR, "CheckConfig failed"); auto service = GetRemoteService(); if (service == nullptr) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: stop GetRemoteService failed"); return RET_ERR; } NativeMemoryProfilerSaProxy proxy(service); @@ -109,7 +109,7 @@ bool NativeMemoryProfilerSaClientManager::CheckConfig(const std::shared_ptrduration_ == 0) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: duration cannot be 0"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaClientManager: duration cannot be 0"); return false; } if (config->shareMemorySize_ == 0) { diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_config.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_config.cpp index 7468c1ddb..e5ffb4ece 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_config.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_config.cpp @@ -84,18 +84,20 @@ bool NativeMemoryProfilerSaConfig::Unmarshalling(Parcel& parcel, std::shared_ptr void NativeMemoryProfilerSaConfig::PrintConfig(std::shared_ptr& config) { - HILOG_DEBUG(LOG_CORE, "pid: %d, filePath: %s, duration: %d, filterSize: %d, shareMemorySize: %d, processName: %s", + PROFILER_LOG_DEBUG(LOG_CORE, + "pid: %d, filePath: %s, duration: %d, filterSize: %d, shareMemorySize: %d, processName: %s", config->pid_, config->filePath_.c_str(), config->duration_, config->filterSize_, config->shareMemorySize_, config->processName_.c_str()); - HILOG_DEBUG(LOG_CORE, "maxStackDepth: %d, mallocDisable: %d, mmapDisable: %d, freeStackData: %d," \ + PROFILER_LOG_DEBUG(LOG_CORE, "maxStackDepth: %d, mallocDisable: %d, mmapDisable: %d, freeStackData: %d," \ "munmapStackData: %d", config->maxStackDepth_, config->mallocDisable_, config->mmapDisable_, config->freeStackData_, config->munmapStackData_); - HILOG_DEBUG(LOG_CORE, "mallocFreeMatchingInterval: %d, mallocFreeMatchingCnt: %d, stringCompressed: %d," \ + PROFILER_LOG_DEBUG(LOG_CORE, "mallocFreeMatchingInterval: %d, mallocFreeMatchingCnt: %d, stringCompressed: %d," \ "fpUnwind: %d, blocked: %d, recordAccurately: %d", config->mallocFreeMatchingInterval_, config->mallocFreeMatchingCnt_, config->stringCompressed_, config->fpUnwind_, config->blocked_, config->recordAccurately_); - HILOG_DEBUG(LOG_CORE, "startupMode: %d, memtraceEnable: %d, offlineSymbolization: %d, callframeCompress: %d," \ + PROFILER_LOG_DEBUG(LOG_CORE, + "startupMode: %d, memtraceEnable: %d, offlineSymbolization: %d, callframeCompress: %d," \ "statisticsInterval: %d, clockId: %d", config->startupMode_, config->memtraceEnable_, config->offlineSymbolization_, config->callframeCompress_, config->statisticsInterval_, config->clockId_); diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_death_recipient.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_death_recipient.cpp index 793425ce5..eb7b75218 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_death_recipient.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_death_recipient.cpp @@ -22,6 +22,6 @@ NativeMemoryProfilerSaDeathRecipient::NativeMemoryProfilerSaDeathRecipient() {} void NativeMemoryProfilerSaDeathRecipient::OnRemoteDied(const OHOS::wptr &object) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfiler SA has died"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfiler SA has died"); } } // namespace OHOS::Developtools::NativeDaemon \ No newline at end of file diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_proxy.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_proxy.cpp index 1997bd077..85cc0527b 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_proxy.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_proxy.cpp @@ -26,7 +26,7 @@ int32_t NativeMemoryProfilerSaProxy::Start(std::shared_ptrMarshalling(data), RET_ERR, "NativeMemoryProfilerSaConfig marshalling failed"); @@ -38,7 +38,7 @@ int32_t NativeMemoryProfilerSaProxy::Start(std::shared_ptrSendRequest(static_cast(NativeMemoryProfilerSaInterfaceCode::START), data, reply, option); if (ret != RET_OK) { - HILOG_ERROR(LOG_CORE, "Start failed"); + PROFILER_LOG_ERROR(LOG_CORE, "Start failed"); return ret; } return RET_OK; @@ -48,11 +48,11 @@ int32_t NativeMemoryProfilerSaProxy::DumpData(uint32_t fd, std::shared_ptrMarshalling(data), RET_ERR, "NativeMemoryProfilerSaConfig marshalling failed"); @@ -64,7 +64,7 @@ int32_t NativeMemoryProfilerSaProxy::DumpData(uint32_t fd, std::shared_ptrSendRequest(static_cast(NativeMemoryProfilerSaInterfaceCode::DUMP_DATA), data, reply, option); if (ret != RET_OK) { - HILOG_ERROR(LOG_CORE, "DumpData failed"); + PROFILER_LOG_ERROR(LOG_CORE, "DumpData failed"); return ret; } return RET_OK; @@ -74,7 +74,7 @@ int32_t NativeMemoryProfilerSaProxy::Stop(uint32_t pid) { MessageParcel data; if (!data.WriteInterfaceToken(NativeMemoryProfilerSaProxy::GetDescriptor())) { - HILOG_ERROR(LOG_CORE, "Stop failed to write descriptor"); + PROFILER_LOG_ERROR(LOG_CORE, "Stop failed to write descriptor"); return RET_ERR; } WRITEUINT32(data, pid, RET_ERR); @@ -85,7 +85,7 @@ int32_t NativeMemoryProfilerSaProxy::Stop(uint32_t pid) int32_t ret = remote->SendRequest(static_cast(NativeMemoryProfilerSaInterfaceCode::STOP_HOOK_PID), data, reply, option); if (ret != RET_OK) { - HILOG_ERROR(LOG_CORE, "Stop failed"); + PROFILER_LOG_ERROR(LOG_CORE, "Stop failed"); return ret; } return RET_OK; @@ -95,7 +95,7 @@ int32_t NativeMemoryProfilerSaProxy::Stop(const std::string& name) { MessageParcel data; if (!data.WriteInterfaceToken(NativeMemoryProfilerSaProxy::GetDescriptor())) { - HILOG_ERROR(LOG_CORE, "Stop failed to write descriptor"); + PROFILER_LOG_ERROR(LOG_CORE, "Stop failed to write descriptor"); return RET_ERR; } WRITESTRING(data, name, RET_ERR); @@ -106,7 +106,7 @@ int32_t NativeMemoryProfilerSaProxy::Stop(const std::string& name) int32_t ret = remote->SendRequest(static_cast(NativeMemoryProfilerSaInterfaceCode::STOP_HOOK_NAME), data, reply, option); if (ret != RET_OK) { - HILOG_ERROR(LOG_CORE, "Stop failed"); + PROFILER_LOG_ERROR(LOG_CORE, "Stop failed"); return ret; } return RET_OK; diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_service.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_service.cpp index 0a2ff2fc6..69e8df888 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_service.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_service.cpp @@ -37,7 +37,7 @@ NativeMemoryProfilerSaService::NativeMemoryProfilerSaService() : SystemAbility(N serviceEntry_ = std::make_shared(); if (!serviceEntry_->StartServer(DEFAULT_UNIX_SOCKET_HOOK_PATH)) { serviceEntry_ = nullptr; - HILOG_ERROR(LOG_CORE, "Start IPC Service FAIL"); + PROFILER_LOG_ERROR(LOG_CORE, "Start IPC Service FAIL"); return; } serviceEntry_->RegisterService(*this); @@ -57,7 +57,7 @@ bool NativeMemoryProfilerSaService::StartServiceAbility() CHECK_NOTNULL(native, false, "native is nullptr"); int32_t result = serviceManager->AddSystemAbility(NATIVE_DAEMON_SYSTEM_ABILITY_ID, native); if (result != 0) { - HILOG_ERROR(LOG_CORE, "Service native memory failed to start"); + PROFILER_LOG_ERROR(LOG_CORE, "Service native memory failed to start"); return false; } @@ -66,10 +66,10 @@ bool NativeMemoryProfilerSaService::StartServiceAbility() bool ret = abilityObject->AddDeathRecipient(new NativeMemoryProfilerSaDeathRecipient()); if (ret == false) { - HILOG_ERROR(LOG_CORE, "AddDeathRecipient failed"); + PROFILER_LOG_ERROR(LOG_CORE, "AddDeathRecipient failed"); return false; } - HILOG_INFO(LOG_CORE, "Service native memory started successfully"); + PROFILER_LOG_INFO(LOG_CORE, "Service native memory started successfully"); return true; } @@ -111,7 +111,7 @@ void NativeMemoryProfilerSaService::StopHook(uint32_t pid, std::string name) config = taskIter->second; } if (config == nullptr) { - HILOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has stop, pid: %d, process name: %s", + PROFILER_LOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has stop, pid: %d, process name: %s", pid, name.c_str()); return; } @@ -129,7 +129,7 @@ void NativeMemoryProfilerSaService::StopHook(uint32_t pid, std::string name) close(config->fd); } if (--taskNum_ == 0) { - HILOG_INFO(LOG_CORE, "StringViewMemoryHold clear"); + PROFILER_LOG_INFO(LOG_CORE, "StringViewMemoryHold clear"); StringViewMemoryHold::GetInstance().Clear(); } } @@ -144,7 +144,7 @@ int32_t NativeMemoryProfilerSaService::StartHook(std::shared_ptrpid_ > 0) ? std::to_string(config->pid_) : config->processName_; config->filePath_ = FILE_PATH_HEAD + filePathStr + FILE_PATH_TAIL; } - HILOG_INFO(LOG_CORE, "file path: %s", config->filePath_.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "file path: %s", config->filePath_.c_str()); if (!CheckConfig(config, fd)) { return RET_ERR; @@ -175,7 +175,7 @@ int32_t NativeMemoryProfilerSaService::StartHook(std::shared_ptrduration_ * TIME_BASE, true); if (timerFd == -1) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService Start Schedule Task failed"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService Start Schedule Task failed"); return RET_ERR; } @@ -204,12 +204,12 @@ int32_t NativeMemoryProfilerSaService::StartHook(std::shared_ptr& config, uint32_t fd) { if (taskNum_ + 1 > MAX_TASK_NUM) { - HILOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: Support up to 4 tasks at the same time"); + PROFILER_LOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: Support up to 4 tasks at the same time"); return false; } if (hasStartupMode_ && config->startupMode_) { - HILOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: tasks with an existing startup mode, name: %s", + PROFILER_LOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: tasks with an existing startup mode, name: %s", startupModeProcessName_.c_str()); return false; } @@ -217,17 +217,17 @@ bool NativeMemoryProfilerSaService::CheckConfig(std::shared_ptrpid_ > 0) { config->processName_.clear(); if (pidCtx_.find(config->pid_) != pidCtx_.end()) { - HILOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has started, pid: %d", config->pid_); + PROFILER_LOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has started, pid: %d", config->pid_); return false; } } else if (!config->processName_.empty()) { if (nameAndFilePathCtx_.find(config->processName_) != nameAndFilePathCtx_.end()) { - HILOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has started, process name: %s", - config->processName_.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "NativeMemoryProfilerSaService: hook has started, process name: %s", + config->processName_.c_str()); return false; } } else { - HILOG_ERROR(LOG_CORE, "The PID and process name are not configured"); + PROFILER_LOG_ERROR(LOG_CORE, "The PID and process name are not configured"); return false; } @@ -237,11 +237,12 @@ bool NativeMemoryProfilerSaService::CheckConfig(std::shared_ptrfilePath_.empty()) { if (nameAndFilePathCtx_.find(config->filePath_) != nameAndFilePathCtx_.end()) { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService: File %s is being used.", config->filePath_.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, + "NativeMemoryProfilerSaService: File %s is being used.", config->filePath_.c_str()); return false; } } else { - HILOG_ERROR(LOG_CORE, "The file path are not configured"); + PROFILER_LOG_ERROR(LOG_CORE, "The file path are not configured"); return false; } return true; @@ -263,7 +264,7 @@ void NativeMemoryProfilerSaService::FillTaskConfigContext(int32_t pid, const std hasStartupMode_ = false; } } else { - HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService: fill TaskConfig context failed"); + PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService: fill TaskConfig context failed"); } } @@ -281,7 +282,7 @@ bool NativeMemoryProfilerSaService::ProtocolProc(SocketContext &context, uint32_ std::string filePath = "/proc/" + std::to_string(peerConfig) + "/cmdline"; std::string bundleName; if (!LoadStringFromFile(filePath, bundleName)) { - HILOG_ERROR(LOG_CORE, "Get process name by pid failed!, pid: %d", peerConfig); + PROFILER_LOG_ERROR(LOG_CORE, "Get process name by pid failed!, pid: %d", peerConfig); return false; } bundleName.resize(strlen(bundleName.c_str())); @@ -295,12 +296,13 @@ bool NativeMemoryProfilerSaService::ProtocolProc(SocketContext &context, uint32_ if (auto iter = pidCtx_.find(peerConfig); iter != pidCtx_.end()) { auto [eventFd, smbFd] = iter->second->hookMgr->GetFds(peerConfig, bundleName); if (eventFd == smbFd) { - HILOG_ERROR(LOG_CORE, "Get eventFd and smbFd failed!, name: %s, pid: %d", bundleName.c_str(), peerConfig); + PROFILER_LOG_ERROR(LOG_CORE, + "Get eventFd and smbFd failed!, name: %s, pid: %d", bundleName.c_str(), peerConfig); return false; } - HILOG_INFO(LOG_CORE, - "ProtocolProc, receive message from hook client, and send hook config to process %d, name: %s", - peerConfig, bundleName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, + "ProtocolProc, receive message from hook client, and send hook config to process %d, name: %s", + peerConfig, bundleName.c_str()); ClientConfig clientConfig; iter->second->hookMgr->GetClientConfig(clientConfig); context.SendHookConfig(reinterpret_cast(&clientConfig), sizeof(clientConfig)); diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_stub.cpp b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_stub.cpp index addc20e61..d8cd489b5 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_stub.cpp +++ b/device/plugins/native_daemon/native_memory_profiler_sa/src/native_memory_profiler_sa_stub.cpp @@ -26,7 +26,7 @@ int32_t NativeMemoryProfilerSaStub::OnRemoteRequest(uint32_t code, MessageParcel { std::u16string descriptor = data.ReadInterfaceToken(); if (descriptor != INativeMemoryProfilerSa::GetDescriptor()) { - HILOG_ERROR(LOG_CORE, "Get unexpect descriptor:%s", Str16ToStr8(descriptor).c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "Get unexpect descriptor:%s", Str16ToStr8(descriptor).c_str()); return ERR_INVALID_STATE; } @@ -44,7 +44,7 @@ int32_t NativeMemoryProfilerSaStub::OnRemoteRequest(uint32_t code, MessageParcel return StubDumpFile(data, reply); } default : { - HILOG_ERROR(LOG_CORE, "Unknown code:%u", code); + PROFILER_LOG_ERROR(LOG_CORE, "Unknown code:%u", code); return IPCObjectStub::OnRemoteRequest(code, data, reply, options); } } diff --git a/device/plugins/native_daemon/native_memory_profiler_sa/util/include/define_macro.h b/device/plugins/native_daemon/native_memory_profiler_sa/util/include/define_macro.h index ed8b3c627..13b5a7d6e 100644 --- a/device/plugins/native_daemon/native_memory_profiler_sa/util/include/define_macro.h +++ b/device/plugins/native_daemon/native_memory_profiler_sa/util/include/define_macro.h @@ -32,7 +32,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEBOOL(parcel, data, ...) \ do { \ if (!(parcel).WriteBool(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteBool "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteBool "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -40,7 +40,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEINT32(parcel, data, ...) \ do { \ if (!(parcel).WriteInt32(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteInt32 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteInt32 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -48,7 +48,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEINT64(parcel, data, ...) \ do { \ if (!(parcel).WriteInt64(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteInt64 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteInt64 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -56,7 +56,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEUINT8(parcel, data, ...) \ do { \ if (!(parcel).WriteUint8(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteUint8 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteUint8 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -64,7 +64,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEUINT32(parcel, data, ...) \ do { \ if (!(parcel).WriteUint32(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteUint32 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteUint32 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -72,7 +72,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITEUINT64(parcel, data, ...) \ do { \ if (!(parcel).WriteUint64(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteUint64 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteUint64 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -80,7 +80,7 @@ namespace OHOS::Developtools::NativeDaemon { #define WRITESTRING(parcel, data, ...) \ do { \ if (!(parcel).WriteString(data)) { \ - HILOG_ERROR(LOG_CORE, "WriteString "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "WriteString "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -88,7 +88,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READBOOL(parcel, data, ...) \ do { \ if (!(parcel).ReadBool(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadBool "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadBool "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -96,7 +96,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READINT32(parcel, data, ...) \ do { \ if (!(parcel).ReadInt32(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadInt32 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadInt32 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -104,7 +104,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READINT64(parcel, data, ...) \ do { \ if (!(parcel).ReadInt64(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadInt64 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadInt64 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -112,7 +112,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READUINT8(parcel, data, ...) \ do { \ if (!(parcel).ReadUint8(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadUint8 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadUint8 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -120,7 +120,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READUINT32(parcel, data, ...) \ do { \ if (!(parcel).ReadUint32(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadUint32 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadUint32 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -128,7 +128,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READUINT64(parcel, data, ...) \ do { \ if (!(parcel).ReadUint64(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadUint64 "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadUint64 "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) @@ -136,7 +136,7 @@ namespace OHOS::Developtools::NativeDaemon { #define READSTRING(parcel, data, ...) \ do { \ if (!(parcel).ReadString(data)) { \ - HILOG_ERROR(LOG_CORE, "ReadString "#data" failed"); \ + PROFILER_LOG_ERROR(LOG_CORE, "ReadString "#data" failed"); \ return DEFRET(false, ##__VA_ARGS__); \ } \ } while (0) diff --git a/device/plugins/native_daemon/src/debug_logger.cpp b/device/plugins/native_daemon/src/debug_logger.cpp index 62b74ddc8..52cdc6262 100644 --- a/device/plugins/native_daemon/src/debug_logger.cpp +++ b/device/plugins/native_daemon/src/debug_logger.cpp @@ -67,14 +67,13 @@ void DebugLogger::Disable(bool disable) #if is_ohos #ifndef CONFIG_NO_HILOG -int DebugLogger::HiLog(std::string &buffer) const +void DebugLogger::HiLog(std::string &buffer) const { size_t lastLF = buffer.find_last_of('\n'); if (lastLF != std::string::npos) { buffer.erase(lastLF, 1); } - return OHOS::HiviewDFX::HiLog::Debug(HIPERF_HILOG_LABLE[MODULE_DEFAULT], "%{public}s", - buffer.c_str()); + HILOG_DEBUG(LOG_CORE, "%{public}s", buffer.c_str()); } #endif #endif @@ -109,7 +108,7 @@ int DebugLogger::Log(DebugLevel level, const std::string &logTag, const char *fm if (enableHilog_) { #if is_ohos && !defined(CONFIG_NO_HILOG) std::lock_guard lock(logMutex_); - ret = HiLog(buffer); // to the hilog + HiLog(buffer); // to the hilog #endif } else if (file_ != nullptr) { std::lock_guard lock(logMutex_); diff --git a/device/plugins/native_daemon/src/hook_manager.cpp b/device/plugins/native_daemon/src/hook_manager.cpp index 7eef75e5f..d2c234b03 100644 --- a/device/plugins/native_daemon/src/hook_manager.cpp +++ b/device/plugins/native_daemon/src/hook_manager.cpp @@ -63,13 +63,13 @@ bool HookManager::CheckProcess() pidPath = "/proc/" + std::to_string(pid) + "/status"; if (stat(pidPath.c_str(), &statBuf) != 0) { // pid = 0; - HILOG_ERROR(LOG_CORE, "%s: hook process does not exist", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: hook process does not exist", __func__); return false; } else { auto [iter, isExist] = pidCache.emplace(pid); if (isExist) { hookCtx_.emplace_back(std::make_shared(pid)); - HILOG_INFO(LOG_CORE, "hook context: pid: %d", pid); + PROFILER_LOG_INFO(LOG_CORE, "hook context: pid: %d", pid); } continue; } @@ -82,12 +82,13 @@ bool HookManager::CheckProcess() if (hookConfig_.response_library_mode()) { if (hookCtx_.size() > RESPONSE_MAX_PID_COUNT) { - HILOG_ERROR(LOG_CORE, "%s: The maximum allowed is to set %d PIDs.", __func__, RESPONSE_MAX_PID_COUNT); + PROFILER_LOG_ERROR(LOG_CORE, "%s: The maximum allowed is to set %d PIDs.", + __func__, RESPONSE_MAX_PID_COUNT); return false; } } else { if (hookCtx_.size() > MAX_PID_COUNT) { - HILOG_ERROR(LOG_CORE, "%s: The maximum allowed is to set %d PIDs.", __func__, MAX_PID_COUNT); + PROFILER_LOG_ERROR(LOG_CORE, "%s: The maximum allowed is to set %d PIDs.", __func__, MAX_PID_COUNT); return false; } } @@ -100,18 +101,19 @@ bool HookManager::CheckProcessName() const std::string processName = hookConfig_.process_name(); bool isExist = COMMON::IsProcessExist(processName, pidValue); if (hookConfig_.startup_mode() || !isExist) { - HILOG_INFO(LOG_CORE, "Wait process %s start or restart, set param", hookConfig_.process_name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "Wait process %s start or restart, set param", hookConfig_.process_name().c_str()); std::string cmd = STARTUP + hookConfig_.process_name(); int ret = SystemSetParameter(PARAM_NAME.c_str(), cmd.c_str()); if (ret < 0) { - HILOG_ERROR(LOG_CORE, "set param failed, please manually set param and start process(%s)", - hookConfig_.process_name().c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "set param failed, please manually set param and start process(%s)", + hookConfig_.process_name().c_str()); } else { - HILOG_INFO(LOG_CORE, "set param success, please start process(%s)", hookConfig_.process_name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "set param success, please start process(%s)", + hookConfig_.process_name().c_str()); hookCtx_.emplace_back(std::make_shared(hookConfig_.process_name())); } } else if (pidValue != -1) { - HILOG_INFO(LOG_CORE, "Process %s exist, pid = %d", hookConfig_.process_name().c_str(), pidValue); + PROFILER_LOG_INFO(LOG_CORE, "Process %s exist, pid = %d", hookConfig_.process_name().c_str(), pidValue); for (const auto& item : hookCtx_) { if (item->pid == pidValue) { return true; @@ -119,7 +121,8 @@ bool HookManager::CheckProcessName() } hookCtx_.emplace_back(std::make_shared(pidValue)); } else { - HILOG_ERROR(LOG_CORE, "The startup mode parameter is not set, name: %s", hookConfig_.process_name().c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "The startup mode parameter is not set, name: %s", + hookConfig_.process_name().c_str()); return false; } return true; @@ -144,15 +147,15 @@ bool HookManager::RegisterAgentPlugin(const std::string& pluginPath) if (commandPoller_->RegisterPlugin(request, response)) { if (response.status() == ResponseStatus::OK) { - HILOG_DEBUG(LOG_CORE, "response.plugin_id() = %d", response.plugin_id()); + PROFILER_LOG_DEBUG(LOG_CORE, "response.plugin_id() = %d", response.plugin_id()); agentIndex_ = response.plugin_id(); - HILOG_DEBUG(LOG_CORE, "RegisterPlugin OK"); + PROFILER_LOG_DEBUG(LOG_CORE, "RegisterPlugin OK"); } else { - HILOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL 1"); + PROFILER_LOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL 1"); return false; } } else { - HILOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL 2"); + PROFILER_LOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL 2"); return false; } @@ -168,7 +171,7 @@ bool HookManager::UnregisterAgentPlugin(const std::string& pluginPath) if (commandPoller_->UnregisterPlugin(request, response)) { CHECK_TRUE(response.status() == ResponseStatus::OK, false, "UnregisterPlugin FAIL 1"); } else { - HILOG_DEBUG(LOG_CORE, "UnregisterPlugin FAIL 2"); + PROFILER_LOG_DEBUG(LOG_CORE, "UnregisterPlugin FAIL 2"); return false; } agentIndex_ = -1; @@ -218,7 +221,7 @@ bool HookManager::HandleHookContext(const std::shared_ptr& ctx) } else if (!ctx->processName.empty()) { ctx->smbName = "hooknativesmb_" + ctx->processName; } else { - HILOG_ERROR(LOG_CORE, "HandleHookContext context error, pid: %d, process name: %s", + PROFILER_LOG_ERROR(LOG_CORE, "HandleHookContext context error, pid: %d, process name: %s", ctx->pid, ctx->processName.c_str()); return false; } @@ -240,15 +243,15 @@ bool HookManager::HandleHookContext(const std::shared_ptr& ctx) ctx->eventNotifier->GetFd(), std::bind(&HookManager::ReadShareMemory, this, ctx)); - HILOG_INFO(LOG_CORE, "hookservice smbFd = %d, eventFd = %d\n", ctx->shareMemoryBlock->GetfileDescriptor(), - ctx->eventNotifier->GetFd()); + PROFILER_LOG_INFO(LOG_CORE, "hookservice smbFd = %d, eventFd = %d\n", ctx->shareMemoryBlock->GetfileDescriptor(), + ctx->eventNotifier->GetFd()); ctx->isRecordAccurately = hookConfig_.record_accurately(); - HILOG_INFO(LOG_CORE, "hookConfig filter size = %d, malloc disable = %d mmap disable = %d", + PROFILER_LOG_INFO(LOG_CORE, "hookConfig filter size = %d, malloc disable = %d mmap disable = %d", hookConfig_.filter_size(), hookConfig_.malloc_disable(), hookConfig_.mmap_disable()); - HILOG_INFO(LOG_CORE, "hookConfig fp unwind = %d, max stack depth = %d, record_accurately=%d", + PROFILER_LOG_INFO(LOG_CORE, "hookConfig fp unwind = %d, max stack depth = %d, record_accurately=%d", hookConfig_.fp_unwind(), hookConfig_.max_stack_depth(), ctx->isRecordAccurately); - HILOG_INFO(LOG_CORE, "hookConfig offline_symbolization = %d", hookConfig_.offline_symbolization()); + PROFILER_LOG_INFO(LOG_CORE, "hookConfig offline_symbolization = %d", hookConfig_.offline_symbolization()); ctx->stackData = std::make_shared(STACK_DATA_SIZE); CHECK_TRUE(ctx->stackData != nullptr, false, "Create StackDataRepeater FAIL"); @@ -263,19 +266,19 @@ bool HookManager::HandleHookContext(const std::shared_ptr& ctx) bool HookManager::CreatePluginSession(const std::vector& config) { - HILOG_DEBUG(LOG_CORE, "CreatePluginSession"); + PROFILER_LOG_DEBUG(LOG_CORE, "CreatePluginSession"); // save config if (!config.empty()) { std::string cfgData = config[0].config_data(); if (hookConfig_.ParseFromArray(reinterpret_cast(cfgData.c_str()), cfgData.size()) <= 0) { - HILOG_ERROR(LOG_CORE, "%s: ParseFromArray failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s: ParseFromArray failed", __func__); return false; } } int32_t uShortMax = (std::numeric_limits::max)(); if (hookConfig_.filter_size() > uShortMax) { - HILOG_WARN(LOG_CORE, "%s: filter size invalid(size exceed 65535), reset to 65535!", __func__); + PROFILER_LOG_WARN(LOG_CORE, "%s: filter size invalid(size exceed 65535), reset to 65535!", __func__); hookConfig_.set_filter_size(uShortMax); } if (!CheckProcess()) { // Check and initialize the context for the target process. @@ -311,13 +314,13 @@ bool HookManager::CreatePluginSession(const std::vector& c } if (hookCtx_.empty()) { - HILOG_ERROR(LOG_CORE, "HookManager no task"); + PROFILER_LOG_ERROR(LOG_CORE, "HookManager no task"); return false; } if (hookConfig_.save_file() && !hookConfig_.file_name().empty()) { fpHookData_ = fopen(hookConfig_.file_name().c_str(), "wb+"); if (fpHookData_ == nullptr) { - HILOG_INFO(LOG_CORE, "fopen file %s fail", hookConfig_.file_name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "fopen file %s fail", hookConfig_.file_name().c_str()); return false; } } @@ -329,7 +332,7 @@ bool HookManager::CreatePluginSession(const std::vector& c ClientConfig clientConfig; GetClientConfig(clientConfig); std::string clientConfigStr = clientConfig.ToString(); - HILOG_INFO(LOG_CORE, "send hook client config:%s\n", clientConfigStr.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "send hook client config:%s\n", clientConfigStr.c_str()); hookService_ = std::make_shared(clientConfig, shared_from_this()); CHECK_NOTNULL(hookService_, false, "HookService create failed!"); } @@ -393,7 +396,7 @@ bool HookManager::DestroyPluginSession(const std::vector& pluginIds) for (const auto& item : hookCtx_) { if (item->eventPoller != nullptr) { - HILOG_ERROR(LOG_CORE, "eventPoller unset!"); + PROFILER_LOG_ERROR(LOG_CORE, "eventPoller unset!"); if (item->eventNotifier != nullptr) { item->eventPoller->RemoveFileDescriptor(item->eventNotifier->GetFd()); } @@ -437,19 +440,19 @@ bool HookManager::StopPluginSession(const std::vector& pluginIds) } for (const auto& item : hookCtx_) { if (item->pid > 0) { - HILOG_INFO(LOG_CORE, "stop command : send 37 signal to process %d", item->pid); + PROFILER_LOG_INFO(LOG_CORE, "stop command : send 37 signal to process %d", item->pid); if (kill(item->pid, SIGNAL_STOP_HOOK) == -1) { const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "send 37 signal to process %d , error = %s", item->pid, buf); + PROFILER_LOG_ERROR(LOG_CORE, "send 37 signal to process %d , error = %s", item->pid, buf); } } else { - HILOG_INFO(LOG_CORE, "StopPluginSession: pid(%d) is less or equal zero.", item->pid); + PROFILER_LOG_INFO(LOG_CORE, "StopPluginSession: pid(%d) is less or equal zero.", item->pid); } CHECK_TRUE(item->stackPreprocess != nullptr, false, "stop StackPreprocess FAIL"); item->stackPreprocess->StopTakeResults(); - HILOG_INFO(LOG_CORE, "StopTakeResults success"); + PROFILER_LOG_INFO(LOG_CORE, "StopTakeResults success"); if (hookConfig_.statistics_interval() > 0) { item->stackPreprocess->FlushRecordStatistics(); } @@ -468,9 +471,9 @@ void HookManager::ResetStartupParam() if (hookConfig_.startup_mode()) { int ret = SystemSetParameter(PARAM_NAME.c_str(), resetParam.c_str()); if (ret < 0) { - HILOG_WARN(LOG_CORE, "set param failed, please reset param(%s)", PARAM_NAME.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "set param failed, please reset param(%s)", PARAM_NAME.c_str()); } else { - HILOG_INFO(LOG_CORE, "reset param success"); + PROFILER_LOG_INFO(LOG_CORE, "reset param success"); } } } @@ -483,7 +486,7 @@ bool HookManager::ReportPluginBasicData(const std::vector& pluginIds) bool HookManager::CreateWriter(std::string pluginName, uint32_t bufferSize, int smbFd, int eventFd, bool isProtobufSerialize) { - HILOG_DEBUG(LOG_CORE, "agentIndex_ %d", agentIndex_); + PROFILER_LOG_DEBUG(LOG_CORE, "agentIndex_ %d", agentIndex_); RegisterWriter(std::make_shared(pluginName, VERSION, bufferSize, smbFd, eventFd, agentIndex_)); return true; } @@ -553,18 +556,18 @@ void HookManager::StartPluginSession() if (item->stackPreprocess == nullptr) { continue; } - HILOG_ERROR(LOG_CORE, "StartPluginSession name: %s", item->processName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "StartPluginSession name: %s", item->processName.c_str()); item->stackPreprocess->StartTakeResults(); if (item->pid > 0) { - HILOG_INFO(LOG_CORE, "start command : send 36 signal to process %d", item->pid); + PROFILER_LOG_INFO(LOG_CORE, "start command : send 36 signal to process %d", item->pid); if (kill(item->pid, SIGNAL_START_HOOK) == -1) { const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "send 36 signal error = %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "send 36 signal error = %s", buf); } } else { - HILOG_INFO(LOG_CORE, "StartPluginSession: pid(%d) is less or equal zero.", item->pid); + PROFILER_LOG_INFO(LOG_CORE, "StartPluginSession: pid(%d) is less or equal zero.", item->pid); } } } @@ -573,7 +576,7 @@ void HookManager::WriteHookConfig() { for (const auto& item : hookCtx_) { if (item == nullptr) { - HILOG_ERROR(LOG_CORE, "HookManager WriteHookConfig failed"); + PROFILER_LOG_ERROR(LOG_CORE, "HookManager WriteHookConfig failed"); return; } item->stackPreprocess->WriteHookConfig(); diff --git a/device/plugins/native_daemon/src/hook_service.cpp b/device/plugins/native_daemon/src/hook_service.cpp index 9d15a8a57..a95fafc87 100644 --- a/device/plugins/native_daemon/src/hook_service.cpp +++ b/device/plugins/native_daemon/src/hook_service.cpp @@ -46,7 +46,7 @@ bool HookService::StartService(const std::string& unixSocketName) serviceEntry_ = std::make_shared(); if (!serviceEntry_->StartServer(unixSocketName)) { serviceEntry_ = nullptr; - HILOG_DEBUG(LOG_CORE, "Start IPC Service FAIL"); + PROFILER_LOG_DEBUG(LOG_CORE, "Start IPC Service FAIL"); return false; } serviceEntry_->RegisterService(*this); @@ -66,7 +66,7 @@ bool HookService::ProtocolProc(SocketContext &context, uint32_t pnum, const int8 std::string filePath = "/proc/" + std::to_string(peerConfig) + "/cmdline"; std::string bundleName; if (!LoadStringFromFile(filePath, bundleName)) { - HILOG_ERROR(LOG_CORE, "Get process name by pid failed!, pid: %d", peerConfig); + PROFILER_LOG_ERROR(LOG_CORE, "Get process name by pid failed!, pid: %d", peerConfig); return false; } bundleName.resize(strlen(bundleName.c_str())); @@ -85,12 +85,12 @@ bool HookService::ProtocolProc(SocketContext &context, uint32_t pnum, const int8 std::lock_guard lock(mtx_); auto [eventFd, smbFd] = hookMgr_->GetFds(peerConfig, procName); if (eventFd == smbFd) { - HILOG_ERROR(LOG_CORE, "Get eventFd and smbFd failed!, name: %s, pid: %d", procName.c_str(), peerConfig); + PROFILER_LOG_ERROR(LOG_CORE, "Get eventFd and smbFd failed!, name: %s, pid: %d", procName.c_str(), peerConfig); return false; } - HILOG_DEBUG(LOG_CORE, "ProtocolProc, receive message from hook client, and send hook config to process %d", - peerConfig); + PROFILER_LOG_DEBUG(LOG_CORE, "ProtocolProc, receive message from hook client, and send hook config to process %d", + peerConfig); context.SendHookConfig(reinterpret_cast(&clientConfig_), sizeof(clientConfig_)); context.SendFileDescriptor(smbFd); context.SendFileDescriptor(eventFd); diff --git a/device/plugins/native_daemon/src/hook_standalone.cpp b/device/plugins/native_daemon/src/hook_standalone.cpp index 9b606f5d5..828997aa8 100644 --- a/device/plugins/native_daemon/src/hook_standalone.cpp +++ b/device/plugins/native_daemon/src/hook_standalone.cpp @@ -34,7 +34,7 @@ std::shared_ptr g_hookManager; NativeHookConfig g_nativeConfig; static void SignalHandl(int signo) { - HILOG_INFO(LOG_CORE, "SignalHandl recv %d", signo); + PROFILER_LOG_INFO(LOG_CORE, "SignalHandl recv %d", signo); std::vector pluginIds; g_hookManager->StopPluginSession(pluginIds); g_hookManager->DestroyPluginSession(pluginIds); @@ -81,7 +81,7 @@ void SetNativeHookConfig(const HookData& hookData) g_nativeConfig.response_library_mode()) { g_hookManager->SethookStandalone(true); } - HILOG_INFO(LOG_CORE, "hookData config = %s", hookData.ToString().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "hookData config = %s", hookData.ToString().c_str()); } bool StartHook(HookData& hookData) diff --git a/device/plugins/native_daemon/src/stack_data_repeater.cpp b/device/plugins/native_daemon/src/stack_data_repeater.cpp index 0c20eeaf1..7c3c415e4 100644 --- a/device/plugins/native_daemon/src/stack_data_repeater.cpp +++ b/device/plugins/native_daemon/src/stack_data_repeater.cpp @@ -48,7 +48,7 @@ void StackDataRepeater::Close() rawDataQueue_.clear(); closed_ = true; } - HILOG_INFO(LOG_CORE, "StackDataRepeater Close, reducedStackCount_ : %" PRIx64 " ", reducedStackCount_); + PROFILER_LOG_INFO(LOG_CORE, "StackDataRepeater Close, reducedStackCount_ : %" PRIx64 " ", reducedStackCount_); slotCondVar_.notify_all(); itemCondVar_.notify_all(); } @@ -59,7 +59,8 @@ bool StackDataRepeater::PutRawStack(const RawStackPtr& rawData, bool isRecordAcc std::unique_lock lock(mutex_); if ((rawData == nullptr) && (rawDataQueue_.size() > 0)) { - HILOG_INFO(LOG_CORE, "no need put nullptr if queue has data, rawDataQueue_.size() = %zu", rawDataQueue_.size()); + PROFILER_LOG_INFO(LOG_CORE, "no need put nullptr if queue has data, rawDataQueue_.size() = %zu", + rawDataQueue_.size()); return true; } while (rawDataQueue_.size() >= maxSize_ && !closed_) { diff --git a/device/plugins/native_daemon/src/stack_preprocess.cpp b/device/plugins/native_daemon/src/stack_preprocess.cpp index 9cd1723e5..154265cf8 100644 --- a/device/plugins/native_daemon/src/stack_preprocess.cpp +++ b/device/plugins/native_daemon/src/stack_preprocess.cpp @@ -62,29 +62,29 @@ StackPreprocess::StackPreprocess(const StackDataRepeaterPtr& dataRepeater, runtime_instance = std::make_shared(hookConfig_); if (hookConfig_.malloc_free_matching_interval() > MAX_MATCH_INTERVAL) { - HILOG_INFO(LOG_CORE, "Not support set %d", hookConfig_.malloc_free_matching_interval()); + PROFILER_LOG_INFO(LOG_CORE, "Not support set %d", hookConfig_.malloc_free_matching_interval()); hookConfig_.set_malloc_free_matching_interval(MAX_MATCH_INTERVAL); } if (hookConfig_.malloc_free_matching_cnt() > MAX_MATCH_CNT) { - HILOG_INFO(LOG_CORE, "Not support set %d", hookConfig_.malloc_free_matching_cnt()); + PROFILER_LOG_INFO(LOG_CORE, "Not support set %d", hookConfig_.malloc_free_matching_cnt()); hookConfig_.set_malloc_free_matching_cnt(MAX_MATCH_CNT); } - HILOG_INFO(LOG_CORE, "malloc_free_matching_interval = %d malloc_free_matching_cnt = %d\n", + PROFILER_LOG_INFO(LOG_CORE, "malloc_free_matching_interval = %d malloc_free_matching_cnt = %d\n", hookConfig_.malloc_free_matching_interval(), hookConfig_.malloc_free_matching_cnt()); if (hookConfig_.statistics_interval() > 0) { statisticsInterval_ = std::chrono::seconds(hookConfig_.statistics_interval()); } - HILOG_INFO(LOG_CORE, "statistics_interval = %d statisticsInterval_ = %lld \n", + PROFILER_LOG_INFO(LOG_CORE, "statistics_interval = %d statisticsInterval_ = %lld \n", hookConfig_.statistics_interval(), statisticsInterval_.count()); hookDataClockId_ = COMMON::GetClockId(hookConfig_.clock()); - HILOG_INFO(LOG_CORE, "StackPreprocess(): pluginDataClockId = %d hookDataClockId = %d \n", + PROFILER_LOG_INFO(LOG_CORE, "StackPreprocess(): pluginDataClockId = %d hookDataClockId = %d \n", pluginDataClockId_, hookDataClockId_); if (hookConfig_.save_file() && fpHookData_ == nullptr) { - HILOG_ERROR(LOG_CORE, "If you need to save the file, please set the file_name"); + PROFILER_LOG_ERROR(LOG_CORE, "If you need to save the file, please set the file_name"); } - HILOG_INFO(LOG_CORE, "isHookStandaloneSerialize_ = %d", isHookStandaloneSerialize_); + PROFILER_LOG_INFO(LOG_CORE, "isHookStandaloneSerialize_ = %d", isHookStandaloneSerialize_); #if defined(__arm__) u64regs_.resize(PERF_REG_ARM_MAX); #else @@ -131,18 +131,18 @@ bool StackPreprocess::StartTakeResults() bool StackPreprocess::StopTakeResults() { - HILOG_INFO(LOG_CORE, "start StopTakeResults"); + PROFILER_LOG_INFO(LOG_CORE, "start StopTakeResults"); CHECK_NOTNULL(dataRepeater_, false, "data repeater null"); CHECK_TRUE(thread_.get_id() != std::thread::id(), false, "thread invalid"); isStopTakeData_ = true; dataRepeater_->PutRawStack(nullptr, false); - HILOG_INFO(LOG_CORE, "StopTakeResults Wait thread join"); + PROFILER_LOG_INFO(LOG_CORE, "StopTakeResults Wait thread join"); if (thread_.joinable()) { thread_.join(); } - HILOG_INFO(LOG_CORE, "StopTakeResults Wait thread join success"); + PROFILER_LOG_INFO(LOG_CORE, "StopTakeResults Wait thread join success"); return true; } @@ -158,7 +158,7 @@ void StackPreprocess::TakeResults() minStackDepth = static_cast(hookConfig_.max_stack_depth()); } minStackDepth += FILTER_STACK_DEPTH; - HILOG_INFO(LOG_CORE, "TakeResults thread %d, start!", gettid()); + PROFILER_LOG_INFO(LOG_CORE, "TakeResults thread %d, start!", gettid()); while (1) { BatchNativeHookData stackData; RawStackPtr batchRawStack[MAX_BATCH_CNT] = {nullptr}; @@ -176,7 +176,7 @@ void StackPreprocess::TakeResults() BaseStackRawData* mmapRawData = rawData->stackConext; std::string filePath(reinterpret_cast(rawData->data)); COMMON::AdaptSandboxPath(filePath, rawData->stackConext->pid); - HILOG_DEBUG(LOG_CORE, "MMAP_FILE_TYPE curMmapAddr=%p, MAP_FIXED=%d, " + PROFILER_LOG_DEBUG(LOG_CORE, "MMAP_FILE_TYPE curMmapAddr=%p, MAP_FIXED=%d, " "PROT_EXEC=%d, offset=%" PRIu64 ", filePath=%s", mmapRawData->addr, mmapRawData->mmapArgs.flags & MAP_FIXED, mmapRawData->mmapArgs.flags & PROT_EXEC, mmapRawData->mmapArgs.offset, filePath.data()); @@ -200,13 +200,14 @@ void StackPreprocess::TakeResults() if (!rawData->reportFlag) { ignoreCnts_++; if (ignoreCnts_ % LOG_PRINT_TIMES == 0) { - HILOG_INFO(LOG_CORE, "ignoreCnts_ = %d quene size = %zu\n", ignoreCnts_, dataRepeater_->Size()); + PROFILER_LOG_INFO(LOG_CORE, "ignoreCnts_ = %d quene size = %zu\n", + ignoreCnts_, dataRepeater_->Size()); } continue; } eventCnts_++; if (eventCnts_ % LOG_PRINT_TIMES == 0) { - HILOG_INFO(LOG_CORE, "eventCnts_ = %d quene size = %zu\n", eventCnts_, dataRepeater_->Size()); + PROFILER_LOG_INFO(LOG_CORE, "eventCnts_ = %d quene size = %zu\n", eventCnts_, dataRepeater_->Size()); } callFrames_.clear(); if (hookConfig_.fp_unwind()) { @@ -229,7 +230,7 @@ void StackPreprocess::TakeResults() #else if (memcpy_s(u64regs_.data(), sizeof(uint64_t) * PERF_REG_ARM64_MAX, rawData->data, sizeof(uint64_t) * PERF_REG_ARM64_MAX) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s regs failed"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s regs failed"); } #endif } @@ -249,7 +250,7 @@ void StackPreprocess::TakeResults() bool ret = runtime_instance->UnwindStack(u64regs_, rawData->stackData, rawData->stackSize, rawData->stackConext->pid, rawData->stackConext->tid, callFrames_, stackDepth); if (!ret) { - HILOG_ERROR(LOG_CORE, "unwind fatal error"); + PROFILER_LOG_ERROR(LOG_CORE, "unwind fatal error"); continue; } } @@ -267,14 +268,14 @@ void StackPreprocess::TakeResults() uint64_t curTimeCost = (end.tv_sec - start.tv_sec) * MAX_MATCH_CNT * MAX_MATCH_CNT * MAX_MATCH_CNT + (end.tv_nsec - start.tv_nsec); if (curTimeCost >= LONG_TIME_THRESHOLD) { - HILOG_ERROR(LOG_CORE, "bigTimeCost %" PRIu64 " event=%d, realFrameDepth=%zu, " + PROFILER_LOG_ERROR(LOG_CORE, "bigTimeCost %" PRIu64 " event=%d, realFrameDepth=%zu, " "callFramesDepth=%zu\n", curTimeCost, rawData->stackConext->type, realFrameDepth, callFrames_.size()); } timeCost += curTimeCost; unwindTimes++; if (unwindTimes % LOG_PRINT_TIMES == 0) { - HILOG_ERROR(LOG_CORE, "unwindTimes %" PRIu64" cost time = %" PRIu64" mean cost = %" PRIu64"\n", + PROFILER_LOG_ERROR(LOG_CORE, "unwindTimes %" PRIu64" cost time = %" PRIu64" mean cost = %" PRIu64"\n", unwindTimes.load(), timeCost.load(), timeCost.load() / unwindTimes.load()); } #endif @@ -297,7 +298,7 @@ void StackPreprocess::TakeResults() } } } - HILOG_INFO(LOG_CORE, "TakeResults thread %d, exit!", gettid()); + PROFILER_LOG_INFO(LOG_CORE, "TakeResults thread %d, exit!", gettid()); } inline void StackPreprocess::ReportThreadNameMap(uint32_t tid, const std::string& tname, @@ -490,7 +491,7 @@ void StackPreprocess::SetHookData(RawStackPtr rawStack, break; } default: { - HILOG_ERROR(LOG_CORE, "statistics event type:%d error", rawStack->stackConext->type); + PROFILER_LOG_ERROR(LOG_CORE, "statistics event type:%d error", rawStack->stackConext->type); break; } } @@ -626,7 +627,7 @@ inline void StackPreprocess::SetAllocStatisticsData(const RawStackPtr& rawStack, break; } default: { - HILOG_ERROR(LOG_CORE, "SetAllocStatisticsData event type error"); + PROFILER_LOG_ERROR(LOG_CORE, "SetAllocStatisticsData event type error"); break; } } @@ -780,7 +781,7 @@ void StackPreprocess::SetSymbolInfo(uint32_t filePathId, ElfSymbolTable& symbolI BatchNativeHookData& batchNativeHookData) { if (symbolInfo.symEntSize == 0) { - HILOG_ERROR(LOG_CORE, "SetSymbolInfo get symbolInfo failed"); + PROFILER_LOG_ERROR(LOG_CORE, "SetSymbolInfo get symbolInfo failed"); return; } NativeHookData* hookData = batchNativeHookData.add_events(); @@ -807,12 +808,12 @@ void StackPreprocess::FlushData(BatchNativeHookData& stackData) google::protobuf::TextFormat::PrintToString(StandardStackData, &str); size_t n = fwrite(str.data(), 1, str.size(), fpHookData_); fflush(fpHookData_); - HILOG_DEBUG(LOG_CORE, "Flush Data fwrite n = %zu str.size() = %zu", n, str.size()); + PROFILER_LOG_DEBUG(LOG_CORE, "Flush Data fwrite n = %zu str.size() = %zu", n, str.size()); } else { Flush(buffer_.get(), length); } } else { - HILOG_ERROR(LOG_CORE, "the data is larger than MAX_BUFFER_SIZE, flush failed"); + PROFILER_LOG_ERROR(LOG_CORE, "the data is larger than MAX_BUFFER_SIZE, flush failed"); } } } @@ -820,7 +821,7 @@ void StackPreprocess::FlushData(BatchNativeHookData& stackData) void StackPreprocess::Flush(const uint8_t* src, size_t size) { if (src == nullptr) { - HILOG_ERROR(LOG_CORE, "Flush src is nullptr"); + PROFILER_LOG_ERROR(LOG_CORE, "Flush src is nullptr"); return; } if (isSaService_) { @@ -853,7 +854,7 @@ void StackPreprocess::GetSymbols(const std::string& filePath, ElfSymbolTable& sy symbols.textVaddr = elfPtr->GetStartVaddr(); symbols.textOffset = elfPtr->GetStartOffset(); if (symbols.textVaddr == (std::numeric_limits::max)()) { - HILOG_ERROR(LOG_CORE, "GetSymbols get textVaddr failed"); + PROFILER_LOG_ERROR(LOG_CORE, "GetSymbols get textVaddr failed"); return; } @@ -872,16 +873,16 @@ void StackPreprocess::GetSymbols(const std::string& filePath, ElfSymbolTable& sy symbols.symEntSize = shdr.entSize; symbols.symTable.resize(shdr.size); if (!elfPtr->GetSectionData(symbols.symTable.data(), shdr.size, symSecName)) { - HILOG_ERROR(LOG_CORE, "GetSymbols get symbol section data failed"); + PROFILER_LOG_ERROR(LOG_CORE, "GetSymbols get symbol section data failed"); return; } if (!elfPtr->GetSectionInfo(shdr, strSecName)) { - HILOG_ERROR(LOG_CORE, "GetSymbols get str section failed"); + PROFILER_LOG_ERROR(LOG_CORE, "GetSymbols get str section failed"); return; } symbols.strTable.resize(shdr.size); if (!elfPtr->GetSectionData(symbols.strTable.data(), shdr.size, strSecName)) { - HILOG_ERROR(LOG_CORE, "GetSymbols get str section failed"); + PROFILER_LOG_ERROR(LOG_CORE, "GetSymbols get str section failed"); return; } } diff --git a/device/plugins/native_daemon/src/virtual_runtime.cpp b/device/plugins/native_daemon/src/virtual_runtime.cpp index b1a84ba79..4d472454f 100644 --- a/device/plugins/native_daemon/src/virtual_runtime.cpp +++ b/device/plugins/native_daemon/src/virtual_runtime.cpp @@ -54,8 +54,8 @@ VirtualRuntime::VirtualRuntime(const NativeHookConfig& hookConfig): hookConfig_( VirtualRuntime::~VirtualRuntime() { - HILOG_INFO(LOG_CORE, "%s:%d UserSymbolCache size = %zu", __func__, __LINE__, userSymbolCache_.size()); - HILOG_INFO(LOG_CORE, "Total number of call stack errors: %" PRIu64 "", callStackErrCnt.load()); + PROFILER_LOG_INFO(LOG_CORE, "%s:%d UserSymbolCache size = %zu", __func__, __LINE__, userSymbolCache_.size()); + PROFILER_LOG_INFO(LOG_CORE, "Total number of call stack errors: %" PRIu64 "", callStackErrCnt.load()); ClearMaps(); } @@ -159,7 +159,7 @@ bool VirtualRuntime::GetSymbolName(pid_t pid, pid_t tid, std::vector& #else ++callStackErrCnt; if (callStackErrCnt.load() % CALL_STACK_ERROR_TIMES == 0) { - HILOG_DEBUG(LOG_CORE, "number of call stack errors: %" PRIu64 "", callStackErrCnt.load()); + PROFILER_LOG_DEBUG(LOG_CORE, "number of call stack errors: %" PRIu64 "", callStackErrCnt.load()); } callFrames.erase(callFrameIt, callFrames.end()); return true; @@ -182,9 +182,9 @@ void VirtualRuntime::UpdateMaps(pid_t pid, pid_t tid) { auto &thread = UpdateThread(pid, tid); if (thread.ParseMap(processMaps_, true)) { - HILOG_DEBUG(LOG_CORE, "voluntarily update maps succeed"); + PROFILER_LOG_DEBUG(LOG_CORE, "voluntarily update maps succeed"); } else { - HILOG_DEBUG(LOG_CORE, "voluntarily update maps ignore"); + PROFILER_LOG_DEBUG(LOG_CORE, "voluntarily update maps ignore"); } } diff --git a/device/plugins/native_daemon/src/virtual_thread.cpp b/device/plugins/native_daemon/src/virtual_thread.cpp index 44560e178..007fe872a 100644 --- a/device/plugins/native_daemon/src/virtual_thread.cpp +++ b/device/plugins/native_daemon/src/virtual_thread.cpp @@ -277,10 +277,10 @@ bool VirtualThread::ParseMap(std::vector>& memMaps, bool memMaps.insert(memMaps.end(), tempMap.begin(), tempMap.end()); if (mapsAdded) { - HILOG_DEBUG(LOG_CORE, "maps changed and need sort"); + PROFILER_LOG_DEBUG(LOG_CORE, "maps changed and need sort"); SortMaps(); } else { - HILOG_DEBUG(LOG_CORE, "maps no change"); + PROFILER_LOG_DEBUG(LOG_CORE, "maps no change"); return false; } virtualruntime_->soBegin_ = 0; diff --git a/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp b/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp index 298b6cddf..a1d2aa854 100644 --- a/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp +++ b/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp @@ -49,7 +49,7 @@ public: static void StartServerStub(std::string name) { int processNum = fork(); - HILOG_INFO(LOG_CORE, "processNum : %d", processNum); + PROFILER_LOG_INFO(LOG_CORE, "processNum : %d", processNum); if (processNum == 0) { if (DEFAULT_HIPROFILERD_PATH == name) { // start running hiprofilerd @@ -64,7 +64,7 @@ public: static void StopServerStub(int processNum) { std::string stopCmd = "kill " + std::to_string(processNum); - HILOG_INFO(LOG_CORE, "stop command : %s", stopCmd.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "stop command : %s", stopCmd.c_str()); std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); } }; diff --git a/device/plugins/native_hook/src/hook_client.cpp b/device/plugins/native_hook/src/hook_client.cpp index 8205ae9cb..939dcf861 100644 --- a/device/plugins/native_hook/src/hook_client.cpp +++ b/device/plugins/native_hook/src/hook_client.cpp @@ -148,7 +148,7 @@ bool inline __attribute__((always_inline)) UpdateThreadName(std::shared_ptrSendStackWithPayload(&tnameData, sizeof(BaseStackRawData) + strlen(tnameData.name) + 1, nullptr, 0); if (!ret) { - HILOG_DEBUG(LOG_CORE, "Send thread name failed!"); + PROFILER_LOG_DEBUG(LOG_CORE, "Send thread name failed!"); return ret; } } @@ -179,7 +179,7 @@ uint32_t inline __attribute__((always_inline)) GetTagId(std::shared_ptrSendStackWithPayload(&tagData, sizeof(BaseStackRawData) + strlen(tagName) + 1, nullptr, 0); @@ -198,7 +198,7 @@ bool ohos_malloc_hook_on_start(void) g_hookPid = GetRealPid(); g_mallocTimes = 0; if (g_hookClient != nullptr) { - HILOG_INFO(LOG_CORE, "hook already started"); + PROFILER_LOG_INFO(LOG_CORE, "hook already started"); return true; } else { g_ClientConfig.Reset(); @@ -211,7 +211,7 @@ bool ohos_malloc_hook_on_start(void) pthread_setspecific(g_hookTid, nullptr); pthread_key_create(&g_updateThreadNameCount, nullptr); pthread_setspecific(g_updateThreadNameCount, reinterpret_cast(0)); - HILOG_INFO(LOG_CORE, "ohos_malloc_hook_on_start"); + PROFILER_LOG_INFO(LOG_CORE, "ohos_malloc_hook_on_start"); GetMainThreadRuntimeStackRange(g_filterStaLibRange); constexpr int paramBufferLen = 128; char paramOutBuf[paramBufferLen] = {0}; @@ -223,7 +223,7 @@ bool ohos_malloc_hook_on_start(void) g_maxSize = max > 0 ? max : INT_MAX; g_ClientConfig.filterSize = min > 0 ? min : 0; } - HILOG_INFO(LOG_CORE, "persist.hiviewdfx.profiler.mem.filter %s, min %d, max %d", + PROFILER_LOG_INFO(LOG_CORE, "persist.hiviewdfx.profiler.mem.filter %s, min %d, max %d", paramOutBuf, g_ClientConfig.filterSize, g_maxSize); } return true; @@ -237,7 +237,7 @@ void* ohos_release_on_end(void*) pthread_key_delete(g_hookTid); pthread_key_delete(g_updateThreadNameCount); g_ClientConfig.Reset(); - HILOG_INFO(LOG_CORE, "ohos_malloc_hook_on_end, mallocTimes :%" PRIu64, g_mallocTimes.load()); + PROFILER_LOG_INFO(LOG_CORE, "ohos_malloc_hook_on_end, mallocTimes :%" PRIu64, g_mallocTimes.load()); COMMON::PrintMallinfoLog("before hook(byte) => ", g_miStart); struct mallinfo2 miFinal = mallinfo2(); COMMON::PrintMallinfoLog("after hook(byte) => ", miFinal); @@ -251,7 +251,7 @@ bool ohos_malloc_hook_on_end(void) } pthread_t threadEnd; if (pthread_create(&threadEnd, nullptr, ohos_release_on_end, nullptr)) { - HILOG_INFO(LOG_CORE, "create ohos_release_on_end fail"); + PROFILER_LOG_INFO(LOG_CORE, "create ohos_release_on_end fail"); return false; } pthread_detach(threadEnd); @@ -371,7 +371,7 @@ void* hook_malloc(void* (*fn)(size_t), size_t size) g_timeCost += (end.tv_sec - start.tv_sec) * S_TO_NS + (end.tv_nsec - start.tv_nsec); g_dataCounts += stackSize; if (g_mallocTimes % PRINT_INTERVAL == 0) { - HILOG_ERROR(LOG_CORE, + PROFILER_LOG_ERROR(LOG_CORE, "g_mallocTimes %" PRIu64" cost time = %" PRIu64" copy data bytes = %" PRIu64" mean cost = %" PRIu64"\n", g_mallocTimes.load(), g_timeCost.load(), g_dataCounts.load(), g_timeCost.load() / g_mallocTimes.load()); } @@ -675,7 +675,7 @@ void* hook_mmap(void*(*fn)(void*, size_t, int, int, int, off_t), rawdata.tagId = GetTagId(holder, fileName); } } else { - HILOG_ERROR(LOG_CORE, "Set mmap fd linked file name failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "Set mmap fd linked file name failed!"); } } if (!UpdateThreadName(holder)) { @@ -766,7 +766,7 @@ int hook_prctl(int(*fn)(int, ...), std::weak_ptr weakClient = g_hookClient; auto holder = weakClient.lock(); if (strcpy_s(rawdata.name, PATH_MAX + 1, reinterpret_cast(arg5))) { - HILOG_ERROR(LOG_CORE, "Set tag name failed"); + PROFILER_LOG_ERROR(LOG_CORE, "Set tag name failed"); } if (holder != nullptr) { holder->SendStackWithPayload(&rawdata, diff --git a/device/plugins/native_hook/src/hook_socket_client.cpp b/device/plugins/native_hook/src/hook_socket_client.cpp index 0e164cb9a..cc774936f 100644 --- a/device/plugins/native_hook/src/hook_socket_client.cpp +++ b/device/plugins/native_hook/src/hook_socket_client.cpp @@ -40,7 +40,7 @@ HookSocketClient::~HookSocketClient() { if (stackWriter_) { stackWriter_->Flush(); - HILOG_INFO(LOG_CORE, "~HookSocketClient Flush()"); + PROFILER_LOG_INFO(LOG_CORE, "~HookSocketClient Flush()"); } unixSocketClient_ = nullptr; stackWriter_ = nullptr; @@ -67,9 +67,9 @@ bool HookSocketClient::ProtocolProc(SocketContext &context, uint32_t pnum, const *config_ = *reinterpret_cast(const_cast(buf)); config_->maxStackDepth = config_->maxStackDepth > MAX_UNWIND_DEPTH ? MAX_UNWIND_DEPTH : config_->maxStackDepth; std::string configStr = config_->ToString(); - HILOG_INFO(LOG_CORE, "recv hook client config:%s\n", configStr.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "recv hook client config:%s\n", configStr.c_str()); sampler_->InitSampling(config_->sampleInterval); - HILOG_INFO(LOG_CORE, "%s sample interval %" PRIu64 "", __func__, sampler_->GetSampleInterval()); + PROFILER_LOG_INFO(LOG_CORE, "%s sample interval %" PRIu64 "", __func__, sampler_->GetSampleInterval()); smbFd_ = context.ReceiveFileDiscriptor(); eventFd_ = context.ReceiveFileDiscriptor(); std::string smbName = "hooknativesmb_" + std::to_string(pid_); diff --git a/device/plugins/native_hook/src/stack_writer.cpp b/device/plugins/native_hook/src/stack_writer.cpp index f68422129..3c5d833f8 100644 --- a/device/plugins/native_hook/src/stack_writer.cpp +++ b/device/plugins/native_hook/src/stack_writer.cpp @@ -26,10 +26,10 @@ StackWriter::StackWriter(std::string name, bool blocked) : pluginName_(name), blocked_(blocked) { - HILOG_INFO(LOG_CORE, "%s:%s %d [%d] [%d]", __func__, name.c_str(), size, smbFd, eventFd); + PROFILER_LOG_INFO(LOG_CORE, "%s:%s %d [%d] [%d]", __func__, name.c_str(), size, smbFd, eventFd); shareMemoryBlock_ = ShareMemoryAllocator::GetInstance().CreateMemoryBlockRemote(name, size, smbFd); if (shareMemoryBlock_ == nullptr) { - HILOG_DEBUG(LOG_CORE, "%s:create shareMemoryBlock_ failed!", __func__); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:create shareMemoryBlock_ failed!", __func__); } eventNotifier_ = EventNotifier::CreateWithFd(eventFd); lastFlushTime_ = std::chrono::steady_clock::now(); @@ -37,7 +37,7 @@ StackWriter::StackWriter(std::string name, StackWriter::~StackWriter() { - HILOG_DEBUG(LOG_CORE, "%s:destroy eventfd = %d!", __func__, eventNotifier_ ? eventNotifier_->GetFd() : -1); + PROFILER_LOG_DEBUG(LOG_CORE, "%s:destroy eventfd = %d!", __func__, eventNotifier_ ? eventNotifier_->GetFd() : -1); eventNotifier_ = nullptr; ShareMemoryAllocator::GetInstance().ReleaseMemoryBlockRemote(pluginName_); shareMemoryBlock_ = nullptr; @@ -45,7 +45,7 @@ StackWriter::~StackWriter() void StackWriter::Report() const { - HILOG_DEBUG(LOG_CORE, "%s:stats B: %" PRIu64 ", P: %d, W:%" PRIu64 ", F: %d", __func__, + PROFILER_LOG_DEBUG(LOG_CORE, "%s:stats B: %" PRIu64 ", P: %d, W:%" PRIu64 ", F: %d", __func__, bytesCount_.load(), bytesPending_.load(), writeCount_.load(), flushCount_.load()); } diff --git a/device/plugins/native_hook/test/unittest/check_hook_data_test.cpp b/device/plugins/native_hook/test/unittest/check_hook_data_test.cpp index c7e3cf09c..4e73ceeda 100644 --- a/device/plugins/native_hook/test/unittest/check_hook_data_test.cpp +++ b/device/plugins/native_hook/test/unittest/check_hook_data_test.cpp @@ -146,7 +146,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "snprintf_s(%s) error, errno(%d:%s)", file.c_str(), errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "snprintf_s(%s) error, errno(%d:%s)", file.c_str(), errno, buf); return -1; } @@ -155,7 +155,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "realpath(%s) failed, errno(%d:%s)", file.c_str(), errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "realpath(%s) failed, errno(%d:%s)", file.c_str(), errno, buf); return -1; } @@ -164,18 +164,18 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, realPath, errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to open(%s), errno(%d:%s)", __func__, realPath, errno, buf); return -1; } if (g_buffer == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:empty address, g_buffer is NULL", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:empty address, g_buffer is NULL", __func__); close(fd); return -1; } bytesRead = read(fd, g_buffer.get(), BUFFER_SIZE - 1); if (bytesRead <= 0) { close(fd); - HILOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, realPath, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, realPath, errno); return -1; } close(fd); @@ -212,7 +212,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "ApplyForMalloc: malloc failure, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "ApplyForMalloc: malloc failure, errno(%d:%s)", errno, buf); return; } DepthFree(depth, p); @@ -294,7 +294,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "ApplyForCalloc: calloc failure, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "ApplyForCalloc: calloc failure, errno(%d:%s)", errno, buf); return; } DepthFree(depth, p); @@ -337,7 +337,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "ApplyForRealloc: malloc failure, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "ApplyForRealloc: malloc failure, errno(%d:%s)", errno, buf); return; } char *np = DepthRealloc(depth, p, reallocSize); @@ -346,7 +346,7 @@ public: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "ApplyForRealloc: realloc failure, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "ApplyForRealloc: realloc failure, errno(%d:%s)", errno, buf); return; } DepthFree(depth, np); diff --git a/device/plugins/native_hook/test/unittest/hook_socket_client_test.cpp b/device/plugins/native_hook/test/unittest/hook_socket_client_test.cpp index 500f37130..95d9c9322 100644 --- a/device/plugins/native_hook/test/unittest/hook_socket_client_test.cpp +++ b/device/plugins/native_hook/test/unittest/hook_socket_client_test.cpp @@ -81,7 +81,7 @@ HWTEST_F(HookSocketClientTest, SendStack, TestSize.Level1) size_t metaSize = sizeof(ts); std::unique_ptr buffer = std::make_unique(metaSize); if (memcpy_s(buffer.get(), metaSize, &ts, sizeof(ts)) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s ts failed"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s ts failed"); } metaSize = sizeof(ts); EXPECT_FALSE(hookClient.SendStack(buffer.get(), metaSize)); diff --git a/device/plugins/native_hook/test/unittest/stack_writer_test.cpp b/device/plugins/native_hook/test/unittest/stack_writer_test.cpp index 23b6e3d46..22204528a 100644 --- a/device/plugins/native_hook/test/unittest/stack_writer_test.cpp +++ b/device/plugins/native_hook/test/unittest/stack_writer_test.cpp @@ -43,7 +43,7 @@ int InitShareMemory() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock ftruncate ERR : %s", buf); return -1; } @@ -53,7 +53,7 @@ int InitShareMemory() const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr mmap ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock g_smbAddr mmap ERR : %s", buf); return -1; } diff --git a/device/plugins/network_plugin/src/network_plugin.cpp b/device/plugins/network_plugin/src/network_plugin.cpp index 5ec0a1708..9725fb5b2 100644 --- a/device/plugins/network_plugin/src/network_plugin.cpp +++ b/device/plugins/network_plugin/src/network_plugin.cpp @@ -38,7 +38,7 @@ int NetworkPlugin::Start(const uint8_t* configData, uint32_t configSize) CHECK_NOTNULL(buffer_, -1, "%s:NetworkPlugin, buffer_ is null", __func__); if (protoConfig_.ParseFromArray(configData, configSize) <= 0) { - HILOG_ERROR(LOG_CORE, "%s:NetworkPlugin, parseFromArray failed!", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:NetworkPlugin, parseFromArray failed!", __func__); return -1; } @@ -47,7 +47,7 @@ int NetworkPlugin::Start(const uint8_t* configData, uint32_t configSize) pidUid_.emplace(pid, GetUid(pid)); } - HILOG_INFO(LOG_CORE, "%s:NetworkPlugin, start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:NetworkPlugin, start success!", __func__); return 0; } @@ -161,7 +161,7 @@ int NetworkPlugin::Stop() fp_ = nullptr; pidUid_.clear(); - HILOG_INFO(LOG_CORE, "%s:NetworkPlugin, stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:NetworkPlugin, stop success!", __func__); return 0; } @@ -193,7 +193,7 @@ int32_t NetworkPlugin::GetUid(int32_t pid) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "%s:NetworkPlugin, open %s failed, errno(%s)", __func__, path.c_str(), buf); + PROFILER_LOG_ERROR(LOG_CORE, "%s:NetworkPlugin, open %s failed, errno(%s)", __func__, path.c_str(), buf); return -1; } do { @@ -204,7 +204,7 @@ int32_t NetworkPlugin::GetUid(int32_t pid) getline(input, line); if (!strncmp(line.c_str(), "Uid:", strlen("Uid:"))) { std::string str = line.substr(strlen("Uid:\t")); - HILOG_INFO(LOG_CORE, "%s:NetworkPlugin, line(%s), str(%s)", __func__, line.c_str(), str.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "%s:NetworkPlugin, line(%s), str(%s)", __func__, line.c_str(), str.c_str()); return strtol(str.c_str(), &end, DEC_BASE); } } while (!input.eof()); diff --git a/device/plugins/process_plugin/src/process_data_plugin.cpp b/device/plugins/process_plugin/src/process_data_plugin.cpp index fa94b198b..4b031ecbf 100644 --- a/device/plugins/process_plugin/src/process_data_plugin.cpp +++ b/device/plugins/process_plugin/src/process_data_plugin.cpp @@ -42,7 +42,7 @@ ProcessDataPlugin::ProcessDataPlugin() ProcessDataPlugin::~ProcessDataPlugin() { - HILOG_INFO(LOG_CORE, "%s:~ProcessDataPlugin!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:~ProcessDataPlugin!", __func__); buffer_ = nullptr; @@ -56,7 +56,7 @@ int ProcessDataPlugin::Start(const uint8_t* configData, uint32_t configSize) CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, RET_FAIL, "%s:parseFromArray failed!", __func__); - HILOG_INFO(LOG_CORE, "%s:start success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:start success!", __func__); return RET_SUCC; } @@ -96,7 +96,7 @@ int ProcessDataPlugin::Stop() cpuTime_.clear(); bootTime_.clear(); - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } @@ -106,7 +106,7 @@ DIR* ProcessDataPlugin::OpenDestDir(const char* dirPath) destDir = opendir(dirPath); if (destDir == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:failed to opendir(%s), errno=%d", __func__, dirPath, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:failed to opendir(%s), errno=%d", __func__, dirPath, errno); } return destDir; @@ -136,20 +136,20 @@ int32_t ProcessDataPlugin::ReadProcPidFile(int32_t pid, const char* pFileName) ssize_t bytesRead = 0; if (snprintf_s(fileName, sizeof(fileName), sizeof(fileName) - 1, "%s%d/%s", path_.c_str(), pid, pFileName) < 0) { - HILOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:snprintf_s error", __func__); } if (realpath(fileName, realPath) == nullptr) { - HILOG_ERROR(LOG_CORE, "%s:realpath failed, errno=%d", __func__, errno); + PROFILER_LOG_ERROR(LOG_CORE, "%s:realpath failed, errno=%d", __func__, errno); return RET_FAIL; } fd = open(realPath, O_RDONLY | O_CLOEXEC); if (fd == -1) { - HILOG_INFO(LOG_CORE, "%s:failed to open(%s), errno=%d", __func__, fileName, errno); + PROFILER_LOG_INFO(LOG_CORE, "%s:failed to open(%s), errno=%d", __func__, fileName, errno); err_ = errno; return RET_FAIL; } if (buffer_.get() == nullptr) { - HILOG_INFO(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:empty address, buffer_ is NULL", __func__); err_ = RET_NULL_ADDR; close(fd); return RET_FAIL; @@ -157,7 +157,7 @@ int32_t ProcessDataPlugin::ReadProcPidFile(int32_t pid, const char* pFileName) bytesRead = read(fd, buffer_.get(), READ_BUFFER_SIZE - 1); if (bytesRead < 0) { close(fd); - HILOG_INFO(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, fileName, errno); + PROFILER_LOG_INFO(LOG_CORE, "%s:failed to read(%s), errno=%d", __func__, fileName, errno); err_ = errno; return RET_FAIL; } @@ -216,7 +216,7 @@ void ProcessDataPlugin::WriteProcess(T& processinfo, const char* pFile, uint32_t char* end = nullptr; int32_t value = static_cast(strtoul(totalbuffer.CurWord(), &end, DEC_BASE)); if (value < 0) { - HILOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); } processinfo.set_pid(value); } else if (BufnCmp(totalbuffer.CurWord(), totalbuffer.CurWordSize(), "PPid", strlen("PPid"))) { @@ -227,7 +227,7 @@ void ProcessDataPlugin::WriteProcess(T& processinfo, const char* pFile, uint32_t char* end = nullptr; int32_t value = static_cast(strtoul(totalbuffer.CurWord(), &end, DEC_BASE)); if (value < 0) { - HILOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); } processinfo.set_ppid(value); } else if (BufnCmp(totalbuffer.CurWord(), totalbuffer.CurWordSize(), "Uid", strlen("Uid"))) { @@ -240,7 +240,7 @@ void ProcessDataPlugin::WriteProcess(T& processinfo, const char* pFile, uint32_t char* end = nullptr; int32_t value = static_cast(strtoul(curWord.c_str(), &end, DEC_BASE)); if (value < 0) { - HILOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s:strtoull value failed", __func__); } processinfo.set_uid(value); break; @@ -297,7 +297,7 @@ template bool ProcessDataPlugin::WriteProcesseList(T& processData) while (int32_t pid = GetValidPid(procDir)) { if (pid <= 0) { closedir(procDir); - HILOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, pid); + PROFILER_LOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, pid); return false; } addPidBySort(pid); @@ -324,7 +324,7 @@ template bool ProcessDataPlugin::WriteThreadData(int pid, T& cpuInf while (int32_t tid = GetValidPid(procDir)) { if (tid <= 0) { closedir(procDir); - HILOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, tid); + PROFILER_LOG_WARN(LOG_CORE, "%s: get pid[%d] failed", __func__, tid); return false; } i++; diff --git a/device/plugins/sample_plugin/src/sample_plugin.cpp b/device/plugins/sample_plugin/src/sample_plugin.cpp index c6da90f1a..3f69b2aca 100644 --- a/device/plugins/sample_plugin/src/sample_plugin.cpp +++ b/device/plugins/sample_plugin/src/sample_plugin.cpp @@ -41,15 +41,15 @@ uint64_t SamplePlugin::GetTimeMS() int SamplePlugin::Start(const uint8_t* configData, uint32_t configSize) { - HILOG_INFO(LOG_CORE, "%s:config data -->configSize=%d", __func__, configSize); + PROFILER_LOG_INFO(LOG_CORE, "%s:config data -->configSize=%d", __func__, configSize); CHECK_TRUE(configData != nullptr, -1, "SamplePlugin: param invalid!!!"); for (uint32_t i = 0; i < configSize; i++) { - HILOG_INFO(LOG_CORE, "%s:configData[%d] = 0x%02x", __func__, i, configData[i]); + PROFILER_LOG_INFO(LOG_CORE, "%s:configData[%d] = 0x%02x", __func__, i, configData[i]); } // 反序列化 CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, -1, "%s:parseFromArray failed!", __func__); - HILOG_INFO(LOG_CORE, "%s:pid = %d", __func__, protoConfig_.pid()); + PROFILER_LOG_INFO(LOG_CORE, "%s:pid = %d", __func__, protoConfig_.pid()); // 插件准备工作 return 0; @@ -92,6 +92,6 @@ int SamplePlugin::Report(uint8_t* data, uint32_t dataSize) int SamplePlugin::Stop() { - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } \ No newline at end of file diff --git a/device/plugins/stream_plugin/src/stream_plugin.cpp b/device/plugins/stream_plugin/src/stream_plugin.cpp index 385daa980..6d3487e82 100644 --- a/device/plugins/stream_plugin/src/stream_plugin.cpp +++ b/device/plugins/stream_plugin/src/stream_plugin.cpp @@ -47,7 +47,7 @@ int StreamPlugin::Stop() if (writeThread_.joinable()) { writeThread_.join(); } - HILOG_INFO(LOG_CORE, "%s:stop success!", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:stop success!", __func__); return 0; } @@ -59,7 +59,7 @@ int StreamPlugin::SetWriter(WriterStruct* writer) void StreamPlugin::Loop(void) { - HILOG_INFO(LOG_CORE, "%s:transporter thread %d start !!!!!", __func__, gettid()); + PROFILER_LOG_INFO(LOG_CORE, "%s:transporter thread %d start !!!!!", __func__, gettid()); CHECK_NOTNULL(resultWriter_, NO_RETVAL, "%s: resultWriter_ nullptr", __func__); uint32_t index = 0; @@ -87,5 +87,5 @@ void StreamPlugin::Loop(void) index++; } - HILOG_INFO(LOG_CORE, "%s:transporter thread %d exit !!!!!", __func__, gettid()); + PROFILER_LOG_INFO(LOG_CORE, "%s:transporter thread %d exit !!!!!", __func__, gettid()); } \ No newline at end of file diff --git a/device/plugins/xpower_plugin/src/xpower_plugin.cpp b/device/plugins/xpower_plugin/src/xpower_plugin.cpp index fde9b588b..0f243c25d 100644 --- a/device/plugins/xpower_plugin/src/xpower_plugin.cpp +++ b/device/plugins/xpower_plugin/src/xpower_plugin.cpp @@ -42,27 +42,27 @@ XpowerPlugin::~XpowerPlugin() {} int XpowerPlugin::Start(const uint8_t *configData, uint32_t configSize) { - HILOG_INFO(LOG_CORE, "%s:config data -->configSize=%d", __func__, configSize); + PROFILER_LOG_INFO(LOG_CORE, "%s:config data -->configSize=%d", __func__, configSize); CHECK_TRUE(configData != nullptr, -1, "XpowerPlugin error: param invalid!!!"); // 反序列化 CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, -1, "%s:parseFromArray failed!", __func__); uint32_t messageType = static_cast(OptimizeMessageType::MESSAGE_OPTIMIZE_STOP); std::string bundleName = protoConfig_.bundle_name(); if (bundleName.empty()) { - HILOG_ERROR(LOG_CORE, "XpowerPlugin error : bundle name is empty!"); + PROFILER_LOG_ERROR(LOG_CORE, "XpowerPlugin error : bundle name is empty!"); return -1; } // 判断进程是否存在 int processId = -1; bool isExsit = COMMON::IsProcessExist(bundleName, processId); if (!isExsit) { - HILOG_ERROR(LOG_CORE, "%s:the process %s does not exist.", __func__, bundleName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "%s:the process %s does not exist.", __func__, bundleName.c_str()); return -1; } // check bundleName int32_t uid = COMMON::GetPackageUid(bundleName); if (uid < MIN_USER_ID) { - HILOG_ERROR(LOG_CORE, "the bundle name %s is not supported", bundleName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "the bundle name %s is not supported", bundleName.c_str()); return -1; } if (protoConfig_.message_type().size() > 0) { @@ -71,13 +71,13 @@ int XpowerPlugin::Start(const uint8_t *configData, uint32_t configSize) messageType |= mesType; } } - HILOG_INFO(LOG_CORE, "bundleName is %s,messagetype is %d", bundleName.c_str(), messageType); + PROFILER_LOG_INFO(LOG_CORE, "bundleName is %s,messagetype is %d", bundleName.c_str(), messageType); // 加载对应so 库文件 if (!StartPowerManager(messageType, bundleName)) { - HILOG_ERROR(LOG_CORE, "start power manager failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "start power manager failed!"); return -1; } - HILOG_INFO(LOG_CORE, "finish register the callback function:%s", __func__); + PROFILER_LOG_INFO(LOG_CORE, "finish register the callback function:%s", __func__); return 0; } @@ -87,13 +87,13 @@ bool XpowerPlugin::StartPowerManager(std::uint32_t messageType, std::string &bun powerClientHandle_ = dlopen("/system/lib64/libxpower_manager_client.z.so", RTLD_LAZY); } if (powerClientHandle_ == nullptr) { - HILOG_ERROR(LOG_CORE, "%s :fail to open libxpower_manager_client.z.so", __func__); + PROFILER_LOG_ERROR(LOG_CORE, "%s :fail to open libxpower_manager_client.z.so", __func__); return false; } // 注册回调 StartOptimizeMode startOptimizeMode = (StartOptimizeMode)dlsym(powerClientHandle_, "StartOptimizeC"); if (startOptimizeMode == nullptr) { - HILOG_ERROR(LOG_CORE, "Failed to dlsy startOptimizeMode"); + PROFILER_LOG_ERROR(LOG_CORE, "Failed to dlsy startOptimizeMode"); return false; } config_.messageType = messageType; @@ -102,7 +102,7 @@ bool XpowerPlugin::StartPowerManager(std::uint32_t messageType, std::string &bun std::placeholders::_3); listenerHandle_ = startOptimizeMode(config_); if (listenerHandle_ == nullptr) { - HILOG_ERROR(LOG_CORE, "Failed to startOptimizeMode"); + PROFILER_LOG_ERROR(LOG_CORE, "Failed to startOptimizeMode"); return false; } dataQueuePtr_ = std::make_shared(MAX_QUEUE_SIZE); @@ -112,7 +112,7 @@ bool XpowerPlugin::StartPowerManager(std::uint32_t messageType, std::string &bun void XpowerPlugin::OptimizeCallback(const std::uint32_t messageType, const uint8_t *protoData, size_t protoSize) { if (protoData == nullptr || protoSize <= 0) { - HILOG_ERROR(LOG_CORE, "the power message is invalid !"); + PROFILER_LOG_ERROR(LOG_CORE, "the power message is invalid !"); return; } // write protoData to file @@ -121,14 +121,14 @@ void XpowerPlugin::OptimizeCallback(const std::uint32_t messageType, const uint8 resultWriter_->flush(resultWriter_); } if (dataQueuePtr_->Size() >= MAX_QUEUE_SIZE) { - HILOG_ERROR(LOG_CORE, "The buffer queue is full,discard message"); + PROFILER_LOG_ERROR(LOG_CORE, "The buffer queue is full,discard message"); return; } // 拷贝 auto rawData = std::make_shared(); rawData->baseData = std::make_unique(protoSize); if (memcpy_s(rawData->baseData.get(), protoSize, protoData, protoSize) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s raw powerdata failed!"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s raw powerdata failed!"); return; } rawData->length = protoSize; @@ -138,17 +138,17 @@ void XpowerPlugin::OptimizeCallback(const std::uint32_t messageType, const uint8 int XpowerPlugin::Report(uint8_t *data, uint32_t dataSize) { - HILOG_INFO(LOG_CORE, "power: report the data to caller"); + PROFILER_LOG_INFO(LOG_CORE, "power: report the data to caller"); if (dataQueuePtr_->Empty()) { return 0; } std::shared_ptr result = nullptr; if (!dataQueuePtr_->WaitAndPop(result, std::chrono::milliseconds(WAIT_DURATION))) { - HILOG_ERROR(LOG_CORE, "fetch data error!"); + PROFILER_LOG_ERROR(LOG_CORE, "fetch data error!"); return 0; } if (result == nullptr) { - HILOG_ERROR(LOG_CORE, "fetch data error!"); + PROFILER_LOG_ERROR(LOG_CORE, "fetch data error!"); return 0; } if (result->length > dataSize) { @@ -165,15 +165,15 @@ void XpowerPlugin::SetWriter(WriterStruct *writer) int XpowerPlugin::Stop() { - HILOG_INFO(LOG_CORE, "%s:begin to stop xpower plugin", __func__); + PROFILER_LOG_INFO(LOG_CORE, "%s:begin to stop xpower plugin", __func__); StopOptimizeMode stopOptimizeMode = (StopOptimizeMode)dlsym(powerClientHandle_, "StopOptimizeC"); if (stopOptimizeMode == nullptr) { - HILOG_ERROR(LOG_CORE, "Faile to dlsym StopOptimizeC"); + PROFILER_LOG_ERROR(LOG_CORE, "Faile to dlsym StopOptimizeC"); return -1; } if (listenerHandle_ != nullptr) { stopOptimizeMode(listenerHandle_); - HILOG_INFO(LOG_CORE, "stop xpower plugin callback"); + PROFILER_LOG_INFO(LOG_CORE, "stop xpower plugin callback"); } if (powerClientHandle_ != nullptr) { dlclose(powerClientHandle_); diff --git a/device/services/ipc/src/client_connection.cpp b/device/services/ipc/src/client_connection.cpp index 0ece538a0..42983e6f5 100644 --- a/device/services/ipc/src/client_connection.cpp +++ b/device/services/ipc/src/client_connection.cpp @@ -28,7 +28,7 @@ ClientConnection::ClientConnection(int sfd, ServiceEntry& serviceEntry) clientState_ = CLIENT_STAT_WORKING; lastProcMS_ = GetTimeMS(); serviceEntry_ = &serviceEntry; - HILOG_INFO(LOG_CORE, "new ClientConnection construct"); + PROFILER_LOG_INFO(LOG_CORE, "new ClientConnection construct"); CreateRecvThread(); } @@ -41,7 +41,7 @@ int ClientConnection::RawProtocolProc(uint32_t pnum, const int8_t* buf, const ui struct RawPointToService* prrs = (struct RawPointToService*)buf; protoServiceName_ = prrs->serviceName_; serviceBase_ = const_cast(serviceEntry_->FindServiceByName(protoServiceName_)); - HILOG_INFO(LOG_CORE, "RAW_PROTOCOL_POINTTO_SERVICE %s", protoServiceName_.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "RAW_PROTOCOL_POINTTO_SERVICE %s", protoServiceName_.c_str()); } return 1; default: diff --git a/device/services/ipc/src/client_map.cpp b/device/services/ipc/src/client_map.cpp index c63bfbc52..95d1ae0b3 100644 --- a/device/services/ipc/src/client_map.cpp +++ b/device/services/ipc/src/client_map.cpp @@ -55,7 +55,7 @@ int ClientMap::AutoRelease() case CLIENT_STAT_WAIT_THREAD_EXIT: break; case CLIENT_STAT_THREAD_EXITED: - HILOG_INFO(LOG_CORE, "AutoRelease release %d", iter->first); + PROFILER_LOG_INFO(LOG_CORE, "AutoRelease release %d", iter->first); socketClients_.erase(iter->first); return 1; break; diff --git a/device/services/ipc/src/socket_context.cpp b/device/services/ipc/src/socket_context.cpp index e1df71514..631561098 100644 --- a/device/services/ipc/src/socket_context.cpp +++ b/device/services/ipc/src/socket_context.cpp @@ -41,28 +41,28 @@ SocketContext::SocketContext() SocketContext::~SocketContext() { if (socketHandle_ >= 0) { - HILOG_ERROR(LOG_CORE, "SocketContext socketHandle_ = %d", socketHandle_); + PROFILER_LOG_ERROR(LOG_CORE, "SocketContext socketHandle_ = %d", socketHandle_); int ret = shutdown(socketHandle_, SHUT_RDWR); if (ret < 0) { const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "shutdown socket err = %d %s", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "shutdown socket err = %d %s", errno, buf); } ret = close(socketHandle_); if (ret < 0) { const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "close socket err = %d %s", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "close socket err = %d %s", errno, buf); } socketHandle_ = -1; } if (recvThread_.joinable()) { recvThread_.join(); } - HILOG_ERROR(LOG_CORE, "~SocketContext recvThread join success"); + PROFILER_LOG_ERROR(LOG_CORE, "~SocketContext recvThread join success"); } int SocketContext::RawProtocolProc(uint32_t pnum, const int8_t* buf, const uint32_t size) @@ -107,12 +107,12 @@ void* SocketContext::UnixSocketRecv(void* pp) CHECK_TRUE(pssr->socketHandle_ != -1, nullptr, "UnixSocketRecv pssr->socketHandle_ ==-1"); while (pssr->socketHandle_ >= 0) { if (!ReceiveData(pssr->socketHandle_, buf.data(), head_size)) { - HILOG_DEBUG(LOG_CORE, "====== IPC LOST CONNECT ======"); + PROFILER_LOG_DEBUG(LOG_CORE, "====== IPC LOST CONNECT ======"); break; } if (pph->protoSize > bufferSize) { if (pph->protoSize > PROTO_SIZE_MAX) { - HILOG_ERROR(LOG_CORE, "buffer size out of range %d/%d", pph->protoSize, PROTO_SIZE_MAX); + PROFILER_LOG_ERROR(LOG_CORE, "buffer size out of range %d/%d", pph->protoSize, PROTO_SIZE_MAX); break; } bufferSize = (pph->protoSize / MEMORY_BLOCK_UNIT + 1) * MEMORY_BLOCK_UNIT; @@ -121,7 +121,7 @@ void* SocketContext::UnixSocketRecv(void* pp) } if (!ReceiveData(pssr->socketHandle_, buf.data() + head_size, pph->protoSize - head_size)) { - HILOG_DEBUG(LOG_CORE, "====== IPC LOST CONNECT ======"); + PROFILER_LOG_DEBUG(LOG_CORE, "====== IPC LOST CONNECT ======"); break; } switch (pph->protoType & PROTOCOL_TYPE_FILTER) { @@ -135,12 +135,12 @@ void* SocketContext::UnixSocketRecv(void* pp) } break; default: - HILOG_ERROR(LOG_CORE, "unknown protocol %d", pph->protoType); + PROFILER_LOG_ERROR(LOG_CORE, "unknown protocol %d", pph->protoType); break; } } pssr->clientState_ = CLIENT_STAT_THREAD_EXITED; - HILOG_DEBUG(LOG_CORE, "UnixSocketRecv thread exit"); + PROFILER_LOG_DEBUG(LOG_CORE, "UnixSocketRecv thread exit"); return nullptr; } @@ -226,7 +226,7 @@ bool SocketContext::SendFileDescriptor(int fd) char buf[CMSG_SPACE(1 * sizeof(int))] = {0}; char data; if (memset_s(buf, sizeof(buf), 0, sizeof(buf)) != EOK) { - HILOG_ERROR(LOG_CORE, "memset_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "memset_s error!"); } struct iovec io = {.iov_base = &data, .iov_len = 1}; msg.msg_iov = &io; @@ -238,7 +238,7 @@ bool SocketContext::SendFileDescriptor(int fd) cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int) * 1); if (memcpy_s(CMSG_DATA(cmsg), 1 * sizeof(int), &fd, 1 * sizeof(int)) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s error"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s error"); } CHECK_TRUE(sendmsg(socketHandle_, &msg, 0) != -1, false, "SendFileDescriptor FAIL"); diff --git a/device/services/ipc/src/unix_socket_client.cpp b/device/services/ipc/src/unix_socket_client.cpp index 26d7a0c25..3f4d77f02 100644 --- a/device/services/ipc/src/unix_socket_client.cpp +++ b/device/services/ipc/src/unix_socket_client.cpp @@ -32,7 +32,7 @@ UnixSocketClient::~UnixSocketClient() {} bool UnixSocketClient::Connect(const std::string addrname, ServiceBase& serviceBase) { - HILOG_ERROR(LOG_CORE, "UnixSocketClient connect"); + PROFILER_LOG_ERROR(LOG_CORE, "UnixSocketClient connect"); CHECK_TRUE(socketHandle_ == -1, false, "socketHandle_ != -1 Already Connected"); int sock = socket(AF_UNIX, SOCK_STREAM, 0); @@ -40,11 +40,11 @@ bool UnixSocketClient::Connect(const std::string addrname, ServiceBase& serviceB struct sockaddr_un addr; if (memset_s(&addr, sizeof(struct sockaddr_un), 0, sizeof(struct sockaddr_un)) != EOK) { - HILOG_ERROR(LOG_CORE, "memset_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "memset_s error!"); } addr.sun_family = AF_UNIX; if (strncpy_s(addr.sun_path, sizeof(addr.sun_path), addrname.c_str(), sizeof(addr.sun_path) - 1) != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s error!"); } CHECK_TRUE(connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr_un)) != -1, close(sock) != 0, @@ -54,7 +54,7 @@ bool UnixSocketClient::Connect(const std::string addrname, ServiceBase& serviceB struct RawPointToService rrs; if (strncpy_s(rrs.serviceName_, sizeof(rrs.serviceName_), serviceBase_->serviceName_.c_str(), serviceBase_->serviceName_.size()) != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s error!"); } rrs.serviceName_[serviceBase_->serviceName_.size()] = 0; CHECK_TRUE( diff --git a/device/services/ipc/src/unix_socket_server.cpp b/device/services/ipc/src/unix_socket_server.cpp index 1448448c6..06df7cbbc 100644 --- a/device/services/ipc/src/unix_socket_server.cpp +++ b/device/services/ipc/src/unix_socket_server.cpp @@ -37,7 +37,7 @@ UnixSocketServer::~UnixSocketServer() { if (getuid() == 0) { if (socketHandle_ != -1) { - HILOG_DEBUG(LOG_CORE, "close UnixSocketServer"); + PROFILER_LOG_DEBUG(LOG_CORE, "close UnixSocketServer"); close(socketHandle_); unlink(sAddrName_.c_str()); } @@ -47,9 +47,9 @@ UnixSocketServer::~UnixSocketServer() if (acceptThread_.joinable()) { acceptThread_.join(); } - HILOG_DEBUG(LOG_CORE, "acceptThread finish"); + PROFILER_LOG_DEBUG(LOG_CORE, "acceptThread finish"); if (socketClients_.size() > 0) { - HILOG_DEBUG(LOG_CORE, "socketClients_.size() = %zu delete map", socketClients_.size()); + PROFILER_LOG_DEBUG(LOG_CORE, "socketClients_.size() = %zu delete map", socketClients_.size()); socketClients_.clear(); } } @@ -67,13 +67,13 @@ void UnixSocketServer::UnixSocketAccept() struct epoll_event events[10]; int nfds = epoll_wait(epfd, events, 10, 1000); // timeout value set 1000. if (nfds == -1) { - HILOG_ERROR(LOG_CORE, "UnixSocketServer epoll_wait failed, errno: %s", strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "UnixSocketServer epoll_wait failed, errno: %s", strerror(errno)); return; } for (int32_t i = 0; i < nfds; ++i) { if (events[i].events & EPOLLIN) { int clientSocket = accept(socketHandle_, nullptr, nullptr); - HILOG_INFO(LOG_CORE, "Accept A Client %d", clientSocket); + PROFILER_LOG_INFO(LOG_CORE, "Accept A Client %d", clientSocket); struct epoll_event clientEvt; clientEvt.data.fd = clientSocket; @@ -81,10 +81,11 @@ void UnixSocketServer::UnixSocketAccept() epoll_ctl(epfd, EPOLL_CTL_ADD, clientSocket, &clientEvt); if (socketClients_.find(clientSocket) == socketClients_.end()) { - HILOG_DEBUG(LOG_CORE, "new socketClients_ socketClients_.size() = %zu", socketClients_.size()); + PROFILER_LOG_DEBUG(LOG_CORE, "new socketClients_ socketClients_.size() = %zu", + socketClients_.size()); socketClients_[clientSocket] = std::make_shared(clientSocket, *serviceEntry_); } else { - HILOG_ERROR(LOG_CORE, "Client %d exist", clientSocket); + PROFILER_LOG_ERROR(LOG_CORE, "Client %d exist", clientSocket); } } else if (events[i].events & EPOLLHUP) { struct epoll_event delEvt; @@ -92,10 +93,11 @@ void UnixSocketServer::UnixSocketAccept() delEvt.events = EPOLLHUP; epoll_ctl(epfd, EPOLL_CTL_DEL, events[i].data.fd, &delEvt); if (socketClients_.find(events[i].data.fd) != socketClients_.end()) { - HILOG_DEBUG(LOG_CORE, "socketClients disconnect socketClients_.size() = %zu", socketClients_.size()); + PROFILER_LOG_DEBUG(LOG_CORE, "socketClients disconnect socketClients_.size() = %zu", + socketClients_.size()); socketClients_.erase(events[i].data.fd); } else { - HILOG_ERROR(LOG_CORE, "Client %d not exist", events[i].data.fd); + PROFILER_LOG_ERROR(LOG_CORE, "Client %d not exist", events[i].data.fd); } } } @@ -117,18 +119,18 @@ bool UnixSocketServer::StartServer(const std::string& addrname, ServiceEntry& p) CHECK_TRUE(sock != -1, false, "StartServer FAIL create socket ERR : %d", errno); if (memset_s(&addr, sizeof(struct sockaddr_un), 0, sizeof(struct sockaddr_un)) != EOK) { - HILOG_ERROR(LOG_CORE, "memset_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "memset_s error!"); } addr.sun_family = AF_UNIX; if (strncpy_s(addr.sun_path, sizeof(addr.sun_path), addrname.c_str(), sizeof(addr.sun_path) - 1) != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s error!"); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s error!"); } unlink(addrname.c_str()); CHECK_TRUE(bind(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr_un)) == 0, close(sock) != 0, "StartServer FAIL bind ERR : %d", errno); std::string chmodCmd = "chmod 666 " + addrname; - HILOG_INFO(LOG_CORE, "chmod command : %s", chmodCmd.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "chmod command : %s", chmodCmd.c_str()); std::unique_ptr pipe(popen(chmodCmd.c_str(), "r"), pclose); } else { sock = GetControlSocket(addrname.c_str()); @@ -146,7 +148,7 @@ bool UnixSocketServer::StartServer(const std::string& addrname, ServiceEntry& p) const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "StartServer FAIL pthread_create ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "StartServer FAIL pthread_create ERR : %s", buf); socketHandle_ = -1; return false; } diff --git a/device/services/plugin_service/src/plugin_service.cpp b/device/services/plugin_service/src/plugin_service.cpp index 7326793c4..3d5350cc1 100644 --- a/device/services/plugin_service/src/plugin_service.cpp +++ b/device/services/plugin_service/src/plugin_service.cpp @@ -105,7 +105,7 @@ bool PluginService::StartService(const std::string& unixSocketName) if (!serviceEntry_->StartServer(unixSocketName)) { pluginServiceImpl_ = nullptr; serviceEntry_ = nullptr; - HILOG_DEBUG(LOG_CORE, "Start IPC Service FAIL"); + PROFILER_LOG_DEBUG(LOG_CORE, "Start IPC Service FAIL"); return false; } serviceEntry_->RegisterService(*pluginServiceImpl_.get()); @@ -142,7 +142,7 @@ bool PluginService::CreatePluginSession(const ProfilerPluginConfig& pluginConfig CHECK_TRUE(smb != nullptr, false, "CreateMemoryBlockLocal FAIL %s", pluginName.c_str()); auto policy = GetReusePolicy(bufferConfig); - HILOG_DEBUG(LOG_CORE, "CreatePluginSession policy = %d", (int)policy); + PROFILER_LOG_DEBUG(LOG_CORE, "CreatePluginSession policy = %d", (int)policy); smb->SetReusePolicy(policy); auto notifier = EventNotifier::Create(0, EventNotifier::NONBLOCK); @@ -158,7 +158,7 @@ bool PluginService::CreatePluginSession(const ProfilerPluginConfig& pluginConfig auto configIter = profilerSessionConfigs_.find(pluginName); if (configIter == profilerSessionConfigs_.end()) { - HILOG_ERROR(LOG_CORE, "profiler session config not set fot plugin name: %s", pluginName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "profiler session config not set fot plugin name: %s", pluginName.c_str()); return false; } if (configIter->second->session_mode() == ProfilerSessionConfig::OFFLINE) { @@ -168,7 +168,8 @@ bool PluginService::CreatePluginSession(const ProfilerPluginConfig& pluginConfig eventPoller_->AddFileDescriptor(notifier->GetFd(), std::bind(&PluginService::ReadShareMemoryOnline, this, *pluginCtx)); } - HILOG_DEBUG(LOG_CORE, "CreatePluginSession %s done, shmem fd = %d", pluginName.c_str(), smb->GetfileDescriptor()); + PROFILER_LOG_DEBUG(LOG_CORE, "CreatePluginSession %s done, shmem fd = %d", + pluginName.c_str(), smb->GetfileDescriptor()); return true; } @@ -191,7 +192,7 @@ bool PluginService::CreatePluginSession(const ProfilerPluginConfig& pluginConfig "%s hiprofiler_plugin process is off line!", __func__); pluginCtx->profilerPluginState.set_state(ProfilerPluginState::LOADED); pluginServiceImpl_->PushCommand(*pluginCtx->context, cmd); - HILOG_DEBUG(LOG_CORE, "CreatePluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "CreatePluginSession %s done!", pluginName.c_str()); return true; } @@ -209,7 +210,7 @@ bool PluginService::StartPluginSession(const ProfilerPluginConfig& config) "%s hiprofiler_plugin process is off line!", __func__); pluginCtx->profilerPluginState.set_state(ProfilerPluginState::IN_SESSION); pluginServiceImpl_->PushCommand(*pluginCtx->context, cmd); - HILOG_INFO(LOG_CORE, "StartPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "StartPluginSession %s done!", pluginName.c_str()); return true; } @@ -230,14 +231,14 @@ bool PluginService::StopPluginSession(const std::string& pluginName) CHECK_NOTNULL(sem, false, "create Semaphore for stop %s FAILED!", pluginName.c_str()); waitSemphores_[cmd->command_id()] = sem; - HILOG_DEBUG(LOG_CORE, "=== StopPluginSession %s Waiting ... ===", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "=== StopPluginSession %s Waiting ... ===", pluginName.c_str()); // wait on semaphore at most 30 seconds. if (!sem->TimedWait(30)) { // semaphore timeout - HILOG_DEBUG(LOG_CORE, "=== StopPluginSession Waiting FAIL ==="); + PROFILER_LOG_DEBUG(LOG_CORE, "=== StopPluginSession Waiting FAIL ==="); return false; } - HILOG_DEBUG(LOG_CORE, "StopPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "StopPluginSession %s done!", pluginName.c_str()); return true; } @@ -267,7 +268,7 @@ bool PluginService::DestroyPluginSession(const std::string& pluginName) "%s hiprofiler_plugin process is off line!", __func__); pluginCtx->profilerPluginState.set_state(ProfilerPluginState::REGISTERED); pluginServiceImpl_->PushCommand(*pluginCtx->context, cmd); - HILOG_INFO(LOG_CORE, "DestroyPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "DestroyPluginSession %s done!", pluginName.c_str()); return true; } @@ -283,7 +284,7 @@ bool PluginService::RefreshPluginSession(const std::string& pluginName) CHECK_TRUE(pluginServiceImpl_->SendHeartBeat(*pluginCtx->context), false, "%s hiprofiler_plugin process is off line!", __func__); pluginServiceImpl_->PushCommand(*pluginCtx->context, cmd); - HILOG_INFO(LOG_CORE, "RefreshPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "RefreshPluginSession %s done!", pluginName.c_str()); return true; } @@ -303,7 +304,7 @@ bool PluginService::RemovePluginSessionCtx(const std::string& pluginName) } pluginCtx->profilerPluginState.set_state(ProfilerPluginState::INITED); - HILOG_INFO(LOG_CORE, "RemovePluginSessionCtx %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "RemovePluginSessionCtx %s done!", pluginName.c_str()); return true; } @@ -378,7 +379,7 @@ bool PluginService::AddPluginInfo(const PluginInfo& pluginInfo) pluginCtx->pluginVersion = pluginInfo.pluginVersion; } } - HILOG_DEBUG(LOG_CORE, "AddPluginInfo for %s done!", pluginInfo.name.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "AddPluginInfo for %s done!", pluginInfo.name.c_str()); return true; } @@ -420,7 +421,7 @@ bool PluginService::RemovePluginInfo(const PluginInfo& pluginInfo) std::unique_lock lock(mutex_); nameIndex_.erase(pluginName); pluginContext_.erase(pluginId); - HILOG_DEBUG(LOG_CORE, "RemovePluginInfo for %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "RemovePluginInfo for %s done!", pluginName.c_str()); return true; } @@ -443,7 +444,7 @@ void PluginService::ReadShareMemoryOffline(PluginContext& context) }, isProtobufSerialize_); if (retval == -1) { - HILOG_DEBUG(LOG_CORE, "need to clear share memory block and report the basic data"); + PROFILER_LOG_DEBUG(LOG_CORE, "need to clear share memory block and report the basic data"); pluginSessionManager_->RefreshPluginSession(); break; } @@ -509,10 +510,10 @@ void PluginService::FlushShareMemory(PluginContext& context) void PluginService::FlushAllData(const std::string& pluginName) { - HILOG_INFO(LOG_CORE, "FlushAllData for %s start!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "FlushAllData for %s start!", pluginName.c_str()); auto configIter = profilerSessionConfigs_.find(pluginName); if (configIter == profilerSessionConfigs_.end()) { - HILOG_ERROR(LOG_CORE, "profiler session config not set fot plugin name: %s", pluginName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "profiler session config not set fot plugin name: %s", pluginName.c_str()); return; } if (!configIter->second->discard_cache_data()) { @@ -526,7 +527,7 @@ void PluginService::FlushAllData(const std::string& pluginName) ReadShareMemoryOnline(*pluginCtx); } } - HILOG_INFO(LOG_CORE, "FlushAllData for %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "FlushAllData for %s done!", pluginName.c_str()); } bool PluginService::AppendResult(NotifyResultRequest& request) @@ -538,17 +539,17 @@ bool PluginService::AppendResult(NotifyResultRequest& request) } int size = request.result_size(); - HILOG_DEBUG(LOG_CORE, "AppendResult size:%d, cmd id:%d", size, request.command_id()); + PROFILER_LOG_DEBUG(LOG_CORE, "AppendResult size:%d, cmd id:%d", size, request.command_id()); for (int i = 0; i < size; i++) { PluginResult pr = request.result(i); if (pr.data().size() > 0) { - HILOG_DEBUG(LOG_CORE, "AppendResult Size : %zu", pr.data().size()); + PROFILER_LOG_DEBUG(LOG_CORE, "AppendResult Size : %zu", pr.data().size()); uint32_t pluginId = pr.plugin_id(); PluginContextPtr pluginCtx = GetPluginContextById(pluginId); CHECK_NOTNULL(pluginCtx, false, "plugin id %u not found!", pluginId); if (pluginCtx->profilerDataRepeater == nullptr) { - HILOG_DEBUG(LOG_CORE, "AppendResult profilerDataRepeater==nullptr %s %d", pr.status().name().c_str(), - pluginId); + PROFILER_LOG_DEBUG(LOG_CORE, "AppendResult profilerDataRepeater==nullptr %s %d", + pr.status().name().c_str(), pluginId); return false; } auto pluginData = std::make_shared(); @@ -564,7 +565,7 @@ bool PluginService::AppendResult(NotifyResultRequest& request) CHECK_TRUE(pluginContext_.count(pluginId) > 0, false, "plugin id %u not found!", pluginId); pluginContext_[pluginId]->outFileName = pr.out_file_name(); } else { - HILOG_DEBUG(LOG_CORE, "Flush?Data From ShareMemory?"); + PROFILER_LOG_DEBUG(LOG_CORE, "Flush?Data From ShareMemory?"); } } return true; diff --git a/device/services/plugin_service/src/plugin_service_impl.cpp b/device/services/plugin_service/src/plugin_service_impl.cpp index 8ed226fcc..7e17e9ca8 100644 --- a/device/services/plugin_service/src/plugin_service_impl.cpp +++ b/device/services/plugin_service/src/plugin_service_impl.cpp @@ -41,16 +41,16 @@ bool PluginServiceImpl::RegisterPlugin(SocketContext& context, int pluginId = pluginService->GetPluginIdByName(pluginInfo.name); if (pluginService->AddPluginInfo(pluginInfo)) { if (pluginId != 0) { // update plugin not need reply response - HILOG_DEBUG(LOG_CORE, "UpdatePlugin OK"); + PROFILER_LOG_DEBUG(LOG_CORE, "UpdatePlugin OK"); return false; } response.set_status(ResponseStatus::OK); response.set_plugin_id(pluginService->GetPluginIdByName(pluginInfo.name)); - HILOG_DEBUG(LOG_CORE, "RegisterPlugin OK"); + PROFILER_LOG_DEBUG(LOG_CORE, "RegisterPlugin OK"); return true; } response.set_status(ResponseStatus::ERR); - HILOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL"); + PROFILER_LOG_DEBUG(LOG_CORE, "RegisterPlugin FAIL"); return false; } bool PluginServiceImpl::UnregisterPlugin(SocketContext& context, @@ -62,11 +62,11 @@ bool PluginServiceImpl::UnregisterPlugin(SocketContext& context, if (pluginService->RemovePluginInfo(pluginInfo)) { response.set_status(ResponseStatus::OK); - HILOG_DEBUG(LOG_CORE, "UnregisterPlugin OK"); + PROFILER_LOG_DEBUG(LOG_CORE, "UnregisterPlugin OK"); return true; } response.set_status(ResponseStatus::ERR); - HILOG_DEBUG(LOG_CORE, "UnregisterPlugin FAIL"); + PROFILER_LOG_DEBUG(LOG_CORE, "UnregisterPlugin FAIL"); return false; } @@ -79,7 +79,7 @@ bool PluginServiceImpl::NotifyResult(SocketContext& context, ::NotifyResultRequest& request, ::NotifyResultResponse& response) { - HILOG_DEBUG(LOG_CORE, "NotifyResult"); + PROFILER_LOG_DEBUG(LOG_CORE, "NotifyResult"); if (pluginService->AppendResult(request)) { response.set_status(ResponseStatus::OK); return true; diff --git a/device/services/plugin_service/src/plugin_session.cpp b/device/services/plugin_service/src/plugin_session.cpp index e1cb01d53..7c550f0c1 100644 --- a/device/services/plugin_service/src/plugin_session.cpp +++ b/device/services/plugin_service/src/plugin_session.cpp @@ -53,7 +53,7 @@ PluginSession::~PluginSession() bool PluginSession::Create() { std::unique_lock lock(mutex_); - HILOG_INFO(LOG_CORE, "CreatePluginSession for %s...", pluginConfig_.name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "CreatePluginSession for %s...", pluginConfig_.name().c_str()); CHECK_TRUE(state_ == INITIAL, false, "plugin state %d invalid!", state_); auto pluginService = pluginService_.lock(); // promote to shared_ptr @@ -62,11 +62,12 @@ bool PluginSession::Create() bool retval = false; if (withBufferConfig_) { retval = pluginService->CreatePluginSession(pluginConfig_, bufferConfig_, dataRepeater_); - HILOG_INFO(LOG_CORE, "CreatePluginSession with buffer for %s %s!", pluginConfig_.name().c_str(), - retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "CreatePluginSession with buffer for %s %s!", pluginConfig_.name().c_str(), + retval ? "OK" : "FAIL"); } else { retval = pluginService->CreatePluginSession(pluginConfig_, dataRepeater_); - HILOG_INFO(LOG_CORE, "CreatePluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "CreatePluginSession for %s %s!", + pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); } CHECK_TRUE(retval, false, "call PluginService::CreatePluginSession failed!"); @@ -77,7 +78,7 @@ bool PluginSession::Create() bool PluginSession::Destroy() { std::unique_lock lock(mutex_); - HILOG_INFO(LOG_CORE, "DestroyPluginSession for %s...", pluginConfig_.name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "DestroyPluginSession for %s...", pluginConfig_.name().c_str()); RETURN_IF(state_ == INITIAL, false, "plugin state %d, no need to destroy!", state_); CHECK_TRUE(state_ == CREATED || state_ == STARTED, false, "plugin state %d invalid!", state_); @@ -85,12 +86,13 @@ bool PluginSession::Destroy() CHECK_NOTNULL(pluginService, false, "PluginSession::%s pluginService promote failed!", __func__); if (state_ == STARTED) { - HILOG_INFO(LOG_CORE, "PluginSession::Destroy state is STARED, need stop!"); + PROFILER_LOG_INFO(LOG_CORE, "PluginSession::Destroy state is STARED, need stop!"); StopLocked(); } bool retval = pluginService->DestroyPluginSession(pluginConfig_.name()); - HILOG_INFO(LOG_CORE, "DestroyPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "DestroyPluginSession for %s %s!", + pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); CHECK_TRUE(retval, false, "call PluginService::DestroyPluginSession failed!"); state_ = INITIAL; @@ -118,14 +120,14 @@ void PluginSession::Invalidate() bool PluginSession::Start() { std::unique_lock lock(mutex_); - HILOG_INFO(LOG_CORE, "StartPluginSession for %s...", pluginConfig_.name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "StartPluginSession for %s...", pluginConfig_.name().c_str()); CHECK_TRUE(state_ == CREATED, false, "plugin state %d invalid!", state_); auto pluginService = pluginService_.lock(); CHECK_NOTNULL(pluginService, false, "PluginSession::%s pluginService promote failed!", __func__); bool retval = pluginService->StartPluginSession(pluginConfig_); - HILOG_INFO(LOG_CORE, "StartPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "StartPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); CHECK_TRUE(retval, false, "call PluginService::StartPluginSession failed!"); state_ = STARTED; @@ -135,14 +137,15 @@ bool PluginSession::Start() bool PluginSession::Refresh() { std::unique_lock lock(mutex_); - HILOG_INFO(LOG_CORE, "Refresh for %s...", pluginConfig_.name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "Refresh for %s...", pluginConfig_.name().c_str()); CHECK_TRUE(state_ == STARTED, false, "plugin state %d invalid!", state_); auto pluginService = pluginService_.lock(); CHECK_NOTNULL(pluginService, false, "PluginSession::%s pluginService promote failed!", __func__); bool retval = pluginService->RefreshPluginSession(pluginConfig_.name()); - HILOG_INFO(LOG_CORE, "RefreshPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "RefreshPluginSession for %s %s!", + pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); CHECK_TRUE(retval, false, "call PluginService::RefreshPluginSession failed!"); return retval; @@ -156,14 +159,14 @@ bool PluginSession::Stop() bool PluginSession::StopLocked() { - HILOG_INFO(LOG_CORE, "StopPluginSession for %s...", pluginConfig_.name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "StopPluginSession for %s...", pluginConfig_.name().c_str()); CHECK_TRUE(state_ == STARTED, false, "plugin state %d invalid!", state_); auto pluginService = pluginService_.lock(); CHECK_NOTNULL(pluginService, false, "PluginSession::%s pluginService promote failed!", __func__); bool retval = pluginService->StopPluginSession(pluginConfig_.name()); - HILOG_INFO(LOG_CORE, "StopPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "StopPluginSession for %s %s!", pluginConfig_.name().c_str(), retval ? "OK" : "FAIL"); CHECK_TRUE(retval, false, "call PluginService::StopPluginSession failed!"); state_ = CREATED; diff --git a/device/services/plugin_service/src/plugin_session_manager.cpp b/device/services/plugin_service/src/plugin_session_manager.cpp index b851f27de..f5699536d 100644 --- a/device/services/plugin_service/src/plugin_session_manager.cpp +++ b/device/services/plugin_service/src/plugin_session_manager.cpp @@ -162,7 +162,7 @@ bool PluginSessionManager::StartPluginSessions(const std::vector& n continue; } if (!it->second->Start()) { - HILOG_INFO(LOG_CORE, "start session %s FAILED!", it->first.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "start session %s FAILED!", it->first.c_str()); failureCount++; } } @@ -180,7 +180,7 @@ bool PluginSessionManager::StopPluginSessions(const std::vector& na continue; } if (!it->second->Stop()) { - HILOG_INFO(LOG_CORE, "stop session %s FAILED!", it->first.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "stop session %s FAILED!", it->first.c_str()); failureCount++; } } @@ -197,7 +197,7 @@ bool PluginSessionManager::RefreshPluginSession() continue; } if (!it->second->Refresh()) { - HILOG_INFO(LOG_CORE, "refresh data %s FAILED!", it->first.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "refresh data %s FAILED!", it->first.c_str()); failureCount++; } } @@ -214,7 +214,7 @@ bool PluginSessionManager::CheckStatus(const std::vector& nameList, } auto actualState = it->second->GetState(); if (actualState != state) { - HILOG_INFO(LOG_CORE, "plugin %s state is %d not %d!", it->first.c_str(), actualState, state); + PROFILER_LOG_INFO(LOG_CORE, "plugin %s state is %d not %d!", it->first.c_str(), actualState, state); return false; } } diff --git a/device/services/profiler_service/src/main.cpp b/device/services/profiler_service/src/main.cpp index 193ace429..3ee950c5b 100644 --- a/device/services/profiler_service/src/main.cpp +++ b/device/services/profiler_service/src/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) listenUri = argv[1]; } if (service->StartService(listenUri)) { - HILOG_INFO(LOG_CORE, "ProfilerService start SUCCESS!"); + PROFILER_LOG_INFO(LOG_CORE, "ProfilerService start SUCCESS!"); service->WaitServiceDone(); } close(lockFileFd); diff --git a/device/services/profiler_service/src/profiler_capability_manager.cpp b/device/services/profiler_service/src/profiler_capability_manager.cpp index b64b215a7..eef53806c 100644 --- a/device/services/profiler_service/src/profiler_capability_manager.cpp +++ b/device/services/profiler_service/src/profiler_capability_manager.cpp @@ -37,7 +37,8 @@ bool ProfilerCapabilityManager::AddCapability(const ProfilerPluginCapability& ca "capability.name conflict with %zu", (it - pluginCapabilities_.begin())); } pluginCapabilities_.push_back(capability); - HILOG_INFO(LOG_CORE, "AddCapability({%s, %s}) SUCCESS!", capability.name().c_str(), capability.path().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "AddCapability({%s, %s}) SUCCESS!", + capability.name().c_str(), capability.path().c_str()); return true; } @@ -64,7 +65,7 @@ bool ProfilerCapabilityManager::UpdateCapability(const std::string& name, const for (auto it = pluginCapabilities_.begin(); it != pluginCapabilities_.end(); it++) { if (it->name() == capability.name()) { *it = capability; - HILOG_WARN(LOG_CORE, "UpdateCapability(%s, %s) SUCCESS!", it->name().c_str(), it->path().c_str()); + PROFILER_LOG_WARN(LOG_CORE, "UpdateCapability(%s, %s) SUCCESS!", it->name().c_str(), it->path().c_str()); return true; } } @@ -76,7 +77,7 @@ bool ProfilerCapabilityManager::RemoveCapability(const std::string& name) std::lock_guard guard(mutex_); for (auto it = pluginCapabilities_.begin(); it != pluginCapabilities_.end(); it++) { if (it->name() == name) { - HILOG_INFO(LOG_CORE, "RemoveCapability({%s, %s}) SUCCESS!", it->name().c_str(), it->path().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "RemoveCapability({%s, %s}) SUCCESS!", it->name().c_str(), it->path().c_str()); pluginCapabilities_.erase(it); return true; } diff --git a/device/services/profiler_service/src/profiler_data_repeater.cpp b/device/services/profiler_service/src/profiler_data_repeater.cpp index e684f419a..d31c565e1 100644 --- a/device/services/profiler_service/src/profiler_data_repeater.cpp +++ b/device/services/profiler_service/src/profiler_data_repeater.cpp @@ -53,7 +53,8 @@ bool ProfilerDataRepeater::PutPluginData(const ProfilerPluginDataPtr& pluginData std::unique_lock lock(mutex_); if ((pluginData == nullptr) && (dataQueue_.size() > 0)) { - HILOG_INFO(LOG_CORE, "no need put nullptr if queue has data, dataQueue_.size() = %zu", dataQueue_.size()); + PROFILER_LOG_INFO(LOG_CORE, "no need put nullptr if queue has data, dataQueue_.size() = %zu", + dataQueue_.size()); return true; } diff --git a/device/services/profiler_service/src/profiler_service.cpp b/device/services/profiler_service/src/profiler_service.cpp index c7d4f1d3f..e497d4716 100644 --- a/device/services/profiler_service/src/profiler_service.cpp +++ b/device/services/profiler_service/src/profiler_service.cpp @@ -39,7 +39,7 @@ using PluginContextPtr = std::shared_ptr; #define CHECK_POINTER_NOTNULL(ptr, errorMessage) \ do { \ if ((ptr) == nullptr) { \ - HILOG_ERROR(LOG_CORE, "%s: FAILED, %s is null!", __func__, #ptr); \ + PROFILER_LOG_ERROR(LOG_CORE, "%s: FAILED, %s is null!", __func__, #ptr); \ return {StatusCode::INTERNAL, errorMessage}; \ } \ } while (0) @@ -47,7 +47,7 @@ using PluginContextPtr = std::shared_ptr; #define CHECK_EXPRESSION_TRUE(expr, errorMessage) \ do { \ if (!(expr)) { \ - HILOG_ERROR(LOG_CORE, "%s: FAILED, %s", __func__, errorMessage); \ + PROFILER_LOG_ERROR(LOG_CORE, "%s: FAILED, %s", __func__, errorMessage); \ return {StatusCode::INTERNAL, (errorMessage)}; \ } \ } while (0) @@ -68,7 +68,7 @@ ProfilerService::~ProfilerService() {} ProfilerService::SessionContext::~SessionContext() { - HILOG_INFO(LOG_CORE, "~SessionContext id = %d", id); + PROFILER_LOG_INFO(LOG_CORE, "~SessionContext id = %d", id); if (offlineScheduleTaskFd != -1) { stopExpireTask.UnscheduleTask(offlineScheduleTaskFd); } @@ -81,16 +81,16 @@ Status ProfilerService::GetCapabilities(ServerContext* context, ::GetCapabilitiesResponse* response) { CHECK_REQUEST_RESPONSE(context, request, response); - HILOG_INFO(LOG_CORE, "GetCapabilities from '%s'", context->peer().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "GetCapabilities from '%s'", context->peer().c_str()); - HILOG_INFO(LOG_CORE, "GetCapabilities %d start", request->request_id()); + PROFILER_LOG_INFO(LOG_CORE, "GetCapabilities %d start", request->request_id()); std::vector capabilities = ProfilerCapabilityManager::GetInstance().GetCapabilities(); response->set_status(StatusCode::OK); for (size_t i = 0; i < capabilities.size(); i++) { *response->add_capabilities() = capabilities[i]; } - HILOG_INFO(LOG_CORE, "GetCapabilities %d done!", request->request_id()); + PROFILER_LOG_INFO(LOG_CORE, "GetCapabilities %d done!", request->request_id()); return Status::OK; } @@ -240,7 +240,7 @@ Status ProfilerService::CreateSession(ServerContext* context, CHECK_REQUEST_RESPONSE(context, request, response); CHECK_POINTER_NOTNULL(pluginService_, "plugin service not ready!"); // check plugin configs - HILOG_INFO(LOG_CORE, "CreateSession %d start", request->request_id()); + PROFILER_LOG_INFO(LOG_CORE, "CreateSession %d start", request->request_id()); const int nConfigs = request->plugin_configs_size(); CHECK_EXPRESSION_TRUE(nConfigs > 0, "no plugin configs!"); @@ -258,7 +258,7 @@ Status ProfilerService::CreateSession(ServerContext* context, } if (pluginConfigs.empty()) { - HILOG_ERROR(LOG_CORE, "No plugins are loaded!"); + PROFILER_LOG_ERROR(LOG_CORE, "No plugins are loaded!"); return Status(StatusCode::PERMISSION_DENIED, ""); } // copy buffer configs @@ -270,7 +270,7 @@ Status ProfilerService::CreateSession(ServerContext* context, // if more than one buffer config provided, the number of buffer configs must equals number of plugin configs bufferConfigs.assign(sessionConfig->buffers().begin(), sessionConfig->buffers().end()); } - HILOG_INFO(LOG_CORE, "bufferConfigs: %zu", bufferConfigs.size()); + PROFILER_LOG_INFO(LOG_CORE, "bufferConfigs: %zu", bufferConfigs.size()); std::vector pluginNames; std::transform(pluginConfigs.begin(), pluginConfigs.end(), std::back_inserter(pluginNames), [](ProfilerPluginConfig& config) { return config.name(); }); @@ -295,7 +295,7 @@ Status ProfilerService::CreateSession(ServerContext* context, pluginData.set_data(pluginConfigs[i].config_data()); std::vector msgData(pluginData.ByteSizeLong()); if (pluginData.SerializeToArray(msgData.data(), msgData.size()) <= 0) { - HILOG_WARN(LOG_CORE, "PluginConfig SerializeToArray failed!"); + PROFILER_LOG_WARN(LOG_CORE, "PluginConfig SerializeToArray failed!"); } traceWriter->SetPluginConfig(msgData.data(), msgData.size()); } @@ -345,7 +345,7 @@ Status ProfilerService::CreateSession(ServerContext* context, response->set_status(0); response->set_session_id(sessionId); - HILOG_INFO(LOG_CORE, "CreateSession %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "CreateSession %d %u done!", request->request_id(), sessionId); return Status::OK; } @@ -374,7 +374,7 @@ bool ProfilerService::RemoveSessionContext(uint32_t sessionId) auto it = sessionContext_.find(sessionId); if (it != sessionContext_.end()) { auto ptr = it->second; - HILOG_INFO(LOG_CORE, "DelCtx use_count: %ld", ptr.use_count()); + PROFILER_LOG_INFO(LOG_CORE, "DelCtx use_count: %ld", ptr.use_count()); sessionContext_.erase(it); return true; } @@ -385,21 +385,22 @@ void ProfilerService::MergeStandaloneFile(const std::string& resultFile, const s const std::string& outputFile, const std::string& pluginVersion) { if (pluginName.empty() || outputFile.empty()) { - HILOG_ERROR(LOG_CORE, "pluginName(%s) didn't set output file(%s)", pluginName.c_str(), outputFile.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "pluginName(%s) didn't set output file(%s)", + pluginName.c_str(), outputFile.c_str()); return; } std::ifstream fsFile {}; // read from output file fsFile.open(outputFile, std::ios_base::in | std::ios_base::binary); if (!fsFile.good()) { - HILOG_ERROR(LOG_CORE, "open file(%s) failed: %d", outputFile.c_str(), fsFile.rdstate()); + PROFILER_LOG_ERROR(LOG_CORE, "open file(%s) failed: %d", outputFile.c_str(), fsFile.rdstate()); return; } std::ofstream fsTarget {}; // write to profiler ouput file fsTarget.open(resultFile, std::ios_base::in | std::ios_base::out | std::ios_base::binary); if (!fsTarget.good()) { - HILOG_ERROR(LOG_CORE, "open file(%s) failed: %d", resultFile.c_str(), fsTarget.rdstate()); + PROFILER_LOG_ERROR(LOG_CORE, "open file(%s) failed: %d", resultFile.c_str(), fsTarget.rdstate()); return; } fsTarget.seekp(0, std::ios_base::end); @@ -417,18 +418,18 @@ void ProfilerService::MergeStandaloneFile(const std::string& resultFile, const s size_t pluginSize = sizeof(header.data_.standalonePluginName); int ret = strncpy_s(header.data_.standalonePluginName, pluginSize, pluginName.c_str(), pluginSize - 1); if (ret != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s error! pluginName is %s", pluginName.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s error! pluginName is %s", pluginName.c_str()); return; } pluginSize = sizeof(header.data_.pluginVersion); ret = strncpy_s(header.data_.pluginVersion, pluginSize, pluginVersion.c_str(), pluginSize - 1); if (ret != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s error! pluginVersion is %s", pluginVersion.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s error! pluginVersion is %s", pluginVersion.c_str()); return; } fsTarget.write(reinterpret_cast(&header), sizeof(header)); if (!fsTarget.good()) { - HILOG_ERROR(LOG_CORE, "write file(%s) header failed: %d\n", resultFile.c_str(), fsTarget.rdstate()); + PROFILER_LOG_ERROR(LOG_CORE, "write file(%s) header failed: %d\n", resultFile.c_str(), fsTarget.rdstate()); return; } @@ -442,7 +443,7 @@ void ProfilerService::MergeStandaloneFile(const std::string& resultFile, const s fsFile.read(buf.data(), readSize); fsTarget.write(buf.data(), readSize); if (!fsTarget.good()) { - HILOG_ERROR(LOG_CORE, "write file(%s) failed: %d\n", resultFile.c_str(), fsTarget.rdstate()); + PROFILER_LOG_ERROR(LOG_CORE, "write file(%s) failed: %d\n", resultFile.c_str(), fsTarget.rdstate()); return; } fileSize -= readSize; @@ -456,7 +457,7 @@ void ProfilerService::MergeStandaloneFile(const std::string& resultFile, const s fsFile.close(); fsTarget.close(); - HILOG_INFO(LOG_CORE, "write standalone(%s) to result(%s) done", outputFile.c_str(), resultFile.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "write standalone(%s) to result(%s) done", outputFile.c_str(), resultFile.c_str()); } Status ProfilerService::StartSession(ServerContext* context, @@ -466,13 +467,13 @@ Status ProfilerService::StartSession(ServerContext* context, CHECK_REQUEST_RESPONSE(context, request, response); uint32_t sessionId = request->session_id(); - HILOG_INFO(LOG_CORE, "StartSession %d %u start", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "StartSession %d %u start", request->request_id(), sessionId); // copy plugin configs from request std::vector newPluginConfigs; newPluginConfigs.reserve(request->update_configs_size()); for (int i = 0; i < request->update_configs_size(); i++) { - HILOG_INFO(LOG_CORE, "update_configs %d, name = %s", i, request->update_configs(i).name().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "update_configs %d, name = %s", i, request->update_configs(i).name().c_str()); newPluginConfigs.push_back(request->update_configs(i)); } @@ -502,12 +503,12 @@ Status ProfilerService::StartSession(ServerContext* context, // re-create plugin sessions CHECK_EXPRESSION_TRUE(ctx->CreatePluginSessions(), "refresh sessions failed!"); - HILOG_INFO(LOG_CORE, "StartSession %zu plugin config updated!", updates); + PROFILER_LOG_INFO(LOG_CORE, "StartSession %zu plugin config updated!", updates); } // start plugin sessions with configs CHECK_EXPRESSION_TRUE(ctx->StartPluginSessions(), "start plugin sessions failed!"); - HILOG_INFO(LOG_CORE, "StartSession %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "StartSession %d %u done!", request->request_id(), sessionId); return Status::OK; } @@ -523,7 +524,7 @@ Status ProfilerService::FetchData(ServerContext* context, CHECK_POINTER_NOTNULL(writer, "writer invalid!"); uint32_t sessionId = request->session_id(); - HILOG_INFO(LOG_CORE, "FetchData %d %u start", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "FetchData %d %u start", request->request_id(), sessionId); auto ctx = GetSessionContext(sessionId); CHECK_POINTER_NOTNULL(ctx, "session_id invalid!"); @@ -556,18 +557,18 @@ Status ProfilerService::FetchData(ServerContext* context, } } else { response.set_has_more(false); - HILOG_INFO(LOG_CORE, "no more data need to fill to response!"); + PROFILER_LOG_INFO(LOG_CORE, "no more data need to fill to response!"); } bool sendSuccess = writer->Write(response); if (count <= 0 || !sendSuccess) { - HILOG_INFO(LOG_CORE, "count = %d, sendSuccess = %d", count, sendSuccess); + PROFILER_LOG_INFO(LOG_CORE, "count = %d, sendSuccess = %d", count, sendSuccess); break; } } } - HILOG_INFO(LOG_CORE, "FetchData %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "FetchData %d %u done!", request->request_id(), sessionId); return Status::OK; } @@ -577,7 +578,7 @@ Status ProfilerService::StopSession(ServerContext* context, { CHECK_REQUEST_RESPONSE(context, request, response); uint32_t sessionId = request->session_id(); - HILOG_INFO(LOG_CORE, "StopSession %d %u start", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "StopSession %d %u start", request->request_id(), sessionId); auto ctx = GetSessionContext(sessionId); CHECK_POINTER_NOTNULL(ctx, "session_id invalid!"); @@ -586,7 +587,7 @@ Status ProfilerService::StopSession(ServerContext* context, ctx->traceFileWriter.get()->SetStopSplitFile(true); } CHECK_EXPRESSION_TRUE(ctx->StopPluginSessions(), "stop plugin sessions failed!"); - HILOG_INFO(LOG_CORE, "StopSession %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "StopSession %d %u done!", request->request_id(), sessionId); return Status::OK; } @@ -597,7 +598,7 @@ Status ProfilerService::DestroySession(ServerContext* context, CHECK_REQUEST_RESPONSE(context, request, response); uint32_t sessionId = request->session_id(); - HILOG_INFO(LOG_CORE, "DestroySession %d %u start", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "DestroySession %d %u start", request->request_id(), sessionId); auto ctx = GetSessionContext(sessionId); CHECK_POINTER_NOTNULL(ctx, "session_id invalid!"); @@ -605,7 +606,7 @@ Status ProfilerService::DestroySession(ServerContext* context, CHECK_EXPRESSION_TRUE(RemoveSessionContext(sessionId), "remove session FAILED!"); CHECK_EXPRESSION_TRUE(pluginSessionManager_->RemovePluginSessions(ctx->pluginNames), "remove plugin session FAILED!"); - HILOG_INFO(LOG_CORE, "DestroySession %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "DestroySession %d %u done!", request->request_id(), sessionId); if (ctx->sessionConfig.session_mode() == ProfilerSessionConfig::OFFLINE) { uint32_t pluginId = 0; @@ -631,7 +632,7 @@ Status ProfilerService::DestroySession(ServerContext* context, { CHECK_REQUEST_RESPONSE(context, request, response); uint32_t sessionId = request->session_id(); - HILOG_INFO(LOG_CORE, "KeepSession %d %u start", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "KeepSession %d %u start", request->request_id(), sessionId); auto ctx = GetSessionContext(sessionId); CHECK_POINTER_NOTNULL(ctx, "session_id invalid!"); @@ -648,7 +649,7 @@ Status ProfilerService::DestroySession(ServerContext* context, ctx->StopSessionExpireTask(removeTask_); ctx->StartSessionExpireTask(removeTask_); } - HILOG_INFO(LOG_CORE, "KeepSession %d %u done!", request->request_id(), sessionId); + PROFILER_LOG_INFO(LOG_CORE, "KeepSession %d %u done!", request->request_id(), sessionId); return Status::OK; } @@ -660,9 +661,9 @@ public: { const char* method = info_->method(); if (methods->QueryInterceptionHookPoint(experimental::InterceptionHookPoints::POST_SEND_MESSAGE)) { - HILOG_DEBUG(LOG_CORE, "POST_SEND_MESSAGE method: %s", method); + PROFILER_LOG_DEBUG(LOG_CORE, "POST_SEND_MESSAGE method: %s", method); } else if (methods->QueryInterceptionHookPoint(experimental::InterceptionHookPoints::POST_RECV_MESSAGE)) { - HILOG_DEBUG(LOG_CORE, "POST_RECV_MESSAGE method: %s", method); + PROFILER_LOG_DEBUG(LOG_CORE, "POST_RECV_MESSAGE method: %s", method); } methods->Proceed(); } @@ -689,7 +690,7 @@ bool ProfilerService::StartService(const std::string& listenUri) auto server = builder.BuildAndStart(); CHECK_NOTNULL(server, false, "start service failed!"); - HILOG_INFO(LOG_CORE, "Service started successfully."); + PROFILER_LOG_INFO(LOG_CORE, "Service started successfully."); server_ = std::move(server); return true; } @@ -697,9 +698,9 @@ bool ProfilerService::StartService(const std::string& listenUri) void ProfilerService::WaitServiceDone() { if (server_) { - HILOG_INFO(LOG_CORE, "waiting Server..."); + PROFILER_LOG_INFO(LOG_CORE, "waiting Server..."); server_->Wait(); - HILOG_INFO(LOG_CORE, "Server done!"); + PROFILER_LOG_INFO(LOG_CORE, "Server done!"); } } @@ -707,6 +708,6 @@ void ProfilerService::StopService() { if (server_) { server_->Shutdown(); - HILOG_INFO(LOG_CORE, "Server stop done!"); + PROFILER_LOG_INFO(LOG_CORE, "Server stop done!"); } } \ No newline at end of file diff --git a/device/services/profiler_service/src/trace_file_writer.cpp b/device/services/profiler_service/src/trace_file_writer.cpp index 6be66ecb0..15b1234a4 100644 --- a/device/services/profiler_service/src/trace_file_writer.cpp +++ b/device/services/profiler_service/src/trace_file_writer.cpp @@ -43,7 +43,7 @@ TraceFileWriter::TraceFileWriter(const std::string& path) : TraceFileWriter(path TraceFileWriter::TraceFileWriter(int32_t fd) : fd_(fd) { if (write(fd_, &header_, sizeof(header_)) != sizeof(header_)) { - HILOG_ERROR(LOG_CORE, "write initial header failed!, error: %s", strerror(errno)); + PROFILER_LOG_ERROR(LOG_CORE, "write initial header failed!, error: %s", strerror(errno)); } isWriteFd_ = true; (void)FlushStream(); @@ -109,7 +109,7 @@ void TraceFileWriter::WriteStandalonePluginData( std::vector msgData(pluginData.ByteSizeLong()); if (pluginData.SerializeToArray(msgData.data(), msgData.size()) <= 0) { - HILOG_WARN(LOG_CORE, "%s StandalonePluginData SerializeToArray failed!", pluginName.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "%s StandalonePluginData SerializeToArray failed!", pluginName.c_str()); } Write(msgData.data(), msgData.size()); @@ -135,7 +135,7 @@ void TraceFileWriter::WriteStandalonePluginData( std::vector msgData(pluginData.ByteSizeLong()); if (pluginData.SerializeToArray(msgData.data(), msgData.size()) <= 0) { - HILOG_WARN(LOG_CORE, "%s StandalonePluginData SerializeToArray failed!", pluginName.c_str()); + PROFILER_LOG_WARN(LOG_CORE, "%s StandalonePluginData SerializeToArray failed!", pluginName.c_str()); } Write(msgData.data(), msgData.size()); @@ -210,7 +210,7 @@ bool TraceFileWriter::WriteHeader() stream_.write(reinterpret_cast(&header_), sizeof(header_)); CHECK_TRUE(stream_, false, "write initial header to %s failed!", path_.c_str()); dataSize_ = header_.HEADER_SIZE; - HILOG_INFO(LOG_CORE, "write file(%s) header end", path_.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "write file(%s) header end", path_.c_str()); return true; } @@ -218,13 +218,13 @@ bool TraceFileWriter::WriteHeader() void TraceFileWriter::DeleteOldSplitFile() { if (splitFilePaths_.size() <= splitFileMaxNum_) { - HILOG_INFO(LOG_CORE, "splitFilePaths_ size %zu, no need to delete.", splitFilePaths_.size()); + PROFILER_LOG_INFO(LOG_CORE, "splitFilePaths_ size %zu, no need to delete.", splitFilePaths_.size()); return; } std::string splitFilePath = splitFilePaths_.front(); int ret = unlink(splitFilePath.c_str()); - HILOG_INFO(LOG_CORE, "DeleteOldSplitFile remove %s return %d. ", splitFilePath.c_str(), ret); + PROFILER_LOG_INFO(LOG_CORE, "DeleteOldSplitFile remove %s return %d. ", splitFilePath.c_str(), ret); splitFilePaths_.pop(); } @@ -275,7 +275,7 @@ long TraceFileWriter::WriteStandalonePluginFile(const std::string &file, std::ifstream fsFile {}; // read data from file fsFile.open(file, std::ios_base::in | std::ios_base::binary); if (!fsFile.good()) { - HILOG_ERROR(LOG_CORE, "open file(%s) failed: %d", file.c_str(), fsFile.rdstate()); + PROFILER_LOG_ERROR(LOG_CORE, "open file(%s) failed: %d", file.c_str(), fsFile.rdstate()); return 0; } @@ -286,19 +286,19 @@ long TraceFileWriter::WriteStandalonePluginFile(const std::string &file, size_t size = name.size(); if (size > 0) { if (size > PLUGIN_MODULE_NAME_MAX) { - HILOG_ERROR(LOG_CORE, "standalonePluginName(%s) size(%zu) is greater than %d!", + PROFILER_LOG_ERROR(LOG_CORE, "standalonePluginName(%s) size(%zu) is greater than %d!", name.c_str(), size, PLUGIN_MODULE_NAME_MAX); } else if (strncpy_s(header.data_.standalonePluginName, PLUGIN_MODULE_NAME_MAX, name.c_str(), size) != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s standalonePluginName(%s) error!", name.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s standalonePluginName(%s) error!", name.c_str()); } } size = version.size(); if (size > 0) { if (size > PLUGIN_MODULE_VERSION_MAX) { - HILOG_ERROR(LOG_CORE, "pluginVersion(%s) size(%zu) is greater than %d!", + PROFILER_LOG_ERROR(LOG_CORE, "pluginVersion(%s) size(%zu) is greater than %d!", version.c_str(), size, PLUGIN_MODULE_VERSION_MAX); } else if (strncpy_s(header.data_.pluginVersion, PLUGIN_MODULE_VERSION_MAX, version.c_str(), size) != EOK) { - HILOG_ERROR(LOG_CORE, "strncpy_s pluginVersion(%s) error!", version.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "strncpy_s pluginVersion(%s) error!", version.c_str()); } } header.data_.dataType = type; @@ -325,7 +325,7 @@ bool TraceFileWriter::IsSplitFile(uint32_t size) { dataSize_ += sizeof(uint32_t) + size; if (dataSize_ >= splitFileMaxSize_) { - HILOG_INFO(LOG_CORE, "need to split the file(%s), data size:%d, size: %d, splitFileMaxSize_:%d", + PROFILER_LOG_INFO(LOG_CORE, "need to split the file(%s), data size:%d, size: %d, splitFileMaxSize_:%d", path_.c_str(), dataSize_, size, splitFileMaxSize_); // update old file header @@ -395,7 +395,7 @@ bool TraceFileWriter::Finish() stream_.seekp(filePos); CHECK_TRUE(stream_, false, "write final header to %s failed!", path_.c_str()); CHECK_TRUE(stream_.flush(), false, "binary file %s flush failed!", path_.c_str()); - HILOG_DEBUG(LOG_CORE, "Finish: %s, bytes: %" PRIu64 ", count: %" PRIu64, path_.c_str(), writeBytes_, + PROFILER_LOG_DEBUG(LOG_CORE, "Finish: %s, bytes: %" PRIu64 ", count: %" PRIu64, path_.c_str(), writeBytes_, writeCount_); } return true; @@ -412,7 +412,8 @@ bool TraceFileWriter::FlushStream() CHECK_TRUE(stream_.is_open(), false, "binary file %s not open or open failed!", path_.c_str()); CHECK_TRUE(stream_.flush(), false, "binary file %s flush failed!", path_.c_str()); } - HILOG_DEBUG(LOG_CORE, "flush: %s, bytes: %" PRIu64 ", count: %" PRIu64, path_.c_str(), writeBytes_, writeCount_); + PROFILER_LOG_DEBUG(LOG_CORE, "flush: %s, bytes: %" PRIu64 ", count: %" PRIu64, path_.c_str(), + writeBytes_, writeCount_); return true; } @@ -433,7 +434,8 @@ void TraceFileWriter::LogDiskUsage() int ret = statvfs(diskPath.c_str(), &diskInfo); if (ret != 0) { std::string errorMsg = COMMON::GetErrorMsg(); - HILOG_ERROR(LOG_CORE, "LogDiskUsage() return %d, path:%s, msg:%s", ret, diskPath.c_str(), errorMsg.c_str()); + PROFILER_LOG_ERROR(LOG_CORE, "LogDiskUsage() return %d, path:%s, msg:%s", + ret, diskPath.c_str(), errorMsg.c_str()); return; } @@ -444,5 +446,5 @@ void TraceFileWriter::LogDiskUsage() float freePercent = static_cast(freeSize) / static_cast(totalSize); uint32_t freeSizeGb = freeSize / GB_TO_BYTE; // 100: in terms of percentage - HILOG_INFO(LOG_CORE, "LogDiskUsage() freePercent:%.1f, freeSizeGb:%u", freePercent * 100, freeSizeGb); + PROFILER_LOG_INFO(LOG_CORE, "LogDiskUsage() freePercent:%.1f, freeSizeGb:%u", freePercent * 100, freeSizeGb); } \ No newline at end of file diff --git a/device/services/profiler_service/test/unittest/plugin_service_stubs.cpp b/device/services/profiler_service/test/unittest/plugin_service_stubs.cpp index f40d0c5ab..509efd59b 100644 --- a/device/services/profiler_service/test/unittest/plugin_service_stubs.cpp +++ b/device/services/profiler_service/test/unittest/plugin_service_stubs.cpp @@ -37,73 +37,73 @@ PluginServiceStubPtr PluginServiceStub::GetInstance() void PluginServiceStub::SetCreateResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); createResult_ = value; } bool PluginServiceStub::GetCreateResult() const { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, createResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, createResult_); return createResult_; } void PluginServiceStub::SetStartResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); startResult_ = value; } bool PluginServiceStub::GetStartResult() const { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, startResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, startResult_); return startResult_; } void PluginServiceStub::SetStopResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); stopResult_ = value; } bool PluginServiceStub::GetStopResult() const { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, stopResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, stopResult_); return stopResult_; } void PluginServiceStub::SetDestroyResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); destroyResult_ = value; } bool PluginServiceStub::GetDestroyResult() const { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, destroyResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, destroyResult_); return destroyResult_; } void PluginServiceStub::SetAddResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); addResult_ = value; } bool PluginServiceStub::GetAddResult() { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, addResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, addResult_); return addResult_; } void PluginServiceStub::SetRemoveResult(bool value) { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, value); removeResult_ = value; } bool PluginServiceStub::GetRemoveResult() { - HILOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, removeResult_); + PROFILER_LOG_DEBUG(LOG_CORE, "%s(%d)", __FUNCTION__, removeResult_); return removeResult_; } #endif @@ -145,7 +145,7 @@ bool PluginService::CreatePluginSession(const ProfilerPluginConfig& pluginConfig pluginCtx->profilerPluginState.set_state(ProfilerPluginState::LOADED); - HILOG_DEBUG(LOG_CORE, "CreatePluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "CreatePluginSession %s done!", pluginName.c_str()); return true; } @@ -164,7 +164,7 @@ bool PluginService::StartPluginSession(const ProfilerPluginConfig& pluginConfig) std::tie(pluginId, pluginCtx) = GetPluginContext(pluginName); pluginCtx->profilerPluginState.set_state(ProfilerPluginState::IN_SESSION); - HILOG_INFO(LOG_CORE, "StartPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "StartPluginSession %s done!", pluginName.c_str()); return true; } @@ -176,7 +176,7 @@ bool PluginService::StopPluginSession(const std::string& pluginName) pluginCtx->profilerPluginState.set_state(ProfilerPluginState::LOADED); - HILOG_DEBUG(LOG_CORE, "StopPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "StopPluginSession %s done!", pluginName.c_str()); return true; } @@ -196,7 +196,7 @@ bool PluginService::DestroyPluginSession(const std::string& pluginName) } pluginCtx->profilerPluginState.set_state(ProfilerPluginState::REGISTERED); - HILOG_INFO(LOG_CORE, "DestroyPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "DestroyPluginSession %s done!", pluginName.c_str()); return true; } @@ -205,7 +205,7 @@ bool PluginService::RefreshPluginSession(const std::string& pluginName) uint32_t pluginId = 0; PluginContextPtr pluginCtx = nullptr; std::tie(pluginId, pluginCtx) = GetPluginContext(pluginName); - HILOG_INFO(LOG_CORE, "RefreshPluginSession %s done!", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "RefreshPluginSession %s done!", pluginName.c_str()); return true; } @@ -268,7 +268,7 @@ bool PluginService::AddPluginInfo(const PluginInfo& pluginInfo) pluginCtx->bufferSizeHint = pluginInfo.bufferSizeHint; } } - HILOG_DEBUG(LOG_CORE, "AddPluginInfo for %s done!", pluginInfo.name.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "AddPluginInfo for %s done!", pluginInfo.name.c_str()); return true; } @@ -302,7 +302,7 @@ bool PluginService::RemovePluginInfo(const PluginInfo& pluginInfo) std::unique_lock lock(mutex_); nameIndex_.erase(pluginName); pluginContext_.erase(pluginId); - HILOG_DEBUG(LOG_CORE, "RemovePluginInfo for %s done!", pluginName.c_str()); + PROFILER_LOG_DEBUG(LOG_CORE, "RemovePluginInfo for %s done!", pluginName.c_str()); return true; } @@ -327,5 +327,5 @@ void PluginService::StopEpollThread() void PluginService::FlushAllData(const std::string& pluginName) { - HILOG_INFO(LOG_CORE, "FlushAllData for %s", pluginName.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "FlushAllData for %s", pluginName.c_str()); } \ No newline at end of file diff --git a/device/services/profiler_service/test/unittest/profiler_data_repeater_test.cpp b/device/services/profiler_service/test/unittest/profiler_data_repeater_test.cpp index 05c4be8be..3bd6cab9e 100644 --- a/device/services/profiler_service/test/unittest/profiler_data_repeater_test.cpp +++ b/device/services/profiler_service/test/unittest/profiler_data_repeater_test.cpp @@ -197,7 +197,7 @@ HWTEST_F(ProfilerDataRepeaterTest, CloseWithFastProducer, TestSize.Level1) for (int i = 0; i < numProducts; i++) { auto data = std::make_shared(); if (!dataRepeater->PutPluginData(data)) { - HILOG_DEBUG(LOG_CORE, "put data %d FAILED!", i); + PROFILER_LOG_DEBUG(LOG_CORE, "put data %d FAILED!", i); break; } } @@ -208,7 +208,7 @@ HWTEST_F(ProfilerDataRepeaterTest, CloseWithFastProducer, TestSize.Level1) for (int i = 0; i < numProducts; i++) { auto data = dataRepeater->TakePluginData(); if (!data) { - HILOG_DEBUG(LOG_CORE, "get data %d FAILED!", i); + PROFILER_LOG_DEBUG(LOG_CORE, "get data %d FAILED!", i); break; } usleep(consumeDelayUs); diff --git a/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp b/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp index 2aee3d6b5..d623e92de 100644 --- a/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp +++ b/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp @@ -150,7 +150,7 @@ protected: { auto grpcChannel = grpc::CreateChannel("127.0.0.1:50051", grpc::InsecureChannelCredentials()); if (grpcChannel == nullptr) { - HILOG_INFO(LOG_CORE, "Create GRPC channel failed!"); + PROFILER_LOG_INFO(LOG_CORE, "Create GRPC channel failed!"); return nullptr; } return IProfilerService::NewStub(grpcChannel); @@ -390,13 +390,13 @@ protected: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "test:dlopen err, errno(%d:%s)", errno, buf); + PROFILER_LOG_ERROR(LOG_CORE, "test:dlopen err, errno(%d:%s)", errno, buf); return false; } PluginModuleStruct* cpuPlugin = (PluginModuleStruct*)dlsym(handle, "g_pluginModule"); if (cpuPlugin == nullptr) { - HILOG_ERROR(LOG_CORE, "test: cpuPlugin is null"); + PROFILER_LOG_ERROR(LOG_CORE, "test: cpuPlugin is null"); return false; } @@ -450,7 +450,7 @@ protected: const int bufSize = 256; char buf[bufSize] = { 0 }; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "StartRequestMemoryProcess: malloc %zu fail, errno(%d:%s)", + PROFILER_LOG_ERROR(LOG_CORE, "StartRequestMemoryProcess: malloc %zu fail, errno(%d:%s)", MB_PER_BYTE, errno, buf); } while (1) { @@ -472,29 +472,29 @@ protected: // 写100K数据 FILE* writeFp = fopen(WRITE_FILE.c_str(), "w"); if (writeFp == nullptr) { - HILOG_ERROR(LOG_CORE, "fopen() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fopen() error"); return; } size_t len = fwrite(const_cast(str.c_str()), 1, BLOCK_LEN, writeFp); if (len < 0) { - HILOG_ERROR(LOG_CORE, "fwrite() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fwrite() error"); if (fclose(writeFp) != 0) { - HILOG_ERROR(LOG_CORE, "fclose() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fclose() error"); } return; } int ret = fflush(writeFp); if (ret == EOF) { - HILOG_ERROR(LOG_CORE, "fflush() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fflush() error"); if (fclose(writeFp) != 0) { - HILOG_ERROR(LOG_CORE, "fclose() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fclose() error"); } return; } fsync(fileno(writeFp)); ret = fclose(writeFp); if (ret != 0) { - HILOG_ERROR(LOG_CORE, "fclose() error"); + PROFILER_LOG_ERROR(LOG_CORE, "fclose() error"); return; } diff --git a/device/services/profiler_service/test/unittest/trace_file_reader_test.cpp b/device/services/profiler_service/test/unittest/trace_file_reader_test.cpp index 9808e87e3..63a564cca 100644 --- a/device/services/profiler_service/test/unittest/trace_file_reader_test.cpp +++ b/device/services/profiler_service/test/unittest/trace_file_reader_test.cpp @@ -74,7 +74,7 @@ HWTEST_F(TraceFileReaderTest, WriteRead, TestSize.Level1) pluginData.set_data("Hello, World!"); long bytes = writer->Write(pluginData); EXPECT_EQ(bytes, sizeof(uint32_t) + pluginData.ByteSizeLong()); - HILOG_INFO(LOG_CORE, "[%d/%d] write %ld bytes to %s.", i, n, bytes, path.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "[%d/%d] write %ld bytes to %s.", i, n, bytes, path.c_str()); } writer.reset(); // make sure write done! @@ -85,8 +85,8 @@ HWTEST_F(TraceFileReaderTest, WriteRead, TestSize.Level1) for (int i = 1; i <= n; i++) { ProfilerPluginData data{}; long bytes = reader->Read(data); - HILOG_INFO(LOG_CORE, "data = {%s, %d, %s}", data.name().c_str(), data.status(), data.data().c_str()); - HILOG_INFO(LOG_CORE, "read %ld bytes from %s", bytes, path.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "data = {%s, %d, %s}", data.name().c_str(), data.status(), data.data().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "read %ld bytes from %s", bytes, path.c_str()); } } @@ -109,7 +109,7 @@ HWTEST_F(TraceFileReaderTest, WriteReadBreak, TestSize.Level1) pluginData.set_data("Hello, World!"); long bytes = writer->Write(pluginData); EXPECT_EQ(bytes, sizeof(uint32_t) + pluginData.ByteSizeLong()); - HILOG_INFO(LOG_CORE, "[%d/%d] write %ld bytes to %s.", i, n, bytes, path.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "[%d/%d] write %ld bytes to %s.", i, n, bytes, path.c_str()); } writer.reset(); // make sure write done! @@ -121,8 +121,8 @@ HWTEST_F(TraceFileReaderTest, WriteReadBreak, TestSize.Level1) do { ProfilerPluginData data{}; bytes = reader->Read(data); - HILOG_INFO(LOG_CORE, "data = {%s, %d, %s}", data.name().c_str(), data.status(), data.data().c_str()); - HILOG_INFO(LOG_CORE, "read %ld bytes from %s", bytes, path.c_str()); + PROFILER_LOG_INFO(LOG_CORE, "data = {%s, %d, %s}", data.name().c_str(), data.status(), data.data().c_str()); + PROFILER_LOG_INFO(LOG_CORE, "read %ld bytes from %s", bytes, path.c_str()); } while (bytes > 0); } diff --git a/device/services/profiler_service/test/unittest/trace_file_writer_test.cpp b/device/services/profiler_service/test/unittest/trace_file_writer_test.cpp index f52f8dcce..17e802af5 100644 --- a/device/services/profiler_service/test/unittest/trace_file_writer_test.cpp +++ b/device/services/profiler_service/test/unittest/trace_file_writer_test.cpp @@ -39,7 +39,7 @@ protected: void TearDown() override { int retval = unlink(path.c_str()); - HILOG_DEBUG(LOG_CORE, "unlink(%s): %d", path.c_str(), retval); + PROFILER_LOG_DEBUG(LOG_CORE, "unlink(%s): %d", path.c_str(), retval); } }; diff --git a/device/services/shared_memory/src/share_memory_allocator.cpp b/device/services/shared_memory/src/share_memory_allocator.cpp index 2d293b327..055f3450f 100644 --- a/device/services/shared_memory/src/share_memory_allocator.cpp +++ b/device/services/shared_memory/src/share_memory_allocator.cpp @@ -64,7 +64,7 @@ ShareMemoryBlockPtr ShareMemoryAllocator::CreateMemoryBlockLocal(std::string nam auto block = std::make_shared(name, size); if (!block->Valid()) { - HILOG_INFO(LOG_CORE, "CreateMemoryBlockLocal FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "CreateMemoryBlockLocal FAIL"); return nullptr; } memoryBlocks[name] = block; @@ -79,7 +79,7 @@ ShareMemoryBlockPtr ShareMemoryAllocator::CreateMemoryBlockRemote(std::string na auto block = std::make_shared(name, size, fd); if (!block->Valid()) { - HILOG_INFO(LOG_CORE, "CreateMemoryBlockRemote FAIL"); + PROFILER_LOG_INFO(LOG_CORE, "CreateMemoryBlockRemote FAIL"); return nullptr; } memoryBlocks[name] = block; diff --git a/device/services/shared_memory/src/share_memory_block.cpp b/device/services/shared_memory/src/share_memory_block.cpp index 116dab416..1c78df574 100644 --- a/device/services/shared_memory/src/share_memory_block.cpp +++ b/device/services/shared_memory/src/share_memory_block.cpp @@ -68,7 +68,7 @@ bool ShareMemoryBlock::CreateBlockWithFd(std::string name, uint32_t size, int fd const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlockWithFd mmap ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlockWithFd mmap ERR : %s", buf); return false; } @@ -96,7 +96,7 @@ bool ShareMemoryBlock::CreateBlockWithFd(std::string name, uint32_t size, int fd bool ShareMemoryBlock::CreateBlock(std::string name, uint32_t size) { - HILOG_INFO(LOG_CORE, "CreateBlock %s %d", name.c_str(), size); + PROFILER_LOG_INFO(LOG_CORE, "CreateBlock %s %d", name.c_str(), size); CHECK_TRUE(size > sizeof(BlockHeader), false, "size %u too less!", size); CHECK_TRUE(size % PAGE_SIZE == 0, false, "size %u not times of %d!", size, PAGE_SIZE); @@ -109,7 +109,7 @@ bool ShareMemoryBlock::CreateBlock(std::string name, uint32_t size) const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "OHOS::AshmemSetProt ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "OHOS::AshmemSetProt ERR : %s", buf); return false; } @@ -119,7 +119,7 @@ bool ShareMemoryBlock::CreateBlock(std::string name, uint32_t size) const int bufSize = 256; char buf[bufSize] = {0}; strerror_r(errno, buf, bufSize); - HILOG_ERROR(LOG_CORE, "CreateBlock mmap ERR : %s", buf); + PROFILER_LOG_ERROR(LOG_CORE, "CreateBlock mmap ERR : %s", buf); return false; } @@ -233,11 +233,11 @@ bool ShareMemoryBlock::PutRaw(const int8_t* data, uint32_t size) PthreadLocker locker(header_->info.mutex_); int8_t* rawMemory = GetFreeMemory(size); if (rawMemory == nullptr) { - HILOG_ERROR(LOG_CORE, "PutRaw not enough space [%d]", size); + PROFILER_LOG_ERROR(LOG_CORE, "PutRaw not enough space [%d]", size); return false; } if (memcpy_s(rawMemory, size, data, size) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s error"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s error"); return false; } @@ -255,18 +255,18 @@ bool ShareMemoryBlock::PutRawTimeout(const int8_t* data, uint32_t size) clock_gettime(CLOCK_REALTIME, &time_out); time_out.tv_sec += TIMEOUT_SEC; if (pthread_mutex_timedlock(&header_->info.mutex_, &time_out) != 0) { - HILOG_ERROR(LOG_CORE, "PutRawTimeout failed %d", errno); + PROFILER_LOG_ERROR(LOG_CORE, "PutRawTimeout failed %d", errno); return false; } int8_t* rawMemory = GetFreeMemory(size); if (rawMemory == nullptr) { - HILOG_ERROR(LOG_CORE, "PutRaw not enough space [%d]", size); + PROFILER_LOG_ERROR(LOG_CORE, "PutRaw not enough space [%d]", size); pthread_mutex_unlock(&header_->info.mutex_); return false; } if (memcpy_s(rawMemory, size, data, size) != EOK) { - HILOG_ERROR(LOG_CORE, "memcpy_s error"); + PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s error"); pthread_mutex_unlock(&header_->info.mutex_); return false; } @@ -322,13 +322,13 @@ bool ShareMemoryBlock::PutMessage(const google::protobuf::Message& pmsg, const s PthreadLocker locker(header_->info.mutex_); int8_t* rawMemory = GetFreeMemory(size); if (rawMemory == nullptr) { - HILOG_ERROR(LOG_CORE, "%s: PutMessage not enough space [%zu]", pluginName.c_str(), size); + PROFILER_LOG_ERROR(LOG_CORE, "%s: PutMessage not enough space [%zu]", pluginName.c_str(), size); return false; } int ret = pmsg.SerializeToArray(rawMemory, size); if (ret <= 0) { - HILOG_ERROR(LOG_CORE, "%s: SerializeToArray failed with %d, size: %zu", __func__, ret, size); + PROFILER_LOG_ERROR(LOG_CORE, "%s: SerializeToArray failed with %d, size: %zu", __func__, ret, size); return false; } UseFreeMemory(rawMemory, size); @@ -489,7 +489,7 @@ bool ShareMemoryBlock::GetMemory(uint32_t size, uint8_t** memory, uint32_t* offs } } - HILOG_ERROR(LOG_CORE, "Write not enough space, realSize=%u, rp=%u, wp=%u", realSize, rp, wp); + PROFILER_LOG_ERROR(LOG_CORE, "Write not enough space, realSize=%u, rp=%u, wp=%u", realSize, rp, wp); return false; } diff --git a/interfaces/kits/test/unittest/plugin_module_api_test.cpp b/interfaces/kits/test/unittest/plugin_module_api_test.cpp index 229639a76..09b04fe10 100644 --- a/interfaces/kits/test/unittest/plugin_module_api_test.cpp +++ b/interfaces/kits/test/unittest/plugin_module_api_test.cpp @@ -137,13 +137,13 @@ int PluginModuleApiTest::StreamRegisterWriterStruct(WriterStruct* writer) // write long PluginModuleApiTest::Write(WriterStruct* writer, const void* data, size_t size) { - HILOG_INFO(LOG_CORE, "PluginModuleApiTest::Write no implementation !"); + PROFILER_LOG_INFO(LOG_CORE, "PluginModuleApiTest::Write no implementation !"); return 0; } bool PluginModuleApiTest::Flush(WriterStruct* writer) { - HILOG_INFO(LOG_CORE, "PluginModuleApiTest::Write no implementation !"); + PROFILER_LOG_INFO(LOG_CORE, "PluginModuleApiTest::Write no implementation !"); return true; }