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