• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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 HISYSEVENT_STDTYPE_H
17 #define HISYSEVENT_STDTYPE_H
18 #include "base_stdtype.h"
19 
20 namespace SysTuning {
21 namespace TraceStdtype {
22 class HiSysEventSubkeys : public CacheBase {
23 public:
24     uint32_t AppendSysEventSubkey(DataIndex eventSource, DataIndex appName);
25     const std::deque<DataIndex> &SysEventNameId() const;
26     const std::deque<DataIndex> &SysEventSubkeyId() const;
Clear()27     void Clear() override
28     {
29         CacheBase::Clear();
30         sysEventNameIds_.clear();
31         subkeyNameIds_.clear();
32     }
33 
34 private:
35     std::deque<DataIndex> sysEventNameIds_ = {};
36     std::deque<DataIndex> subkeyNameIds_ = {};
37 };
38 
39 struct HiSysEventMeasureDataRow {
40     /* data */
41     uint64_t serial = INVALID_UINT64;
42     uint64_t ts = INVALID_UINT64;
43     uint32_t nameId = INVALID_UINT32;
44     uint32_t keyId = INVALID_UINT32;
45     int32_t type = INVALID_UINT32;
46     double numericValue;
47     DataIndex stringValue = INVALID_DATAINDEX;
48 };
49 
50 class HiSysEventMeasureData : public CacheBase {
51 public:
52     void AppendData(const HiSysEventMeasureDataRow &context);
53     const std::deque<uint64_t> &Serial() const;
54     const std::deque<uint64_t> &Ts() const;
55     const std::deque<uint32_t> &NameFilterId() const;
56     const std::deque<uint32_t> &AppKeyFilterId() const;
57     const std::deque<int32_t> &Type() const;
58     const std::deque<double> &NumValue() const;
59     const std::deque<DataIndex> &StringValue() const;
Clear()60     void Clear() override
61     {
62         CacheBase::Clear();
63         serial_.clear();
64         ts_.clear();
65         nameFilterIds_.clear();
66         appKeyFilterIds_.clear();
67         types_.clear();
68         numValues_.clear();
69         stringValues_.clear();
70     }
71 
72 private:
73     std::deque<uint64_t> serial_ = {};
74     std::deque<uint64_t> ts_ = {};
75     std::deque<uint32_t> nameFilterIds_ = {};
76     std::deque<uint32_t> appKeyFilterIds_ = {};
77     std::deque<int32_t> types_ = {};
78     std::deque<double> numValues_ = {};
79     std::deque<DataIndex> stringValues_ = {};
80     uint32_t rowCount_ = 0;
81 };
82 
83 struct HiSysEventDeviceStateDataRow {
84     /* data */
85     int32_t brightness = INVALID_UINT32;
86     int32_t btState = INVALID_UINT32;
87     int32_t location = INVALID_UINT32;
88     int32_t wifi = INVALID_UINT32;
89     int32_t streamDefault = INVALID_UINT32;
90     int32_t voiceCall = INVALID_UINT32;
91     int32_t music = INVALID_UINT32;
92     int32_t streamRing = INVALID_UINT32;
93     int32_t media = INVALID_UINT32;
94     int32_t voiceAssistant = INVALID_UINT32;
95     int32_t system = INVALID_UINT32;
96     int32_t alarm = INVALID_UINT32;
97     int32_t notification = INVALID_UINT32;
98     int32_t btSco = INVALID_UINT32;
99     int32_t enforcedAudible = INVALID_UINT32;
100     int32_t streamDtmf = INVALID_UINT32;
101     int32_t streamTts = INVALID_UINT32;
102     int32_t accessibility = INVALID_UINT32;
103     int32_t recording = INVALID_UINT32;
104     int32_t streamAll = INVALID_UINT32;
105 };
106 
107 class HiSysEventDeviceStateData : public CacheBase {
108 public:
109     void AppendNewData(const HiSysEventDeviceStateDataRow &context);
110     const std::deque<int32_t> &Brightness() const;
111     const std::deque<int32_t> &BtState() const;
112     const std::deque<int32_t> &Location() const;
113     const std::deque<int32_t> &Wifi() const;
114     const std::deque<int32_t> &StreamDefault() const;
115     const std::deque<int32_t> &VoiceCall() const;
116     const std::deque<int32_t> &Music() const;
117     const std::deque<int32_t> &StreamRing() const;
118     const std::deque<int32_t> &Media() const;
119     const std::deque<int32_t> &VoiceAssistant() const;
120     const std::deque<int32_t> &System() const;
121     const std::deque<int32_t> &Alarm() const;
122     const std::deque<int32_t> &Notification() const;
123     const std::deque<int32_t> &BtSco() const;
124     const std::deque<int32_t> &EnforcedAudible() const;
125     const std::deque<int32_t> &StreamDtmf() const;
126     const std::deque<int32_t> &StreamTts() const;
127     const std::deque<int32_t> &Accessibility() const;
128     const std::deque<int32_t> &Recordings() const;
129     const std::deque<int32_t> &StreamAll() const;
Clear()130     void Clear() override
131     {
132         CacheBase::Clear();
133         brightness_.clear();
134         btStates_.clear();
135         locations_.clear();
136         wifis_.clear();
137         streamDefaults_.clear();
138         voiceCalls_.clear();
139         musics_.clear();
140         streamRings_.clear();
141         medias_.clear();
142         voiceAssistants_.clear();
143         systems_.clear();
144         alarms_.clear();
145         notifications_.clear();
146         btScos_.clear();
147         enforcedAudibles_.clear();
148         streamDtmfs_.clear();
149         streamTts_.clear();
150         accessibilitys_.clear();
151         recordings_.clear();
152         streamAlls_.clear();
153     }
154 
155 private:
156     std::deque<uint32_t> stringValues_ = {};
157     std::deque<int32_t> brightness_ = {};
158     std::deque<int32_t> btStates_ = {};
159     std::deque<int32_t> locations_ = {};
160     std::deque<int32_t> wifis_ = {};
161     std::deque<int32_t> streamDefaults_ = {};
162     std::deque<int32_t> voiceCalls_ = {};
163     std::deque<int32_t> musics_ = {};
164     std::deque<int32_t> streamRings_ = {};
165     std::deque<int32_t> medias_ = {};
166     std::deque<int32_t> voiceAssistants_ = {};
167     std::deque<int32_t> systems_ = {};
168     std::deque<int32_t> alarms_ = {};
169     std::deque<int32_t> notifications_ = {};
170     std::deque<int32_t> btScos_ = {};
171     std::deque<int32_t> enforcedAudibles_ = {};
172     std::deque<int32_t> streamDtmfs_ = {};
173     std::deque<int32_t> streamTts_ = {};
174     std::deque<int32_t> accessibilitys_ = {};
175     std::deque<int32_t> recordings_ = {};
176     std::deque<int32_t> streamAlls_ = {};
177     uint32_t rowCounts_ = 0;
178 };
179 struct HiSysEventAllEventDataRow {
180     DataIndex domainId = INVALID_UINT64;
181     DataIndex eventNameId = INVALID_UINT64;
182     uint64_t timeStamp = INVALID_UINT64;
183     uint32_t type = INVALID_UINT32;
184     std::string timeZone;
185     uint32_t pid = INVALID_UINT32;
186     uint32_t tid = INVALID_UINT32;
187     uint32_t uid = INVALID_UINT32;
188     std::string level;
189     std::string tag;
190     std::string eventId;
191     uint64_t seq = INVALID_UINT64;
192     std::string info;
193     std::string content;
194 };
195 class HiSysEventAllEventData : public CacheBase {
196 public:
197     uint32_t AppendHiSysEventData(const HiSysEventAllEventDataRow &hiSysEventAllEventDataRow);
198     const std::deque<DataIndex> &DomainIds() const;
199     const std::deque<DataIndex> &EventNameIds() const;
200     const std::deque<uint32_t> &Types() const;
201     const std::deque<std::string> &TimeZones() const;
202     const std::deque<uint32_t> &Pids() const;
203     const std::deque<uint32_t> &Tids() const;
204     const std::deque<uint32_t> &Uids() const;
205     const std::deque<std::string> &Levels() const;
206     const std::deque<std::string> &Tags() const;
207     const std::deque<std::string> &EventIds() const;
208     const std::deque<uint64_t> &Seqs() const;
209     const std::deque<std::string> &Infos() const;
210     const std::deque<std::string> &Contents() const;
Clear()211     void Clear() override
212     {
213         CacheBase::Clear();
214         domainIds_.clear();
215         eventNameIds_.clear();
216         types_.clear();
217         timeZones_.clear();
218         pids_.clear();
219         tids_.clear();
220         uids_.clear();
221         levels_.clear();
222         tags_.clear();
223         eventIds_.clear();
224         seqs_.clear();
225         infos_.clear();
226         contents_.clear();
227     }
228 
229 private:
230     std::deque<DataIndex> domainIds_ = {};
231     std::deque<DataIndex> eventNameIds_ = {};
232     std::deque<uint32_t> types_ = {};
233     std::deque<std::string> timeZones_ = {};
234     std::deque<uint32_t> pids_ = {};
235     std::deque<uint32_t> tids_ = {};
236     std::deque<uint32_t> uids_ = {};
237     std::deque<std::string> levels_ = {};
238     std::deque<std::string> tags_ = {};
239     std::deque<std::string> eventIds_ = {};
240     std::deque<uint64_t> seqs_ = {};
241     std::deque<std::string> infos_ = {};
242     std::deque<std::string> contents_ = {};
243 };
244 } // namespace TraceStdtype
245 } // namespace SysTuning
246 #endif // HISYSEVENT_STDTYPE_H
247