• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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& InitTerminalThreadStack(const std::string& terminalThreadStack);
36         Builder& InitTelemetryId(const std::string& telemetryId);
37         Builder& InitTraceName(const std::string& traceName);
38         Builder& InitDomain(const std::string& domain);
39         Builder& InitStringId(const std::string& stringId);
40         Builder& InitMsg(const std::string& msg);
41         Builder& InitPackageName(const std::string& packageName);
42         Builder& InitProcessName(const std::string& processName);
43         Builder& InitForeGround(const std::string& foreGround);
44         Builder& InitLogPath(const std::string& logPath);
45         Builder& InitHitraceTime(const std::string& hitraceTime);
46         Builder& InitSysrqTime(const std::string& sysrqTime);
47         Builder& InitHitraceIdInfo(const std::string& hitraceIdInfo);
48         Builder& InitProcStatm(const std::string& procStatm);
49         Builder& InitHostResourceWarning(const std::string& hostResourceWarning);
50         WatchPoint Build() const;
51 
52     private:
53         long seq_;
54         unsigned long long timestamp_;
55         long pid_;
56         long tid_;
57         long uid_;
58         std::string terminalThreadStack_;
59         std::string telemetryId_;
60         std::string traceName_;
61         std::string domain_;
62         std::string stringId_;
63         std::string msg_;
64         std::string packageName_;
65         std::string processName_;
66         std::string foreGround_;
67         std::string logPath_;
68         std::string hitraceTime_;
69         std::string sysrqTime_;
70         std::string hitraceIdInfo_;
71         std::string procStatm_;
72         std::string hostResourceWarning_;
73         friend class WatchPoint;
74     };
75 
76     WatchPoint();
77     explicit WatchPoint(const WatchPoint::Builder& builder);
~WatchPoint()78     ~WatchPoint() {};
79 
80     long GetSeq() const;
81     unsigned long long GetTimestamp() const;
82     long GetPid() const;
83     long GetTid() const;
84     long GetUid() const;
85     std::string GetTerminalThreadStack() const;
86     std::string GetTelemetryId() const;
87     std::string GetTraceName() const;
88     std::string GetDomain() const;
89     std::string GetStringId() const;
90     std::string GetMsg() const;
91     std::string GetPackageName() const;
92     std::string GetProcessName() const;
93     std::string GetForeGround() const;
94     std::string GetLogPath() const;
95     std::string GetHitraceTime() const;
96     std::string GetSysrqTime() const;
97     std::string GetHitraceIdInfo() const;
98     std::string GetProcStatm() const;
99     std::string GetHostResourceWarning() const;
100     void SetLogPath(const std::string& logPath);
101     void SetTerminalThreadStack(const std::string& terminalThreadStack);
102     void SetSeq(long seq);
103     bool operator<(const WatchPoint& node) const;
104     bool operator==(const WatchPoint& node) const;
105 
106 private:
107     long seq_;
108     unsigned long long timestamp_;
109     long pid_;
110     long tid_;
111     long uid_;
112     std::string terminalThreadStack_;
113     std::string telemetryId_;
114     std::string traceName_;
115     std::string domain_;
116     std::string stringId_;
117     std::string msg_;
118     std::string packageName_;
119     std::string processName_;
120     std::string foreGround_;
121     std::string logPath_;
122     std::string hitraceTime_;
123     std::string sysrqTime_;
124     std::string hitraceIdInfo_;
125     std::string procStatm_;
126     std::string hostResourceWarning_;
127 };
128 } // namespace HiviewDFX
129 } // namespace OHOS
130 #endif
131