1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #include "native_leak_info.h" 16 17 #include <string> 18 19 namespace OHOS { 20 namespace HiviewDFX { 21 using std::string; 22 using std::vector; 23 using std::to_string; 24 ~NativeLeakInfo()25NativeLeakInfo::~NativeLeakInfo() {} 26 GetPidStartTime() const27time_t NativeLeakInfo::GetPidStartTime() const 28 { 29 return pidStartTime_; 30 } 31 SetPidStartTime(time_t startTime)32void NativeLeakInfo::SetPidStartTime(time_t startTime) 33 { 34 pidStartTime_ = startTime; 35 } 36 GetActualRssThreshold() const37uint64_t NativeLeakInfo::GetActualRssThreshold() const 38 { 39 return actualRssThreshold_; 40 } 41 SetActualRssThreshold(uint64_t value)42void NativeLeakInfo::SetActualRssThreshold(uint64_t value) 43 { 44 actualRssThreshold_ = value; 45 } 46 GetDebugStartTime() const47time_t NativeLeakInfo::GetDebugStartTime() const 48 { 49 return debugStartTime_; 50 } 51 SetDebugStartTime(time_t value)52void NativeLeakInfo::SetDebugStartTime(time_t value) 53 { 54 debugStartTime_ = value; 55 } 56 GetLeakGrade() const57string NativeLeakInfo::GetLeakGrade() const 58 { 59 return leakGrade_; 60 } 61 SetLeakGrade(const string & grade)62void NativeLeakInfo::SetLeakGrade(const string &grade) 63 { 64 leakGrade_ = grade; 65 } 66 GetJavaState() const67bool NativeLeakInfo::GetJavaState() const 68 { 69 return javaState_; 70 } 71 SetJavaState(bool flag)72void NativeLeakInfo::SetJavaState(bool flag) 73 { 74 javaState_ = flag; 75 } 76 GetInThresholdList() const77bool NativeLeakInfo::GetInThresholdList() const 78 { 79 return isInThresholdList_; 80 } 81 SetInThresholdList(bool flag)82void NativeLeakInfo::SetInThresholdList(bool flag) 83 { 84 isInThresholdList_ = flag; 85 } 86 GetIsProcessDied() const87bool NativeLeakInfo::GetIsProcessDied() const 88 { 89 return isProcessDied_; 90 } 91 SetIsProcessDied(bool flag)92void NativeLeakInfo::SetIsProcessDied(bool flag) 93 { 94 isProcessDied_ = flag; 95 } 96 GetIsAppendSmapsFile() const97bool NativeLeakInfo::GetIsAppendSmapsFile() const 98 { 99 return isAppendSmapsFile_; 100 } 101 SetIsAppendSmapsFile(bool flag)102void NativeLeakInfo::SetIsAppendSmapsFile(bool flag) 103 { 104 isAppendSmapsFile_ = flag; 105 } 106 GetIsDumpHiprofilerDrop() const107bool NativeLeakInfo::GetIsDumpHiprofilerDrop() const 108 { 109 return isDumpHiprofilerDrop_; 110 } 111 SetIsDumpHiprofilerDrop(bool flag)112void NativeLeakInfo::SetIsDumpHiprofilerDrop(bool flag) 113 { 114 isDumpHiprofilerDrop_ = flag; 115 } 116 GetSampleFilePath()117string NativeLeakInfo::GetSampleFilePath() 118 { 119 string path = MEMORY_LEAK_PATH + "/memleak-native-" + processName_ + "-" + to_string(pid_) + "-sample.txt"; 120 return path; 121 } 122 GetLogFilePath()123string NativeLeakInfo::GetLogFilePath() 124 { 125 string path = MEMORY_LEAK_PATH + "/memleak-temp-" + processName_ + "-" + to_string(pid_) + "-" + 126 leakedTime_ + ".txt"; 127 return path; 128 } 129 GetRsMemPath()130string NativeLeakInfo::GetRsMemPath() 131 { 132 string path = MEMORY_LEAK_PATH + "/memleak-temp-" + processName_ + "-" + to_string(pid_) + "-rsMem.txt"; 133 return path; 134 } 135 GetRsGpuPath()136string NativeLeakInfo::GetRsGpuPath() 137 { 138 string path = MEMORY_LEAK_PATH + "/memleak-temp-" + processName_ + "-" + to_string(pid_) + "-rsGpu.txt"; 139 return path; 140 } 141 GetSmapsPath()142string NativeLeakInfo::GetSmapsPath() 143 { 144 string path = MEMORY_LEAK_PATH + "/memleak-native-" + processName_ + "-" + to_string(pid_) + "-smaps.txt"; 145 return path; 146 } 147 148 } // namespace HiviewDFX 149 } // namespace OHOS 150