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