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 #ifndef NATIVE_LEAK_INFO_H 16 #define NATIVE_LEAK_INFO_H 17 18 #include <string> 19 #include "fault_info_base.h" 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 24 enum { 25 GENERAL_STATISTICS = 1, 26 ACCURATE_STATISTICS = 1 << 1, 27 STACK_STATISTICS = 1 << 2 28 }; 29 30 class NativeLeakInfo : public MemoryLeakInfoBase { 31 public: 32 ~NativeLeakInfo(); 33 34 std::string GetSampleFilePath() override; 35 std::string GetLogFilePath() override; 36 std::string GetRsMemPath() override; 37 time_t GetPidStartTime() const; 38 void SetPidStartTime(time_t startTime); 39 time_t GetDebugStartTime() const; 40 void SetDebugStartTime(time_t value); 41 uint64_t GetActualRssThreshold() const; 42 void SetActualRssThreshold(uint64_t value); 43 std::string GetLeakGrade() const; 44 void SetLeakGrade(const std::string &grade); 45 bool GetInThresholdList() const; 46 void SetInThresholdList(bool flag); 47 bool GetJavaState() const; 48 void SetJavaState(bool flag); 49 bool GetIsProcessDied() const; 50 void SetIsProcessDied(bool flag); 51 bool GetIsAppendSmapsFile() const; 52 void SetIsAppendSmapsFile(bool flag); 53 bool GetIsDumpHiprofilerDrop() const; 54 void SetIsDumpHiprofilerDrop(bool flag); 55 std::string GetRsGpuPath(); 56 std::string GetSmapsPath(); 57 58 private: 59 time_t pidStartTime_ { 0 }; 60 time_t debugStartTime_ { 0 }; 61 uint64_t actualRssThreshold_ { 0 }; 62 bool javaState_ { false }; 63 bool isInThresholdList_ { false }; 64 bool isProcessDied_ { false }; 65 bool isDumpHiprofilerDrop_ { false }; 66 bool isAppendSmapsFile_ { false }; 67 std::string leakGrade_; 68 }; 69 } // namespace HiviewDFX 70 } // namespace OHOS 71 #endif // NATIVE_LEAK_INFO_H 72