diff --git a/base/event_publish/app_event_handler.cpp b/base/event_publish/app_event_handler.cpp index 0da68b510e83875f3ffc32c50262da302c74a471..3e607b1cf45d92f13e488c31e09b7b02b65d8a60 100644 --- a/base/event_publish/app_event_handler.cpp +++ b/base/event_publish/app_event_handler.cpp @@ -158,13 +158,16 @@ int AppEventHandler::PostEvent(const ResourceOverLimitInfo& event) AddValueToJsonString("pid", event.pid, jsonStr); AddValueToJsonString("uid", event.uid, jsonStr); AddValueToJsonString("resource_type", event.resourceType, jsonStr); - AddObjectToJsonString("memory", jsonStr); - AddValueToJsonString("pss", event.pss, jsonStr); - AddValueToJsonString("rss", event.rss, jsonStr); - AddValueToJsonString("vss", event.vss, jsonStr); - AddValueToJsonString("sys_avail_mem", event.avaliableMem, jsonStr); - AddValueToJsonString("sys_free_mem", event.freeMem, jsonStr); - AddValueToJsonString("sys_total_mem", event.totalMem, jsonStr, true); + if (event.resourceType == "pss_memory") { + AddObjectToJsonString("memory", jsonStr); + AddValueToJsonString("pss", event.pss, jsonStr); + AddValueToJsonString("rss", event.rss, jsonStr); + AddValueToJsonString("vss", event.vss, jsonStr); + AddValueToJsonString("sys_avail_mem", event.avaliableMem, jsonStr); + AddValueToJsonString("sys_free_mem", event.freeMem, jsonStr); + AddValueToJsonString("sys_total_mem", event.totalMem, jsonStr, true); + } + AddVectorToJsonString("external_log", event.logPath, jsonStr); jsonStr << "}" << std::endl; EventPublish::GetInstance().PushEvent(event.uid, "RESOURCE_OVERLIMIT", HiSysEvent::EventType::FAULT, jsonStr.str()); return 0; diff --git a/base/event_publish/include/app_event_handler.h b/base/event_publish/include/app_event_handler.h index 654ccf5e7bf3b50354d53c9ad200363cc9ffcee7..fb451c680e154bb5b3888bf5c9982281985c7258 100644 --- a/base/event_publish/include/app_event_handler.h +++ b/base/event_publish/include/app_event_handler.h @@ -96,6 +96,7 @@ public: int32_t pid = 0; int32_t uid = 0; std::string resourceType; + std::vector logPath; }; int PostEvent(const AppLaunchInfo& event); diff --git a/plugins/reliability/leak_detectors/native_leak/native_leak_detector.cpp b/plugins/reliability/leak_detectors/native_leak/native_leak_detector.cpp index ed58602edf0bdf0598a0ead120be6a33ae849775..19e7152ef08f30d97962e8d04c68afb25a61e99e 100755 --- a/plugins/reliability/leak_detectors/native_leak/native_leak_detector.cpp +++ b/plugins/reliability/leak_detectors/native_leak/native_leak_detector.cpp @@ -136,7 +136,7 @@ void NativeLeakDetector::UpdateUserMonitorInfo() } } -void NativeLeakDetector::RemoveInvalidLeakedPid() +void NativeLeakDetector::RemoveDiedPid() { for (auto it = monitoredPidsInfo_.begin(); it != monitoredPidsInfo_.end(); it++) { auto userMonitorInfo = static_pointer_cast(it->second); @@ -156,7 +156,7 @@ void NativeLeakDetector::RemoveInvalidLeakedPid() void NativeLeakDetector::RemoveInvalidUserInfo() { - RemoveInvalidLeakedPid(); + RemoveDiedPid(); for (auto it = grayList_.begin(); it != grayList_.end();) { if (it->second == nullptr) { it = grayList_.erase(it); diff --git a/plugins/reliability/leak_detectors/native_leak/native_leak_detector.h b/plugins/reliability/leak_detectors/native_leak/native_leak_detector.h index 78e0123e8160f97c1101babb5a572b4201deea8f..eb5c4a3078128b5b870a456a873ba4d3565c159f 100755 --- a/plugins/reliability/leak_detectors/native_leak/native_leak_detector.h +++ b/plugins/reliability/leak_detectors/native_leak/native_leak_detector.h @@ -46,7 +46,7 @@ private: void InitMonitorInfo(); void UpdateUserMonitorInfo(); void RecordNativeInfo(); - void RemoveInvalidLeakedPid(); + void RemoveDiedPid(); void RemoveInvalidUserInfo(); void UpdateProcessedPidsList(); void RemoveFinishedInfo(int64_t pid); diff --git a/plugins/reliability/leak_detectors/native_leak/native_leak_util.h b/plugins/reliability/leak_detectors/native_leak/native_leak_util.h index 77106aa0da0922a3d6ecff02ce2083ac35999010..eea3360aea87f2083943262dca7d5a3450bce69f 100755 --- a/plugins/reliability/leak_detectors/native_leak/native_leak_util.h +++ b/plugins/reliability/leak_detectors/native_leak/native_leak_util.h @@ -30,7 +30,7 @@ constexpr uint32_t MTYPE_USER_PSS = (MTYPE_USER_PSS_JAVA | MTYPE_USER_PSS_NATIVE enum { NATIVE_MEMORY = 0, - MEMORY_TYPE_CNT // CNT or MAX ? + MEMORY_TYPE_CNT }; constexpr uint32_t MEMCHECK_STACKINFO_MAXSIZE = 600 * 1024;