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& processNam); 40 Builder& InitLogPath(const std::string& logPath); 41 WatchPoint Build() const; 42 43 private: 44 long seq_; 45 unsigned long long timestamp_; 46 long pid_; 47 long uid_; 48 long tid_; 49 std::string domain_; 50 std::string stringId_; 51 std::string msg_; 52 std::string packageName_; 53 std::string processName_; 54 std::string logPath_; 55 friend class WatchPoint; 56 }; 57 58 WatchPoint(); 59 explicit WatchPoint(const WatchPoint::Builder& builder); ~WatchPoint()60 ~WatchPoint() {}; 61 62 long GetSeq() const; 63 unsigned long long GetTimestamp() const; 64 long GetPid() const; 65 long GetTid() const; 66 long GetUid() const; 67 std::string GetDomain() const; 68 std::string GetStringId() const; 69 std::string GetMsg() const; 70 std::string GetPackageName() const; 71 std::string GetProcessName() const; 72 std::string GetLogPath() const; 73 void SetLogPath(const std::string& logPath); 74 void SetSeq(long seq); 75 bool operator<(const WatchPoint& node) const; 76 bool operator==(const WatchPoint& node) const; 77 78 private: 79 long seq_; 80 unsigned long long timestamp_; 81 long pid_; 82 long uid_; 83 long tid_; 84 std::string domain_; 85 std::string stringId_; 86 std::string msg_; 87 std::string packageName_; 88 std::string processName_; 89 std::string logPath_; 90 }; 91 } // namespace HiviewDFX 92 } // namespace OHOS 93 #endif 94