告警清理

Signed-off-by: ganchuantao <ganchuantao1@huawei.com>
Change-Id: Id92b4afaac0d4dad5bd66dfdf52c1c40f22a5e3b
This commit is contained in:
ganchuantao 2024-11-20 16:54:27 +08:00
parent 639711a834
commit 833004b303
10 changed files with 10 additions and 16 deletions

View File

@ -67,8 +67,6 @@ MemoryDataPlugin::~MemoryDataPlugin()
{
PROFILER_LOG_INFO(LOG_CORE, "%s:~MemoryDataPlugin!", __func__);
buffer_ = nullptr;
if (meminfoFd_ > 0) {
close(meminfoFd_);
meminfoFd_ = -1;

View File

@ -85,7 +85,7 @@ int DebugLogger::Log(DebugLevel level, const std::string &logTag, const char *fm
const auto startSprintf = steady_clock::now();
#endif
const auto startTime = steady_clock::now();
if (!ShouldLog(level, logTag) or logDisabled_ or fmt == nullptr) {
if (!ShouldLog(level, logTag) || logDisabled_ || fmt == nullptr) {
#ifdef HIPERF_DEBUG_TIME
logTimes_ += duration_cast<microseconds>(steady_clock::now() - startSprintf);
#endif
@ -101,7 +101,7 @@ int DebugLogger::Log(DebugLevel level, const std::string &logTag, const char *fm
#ifdef HIPERF_DEBUG_TIME
logSprintfTimes_ += duration_cast<microseconds>(steady_clock::now() - startSprintf);
#endif
if ((mixLogOutput_ and level < LEVEL_FATAL) or level == LEVEL_FATAL) {
if ((mixLogOutput_ && level < LEVEL_FATAL) || level == LEVEL_FATAL) {
ret = fprintf(stdout, "%s", buffer.data()); // to the stdout
}

View File

@ -31,8 +31,6 @@
#include "share_memory_allocator.h"
#include "utilities.h"
#include "virtual_runtime.h"
#include "hook_common.h"
#include "common.h"
#include "native_memory_profiler_sa_service.h"
namespace OHOS::Developtools::NativeDaemon {

View File

@ -469,7 +469,7 @@ const DfxSymbol VirtualRuntime::GetSymbol(CallFrame& callFrame, pid_t pid, pid_t
} else if (GetSymbolCache(callFrame.ip_, symbol, GetThread(pid, tid))) {
return symbol;
}
if (context == PERF_CONTEXT_USER or (context == PERF_CONTEXT_MAX and !symbol.IsValid())) {
if (context == PERF_CONTEXT_USER || (context == PERF_CONTEXT_MAX && !symbol.IsValid())) {
// check userspace memmap
symbol = GetUserSymbol(callFrame.ip_, GetThread(pid, tid));
if (symbol.IsValid()) {

View File

@ -134,9 +134,9 @@ static void GetAnUnlimitedLine(FILE* fp, std::string& buf)
static bool IsLegalSoName(const std::string &fileName)
{
if (fileName.front() == '[' or fileName.back() == ']' or
std::strncmp(fileName.c_str(), "/dev/", sizeof("/dev/")) == 0 or
std::strncmp(fileName.c_str(), "/memfd:", sizeof("/memfd:")) == 0 or
if (fileName.front() == '[' || fileName.back() == ']' ||
std::strncmp(fileName.c_str(), "/dev/", sizeof("/dev/")) == 0 ||
std::strncmp(fileName.c_str(), "/memfd:", sizeof("/memfd:")) == 0 ||
std::strncmp(fileName.c_str(), "//anon", sizeof("//anon")) == 0) {
return false;
}

View File

@ -64,5 +64,4 @@ bool TraceFileHelper::Validate(const TraceFileHeader& header)
{
CHECK_TRUE(Finish(), false, "Finish FAILED!");
return memcmp(&header_, &header, sizeof(header_)) == 0;
return true;
}

View File

@ -403,7 +403,7 @@ int BPFEventReceiver::EncodeSTRTraceEvent(
item->srcTracer_ = cmplt_event->start_event.stracer;
item->srcType_ = cmplt_event->start_event.type;
item->strLen_ = cmplt_event->len;
if (item->strLen_ and item->strLen_ <= MAX_FILENAME_LEN) {
if (item->strLen_ && item->strLen_ <= MAX_FILENAME_LEN) {
char *filename = reinterpret_cast<char*>(tlvItem);
filename += sizeof(struct FixedSTRTraceTLVItem);
CHECK_TRUE(strncpy_s(filename, MAX_FILENAME_LEN, cmplt_event->filename, item->strLen_) == EOK, -1,

View File

@ -261,10 +261,10 @@ bool ElfHeader::Init(unsigned char * const ehdrBuf, const std::size_t bufSize)
CHECK_TRUE(magicStr.compare(elfMagic) == 0, false, "elf magic not found");
std::copy(ehdrBuf, ehdrBuf + EI_NIDENT, ehdrIdent_);
if (ehdrBuf[EI_CLASS] == ELFCLASS32 and ParseElf32Header(ehdrBuf, bufSize)) {
if (ehdrBuf[EI_CLASS] == ELFCLASS32 && ParseElf32Header(ehdrBuf, bufSize)) {
return true;
}
if (ehdrBuf[EI_CLASS] == ELFCLASS64 and ParseElf64Header(ehdrBuf, bufSize)) {
if (ehdrBuf[EI_CLASS] == ELFCLASS64 && ParseElf64Header(ehdrBuf, bufSize)) {
return true;
}
HHLOGE(true, "init elf header failed, elf header buffer dumped");

View File

@ -103,7 +103,6 @@ uint32_t KernelSymbolInfo::GetSymbolData(std::vector<uint8_t> &buf)
}
prevSymbol = currSymbol;
}
file.close();
if (prevSymbol.type_ == 'T') {
symbolItems.emplace_back(prevSymbol);
strTabLen += prevSymbol.name_.size() + 1;

View File

@ -24,7 +24,7 @@ namespace Hiebpf {
std::string ReadFileToString(const std::string &fileName)
{
std::ifstream inputString(fileName, std::ios::in);
if (!inputString or !inputString.is_open()) {
if (!inputString || !inputString.is_open()) {
return EMPTY_STRING;
}
std::istreambuf_iterator<char> firstIt = {inputString};