Hilog轻量化

Signed-off-by:wenlong12 <wenlong12@huawei.com>

Signed-off-by: wenlong12 <wenlong12@huawei.com>
This commit is contained in:
wenlong12 2024-01-05 09:19:32 +08:00
parent 5ebb0e5b91
commit ce5c799a7c
4 changed files with 13 additions and 9 deletions

View File

@ -33,6 +33,10 @@
#define UNUSED_PARAMETER(x) ((void)(x))
#endif
#ifdef HAVE_HILOG
#undef HAVE_HILOG
#endif
#ifdef HAVE_HILOG
#include "hilog/log.h"
#include <string>

View File

@ -572,11 +572,11 @@ bool IsBetaVersion()
{
int ret = static_cast<int>(FindParameter(KEY_HIVIEW_USER_TYPE.c_str()));
if (ret == -1) {
HILOG_INFO(LOG_CORE, "user type is not exist");
PROFILER_LOG_INFO(LOG_CORE, "user type is not exist");
return true;
}
std::string userType = OHOS::system::GetParameter(KEY_HIVIEW_USER_TYPE, "");
HILOG_INFO(LOG_CORE, "user type is:%s", userType.c_str());
PROFILER_LOG_INFO(LOG_CORE, "user type is:%s", userType.c_str());
return userType == "beta";
}
} // namespace COMMON

View File

@ -327,15 +327,15 @@ void NativeMemoryProfilerSaService::DelayedShutdown(bool cancel)
[]() {
int ret = SystemSetParameter("hiviewdfx.hiprofiler.native_memoryd.start", "0");
if (ret < 0) {
HILOG_ERROR(LOG_CORE, "DelayedShutdown close sa failed");
PROFILER_LOG_ERROR(LOG_CORE, "DelayedShutdown close sa failed");
} else {
HILOG_INFO(LOG_CORE, "DelayedShutdown close sa success");
PROFILER_LOG_INFO(LOG_CORE, "DelayedShutdown close sa success");
}
},
DELAYED_SHUTDOWN_TIME * TIME_BASE,
true);
if (timerFd == -1) {
HILOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService:DelayedShutdown Schedule Task failed");
PROFILER_LOG_ERROR(LOG_CORE, "NativeMemoryProfilerSaService:DelayedShutdown Schedule Task failed");
return;
}
delayedShutdownTimerFd_ = timerFd;

View File

@ -174,7 +174,7 @@ bool StackPreprocess::HandleNoStackEvent(RawStackPtr& rawData, BatchNativeHookDa
BaseStackRawData* mmapRawData = rawData->stackConext;
std::string filePath(reinterpret_cast<char *>(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());
@ -536,7 +536,7 @@ void StackPreprocess::SetAllocStatisticsFrame(const RawStackPtr& rawStack,
callStack_.resize(rawStack->fpDepth);
if (memcpy_s(callStack_.data(), sizeof(uint64_t) * rawStack->fpDepth,
rawStack->data, sizeof(uint64_t) * rawStack->fpDepth) != EOK) {
HILOG_ERROR(LOG_CORE, "memcpy_s callStack_ failed");
PROFILER_LOG_ERROR(LOG_CORE, "memcpy_s callStack_ failed");
return;
}
std::lock_guard<std::mutex> guard(mtx_);
@ -575,7 +575,7 @@ void StackPreprocess::SetHookData(RawStackPtr rawStack, BatchNativeHookData& bat
break;
}
default: {
HILOG_ERROR(LOG_CORE, "statistics event type: error");
PROFILER_LOG_ERROR(LOG_CORE, "statistics event type: error");
break;
}
}
@ -966,7 +966,7 @@ void StackPreprocess::GetSymbols(const std::string& filePath, ElfSymbolTable& sy
{
std::shared_ptr<DfxElf> elfPtr = std::make_shared<DfxElf>(filePath);
if (elfPtr == nullptr) {
HILOG_ERROR(LOG_CORE, "GetSymbols elfPtr is nullptr");
PROFILER_LOG_ERROR(LOG_CORE, "GetSymbols elfPtr is nullptr");
return;
}