1 /* 2 * Copyright (c) 2021 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 16 #ifndef FREEZE_WATCHPOINT_H 17 #define FREEZE_WATCHPOINT_H 18 19 #include <cstdint> 20 #include <string> 21 22 namespace OHOS { 23 namespace HiviewDFX { 24 class WatchPoint { 25 public: 26 class Builder { 27 public: 28 Builder(); 29 ~Builder(); 30 Builder& InitSeq(long seq); 31 Builder& InitTimestamp(unsigned long long timestamp); 32 Builder& InitPid(long pid); 33 Builder& InitTid(long tid); 34 Builder& InitUid(long uid); 35 Builder& InitDomain(const std::string& domain); 36 Builder& InitStringId(const std::string& stringId); 37 Builder& InitMsg(const std::string& msg); 38 Builder& InitPackageName(const std::string& packageName); 39 Builder& InitProcessName(const std::string& processName); 40 Builder& InitForeGround(const std::string& foreGround); 41 Builder& InitLogPath(const std::string& logPath); 42 Builder& InitHitraceTime(const std::string& hitraceTime); 43 Builder& InitSysrqTime(const std::string& sysrqTime); 44 WatchPoint Build() const; 45 46 private: 47 long seq_; 48 unsigned long long timestamp_; 49 long pid_; 50 long uid_; 51 long tid_; 52 std::string domain_; 53 std::string stringId_; 54 std::string msg_; 55 std::string packageName_; 56 std::string processName_; 57 std::string foreGround_; 58 std::string logPath_; 59 std::string hitraceTime_; 60 std::string sysrqTime_; 61 friend class WatchPoint; 62 }; 63 64 WatchPoint(); 65 explicit WatchPoint(const WatchPoint::Builder& builder); ~WatchPoint()66 ~WatchPoint() {}; 67 68 long GetSeq() const; 69 unsigned long long GetTimestamp() const; 70 long GetPid() const; 71 long GetTid() const; 72 long GetUid() const; 73 std::string GetDomain() const; 74 std::string GetStringId() const; 75 std::string GetMsg() const; 76 std::string GetPackageName() const; 77 std::string GetProcessName() const; 78 std::string GetForeGround() const; 79 std::string GetLogPath() const; 80 std::string GetHitraceTime() const; 81 std::string GetSysrqTime() const; 82 void SetLogPath(const std::string& logPath); 83 void SetSeq(long seq); 84 bool operator<(const WatchPoint& node) const; 85 bool operator==(const WatchPoint& node) const; 86 87 private: 88 long seq_; 89 unsigned long long timestamp_; 90 long pid_; 91 long uid_; 92 long tid_; 93 std::string domain_; 94 std::string stringId_; 95 std::string msg_; 96 std::string packageName_; 97 std::string processName_; 98 std::string foreGround_; 99 std::string logPath_; 100 std::string hitraceTime_; 101 std::string sysrqTime_; 102 }; 103 } // namespace HiviewDFX 104 } // namespace OHOS 105 #endif 106