告警清理

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

Signed-off-by: wenlong12 <wenlong12@huawei.com>
This commit is contained in:
wenlong12 2023-12-28 15:47:36 +08:00
parent 3f6dca1e7b
commit 891ba6b661
10 changed files with 26 additions and 28 deletions

View File

@ -33,7 +33,7 @@ int main(int agrc, char* agrv[])
return 0;
}
std::cout << "test:handle = " << handle << std::endl;
gpuPlugin = static_cast<PluginModuleStruct*>(dlsym(handle, "g_pluginModule"));
gpuPlugin = reinterpret_cast<PluginModuleStruct*>(dlsym(handle, "g_pluginModule"));
std::cout << "test:name = " << gpuPlugin->name << std::endl;
std::cout << "test:buffer size = " << gpuPlugin->resultBufferSizeHint << std::endl;

View File

@ -318,8 +318,8 @@ enum WinMgrSvcType {
};
struct GraphicsMemory {
uint64_t gl;
uint64_t graph;
uint64_t gl = 0;
uint64_t graph = 0;
};
const std::vector<std::pair<OHOS::HDI::Memorytracker::V1_0::MemoryTrackerType, std::string>> MEMORY_TRACKER_TYPES = {
@ -362,14 +362,14 @@ private:
std::unique_ptr<uint8_t[]> buffer_;
int meminfoFd_;
int vmstatFd_;
std::map<std::string, int> meminfoCounters_;
std::map<std::string, int> vmstatCounters_;
int meminfoFd_ = -1;
int vmstatFd_ = -1;
std::map<std::string, int> meminfoCounters_ = {};
std::map<std::string, int> vmstatCounters_ = {};
void InitProto2StrVector();
std::vector<const char*> meminfoStrList_;
std::vector<const char*> vmstatStrList_;
std::vector<const char*> meminfoStrList_ = {};
std::vector<const char*> vmstatStrList_ = {};
// SmapsStats *
template <typename T> void WriteVmstat(T& memoryData);
@ -378,10 +378,10 @@ private:
template <typename T> void WriteZramData(T& memoryData);
std::unordered_map<int32_t, std::vector<int>> pidFds_;
std::vector<int32_t> seenPids_;
char* testpath_;
int32_t err_;
std::unordered_map<int32_t, std::vector<int>> pidFds_ = {};
std::vector<int32_t> seenPids_ = {};
char* testpath_ = nullptr;
int32_t err_ = -1;
int32_t ReadFile(int fd);
std::string ReadFile(const std::string& path);
std::vector<int> OpenProcPidFiles(int32_t pid);

View File

@ -21,7 +21,7 @@
#include <set>
struct HookData {
std::set<std::string> pids;
std::set<std::string> pids = {};
uint32_t smbSize {0};
uint64_t duration {0};
uint32_t filterSize {0};

View File

@ -26,8 +26,8 @@ using namespace OHOS::Developtools::NativeDaemon;
static uint32_t TestDumpFile()
{
uint32_t fd = open("/data/local/tmp/test_dump_file.htrace",
O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
uint32_t fd = static_cast<uint32_t>(open("/data/local/tmp/test_dump_file.htrace",
O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH));
return fd;
}
@ -102,7 +102,7 @@ int32_t main(int32_t argc, char* argv[])
} else if ((arg == "--munmapStackData") || (arg == "-musd")) {
config->munmapStackData_ = true;
} else if ((arg == "--mallocFreeMatchingInterval") || (arg == "-mfmi")) {
config->mallocFreeMatchingInterval_ = std::stoi(argv[++i]);
config->mallocFreeMatchingInterval_ = static_cast<uint32_t>(std::stoi(argv[++i]));
} else if ((arg == "--mallocFreeMatchingCnt") || (arg == "-mfmc")) {
config->mallocFreeMatchingCnt_ = std::stoi(argv[++i]);
} else if ((arg == "--disable_stringCompressed") || (arg == "-sc")) {

View File

@ -54,7 +54,10 @@ bool NativeMemoryProfilerSaService::StartServiceAbility()
CHECK_NOTNULL(serviceManager, false, "serviceManager is nullptr");
auto native = new NativeMemoryProfilerSaService();
CHECK_NOTNULL(native, false, "native is nullptr");
if (native == nullptr) {
HILOG_ERROR(LOG_CORE, "native is nullptr");
return false;
}
int32_t result = serviceManager->AddSystemAbility(NATIVE_DAEMON_SYSTEM_ABILITY_ID, native);
if (result != 0) {
HILOG_ERROR(LOG_CORE, "Service native memory failed to start");

View File

@ -221,7 +221,7 @@ bool HookManager::HandleHookContext(const std::shared_ptr<HookManagerCtx>& ctx)
return false;
}
// create smb and eventNotifier
uint32_t bufferSize = hookConfig_.smb_pages() * PAGE_BYTES; /* bufferConfig.pages() */
uint32_t bufferSize = static_cast<uint32_t>(hookConfig_.smb_pages()) * PAGE_BYTES; /* bufferConfig.pages() */
ctx->shareMemoryBlock = ShareMemoryAllocator::GetInstance().CreateMemoryBlockLocal(ctx->smbName, bufferSize);
CHECK_TRUE(ctx->shareMemoryBlock != nullptr, false, "CreateMemoryBlockLocal FAIL %s", ctx->smbName.c_str());

View File

@ -34,7 +34,6 @@ std::shared_ptr<HookManager> g_hookManager;
NativeHookConfig g_nativeConfig;
static void SignalHandl(int signo)
{
HILOG_INFO(LOG_CORE, "SignalHandl recv %d", signo);
std::vector<uint32_t> pluginIds;
g_hookManager->StopPluginSession(pluginIds);
g_hookManager->DestroyPluginSession(pluginIds);

View File

@ -427,11 +427,6 @@ void StackPreprocess::SetEventFrame(const RawStackPtr& rawStack,
if (hookConfig_.callframe_compress() && stackMapId != 0) {
event->set_stack_id(stackMapId);
} else if (hookConfig_.string_compressed()) {
for (; idx < callFrames.size(); ++idx) {
Frame* frame = event->add_frame_info();
SetFrameInfo(*frame, callFrames[idx]);
}
} else {
for (; idx < callFrames.size(); ++idx) {
Frame* frame = event->add_frame_info();

View File

@ -225,8 +225,10 @@ bool VirtualThread::ParseMap(std::vector<std::shared_ptr<DfxMap>>& memMaps, bool
std::shared_ptr<DfxMaps> dfxMaps = OHOS::HiviewDFX::DfxMaps::Create(pid_, mapPath);
if (dfxMaps == nullptr) {
HLOGE("VirtualThread Failed to Parse Map.");
} else {
memMaps = dfxMaps->GetMaps();
}
memMaps = dfxMaps->GetMaps();
bool mapsAdded = !update;
std::vector<std::shared_ptr<DfxMap>> tempMap;
std::string tempMapName;
@ -296,7 +298,7 @@ void VirtualThread::SortMaps()
}
if (targetPos < static_cast<int>(currPos - 1)) {
auto target = (*maps_)[currPos];
for (size_t k = currPos - 1; k > targetPos; --k) {
for (size_t k = currPos - 1; k > static_cast<size_t>(targetPos); --k) {
(*maps_)[k + 1] = (*maps_)[k];
}
(*maps_)[targetPos + 1] = target;

View File

@ -85,7 +85,6 @@ void BaseMessage::AddBytes(uint32_t fieldId, const void* data, uint32_t dataSize
uint8_t* fieldMemory = nullptr;
uint32_t fieldOffset = 0;
// max field size = varint(fieldId + type) + varint(dataSize) + dataSize
if (!writeCtx_->getMemory(writeCtx_, VARINT_ENCODE_MAX_SIZE + SIZE_RESERVED_LEN + dataSize,
&fieldMemory, &fieldOffset)) {
Drop();