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 #include "trace_stdtype.h"
17 #include <algorithm>
18 #include <ctime>
19 namespace SysTuning {
20 namespace TraceStdtype {
SetDur(uint64_t index,uint64_t dur)21 void CpuCacheBase::SetDur(uint64_t index, uint64_t dur)
22 {
23 durs_[index] = dur;
24 }
AppendThreadState(InternalTime ts,InternalTime dur,InternalCpu cpu,InternalTid itid,TableRowId idState)25 TableRowId ThreadState::AppendThreadState(InternalTime ts,
26 InternalTime dur,
27 InternalCpu cpu,
28 InternalTid itid,
29 TableRowId idState)
30 {
31 timeStamps_.emplace_back(ts);
32 durations_.emplace_back(dur);
33 itids_.emplace_back(itid);
34 tids_.emplace_back(INVALID_UINT32);
35 pids_.emplace_back(INVALID_UINT32);
36 states_.emplace_back(idState);
37 cpus_.emplace_back(cpu);
38 return itids_.size() - 1;
39 }
40
SetDuration(TableRowId index,InternalTime dur)41 void ThreadState::SetDuration(TableRowId index, InternalTime dur)
42 {
43 durations_[index] = dur;
44 }
45
Finish()46 void DataDict::Finish()
47 {
48 std::string::size_type pos(0);
49 for (auto i = 0; i < dataDict_.size(); i++) {
50 while ((pos = dataDict_[i].find("\"")) != std::string::npos) {
51 dataDict_[i].replace(pos, 1, "\'");
52 }
53 if (dataDict_[i].find("ispreproc") != std::string::npos) {
54 TS_LOGI("xx");
55 }
56 while (dataDict_[i].back() >= '\001' && dataDict_[i].back() <= '\007') {
57 dataDict_[i].pop_back();
58 }
59 }
60 }
UpdateDuration(TableRowId index,InternalTime ts)61 TableRowId ThreadState::UpdateDuration(TableRowId index, InternalTime ts)
62 {
63 if (durations_[index] == INVALID_TIME) {
64 durations_[index] = ts - timeStamps_[index];
65 }
66 return itids_[index];
67 }
68
UpdateState(TableRowId index,TableRowId idState)69 void ThreadState::UpdateState(TableRowId index, TableRowId idState)
70 {
71 states_[index] = idState;
72 }
73
UpdateDuration(TableRowId index,InternalTime ts,TableRowId idState)74 void ThreadState::UpdateDuration(TableRowId index, InternalTime ts, TableRowId idState)
75 {
76 durations_[index] = ts - timeStamps_[index];
77 states_[index] = idState;
78 }
79
UpdateTidAndPid(TableRowId index,InternalTid tid,InternalTid pid)80 void ThreadState::UpdateTidAndPid(TableRowId index, InternalTid tid, InternalTid pid)
81 {
82 tids_[index] = tid;
83 pids_[index] = pid;
84 }
85
UpdateDuration(TableRowId index,InternalTime ts,InternalCpu cpu,TableRowId idState)86 TableRowId ThreadState::UpdateDuration(TableRowId index, InternalTime ts, InternalCpu cpu, TableRowId idState)
87 {
88 cpus_[index] = cpu;
89 durations_[index] = ts - timeStamps_[index];
90 states_[index] = idState;
91 return itids_[index];
92 }
93
AppendSchedSlice(uint64_t ts,uint64_t dur,uint64_t cpu,uint64_t internalTid,uint64_t endState,uint64_t priority)94 size_t SchedSlice::AppendSchedSlice(uint64_t ts,
95 uint64_t dur,
96 uint64_t cpu,
97 uint64_t internalTid,
98 uint64_t endState,
99 uint64_t priority)
100 {
101 timeStamps_.emplace_back(ts);
102 durs_.emplace_back(dur);
103 cpus_.emplace_back(cpu);
104 tsEnds_.emplace_back(0);
105 internalTids_.emplace_back(internalTid);
106 endStates_.emplace_back(endState);
107 priority_.emplace_back(priority);
108 return Size() - 1;
109 }
110
SetDuration(size_t index,uint64_t duration)111 void SchedSlice::SetDuration(size_t index, uint64_t duration)
112 {
113 durs_[index] = duration;
114 tsEnds_[index] = timeStamps_[index] + duration;
115 }
116
Update(uint64_t index,uint64_t ts,uint64_t state,uint64_t pior)117 void SchedSlice::Update(uint64_t index, uint64_t ts, uint64_t state, uint64_t pior)
118 {
119 durs_[index] = ts - timeStamps_[index];
120 endStates_[index] = state;
121 priority_[index] = pior;
122 }
123
AppendInternalAsyncSlice(uint64_t startT,uint64_t durationNs,InternalTid internalTid,DataIndex cat,uint16_t nameIdentify,DataIndex name,uint8_t depth,uint64_t cookid,const std::optional<uint64_t> & parentId)124 size_t CallStack::AppendInternalAsyncSlice(uint64_t startT,
125 uint64_t durationNs,
126 InternalTid internalTid,
127 DataIndex cat,
128 uint16_t nameIdentify,
129 DataIndex name,
130 uint8_t depth,
131 uint64_t cookid,
132 const std::optional<uint64_t>& parentId)
133 {
134 AppendCommonInfo(startT, durationNs, internalTid);
135 AppendCallStack(cat, name, depth, parentId);
136 AppendDistributeInfo();
137 cookies_.emplace_back(cookid);
138 ids_.emplace_back(ids_.size());
139 identifys_.emplace_back(nameIdentify + depth);
140 return Size() - 1;
141 }
AppendInternalSlice(uint64_t startT,uint64_t durationNs,InternalTid internalTid,DataIndex cat,uint16_t nameIdentify,DataIndex name,uint8_t depth,const std::optional<uint64_t> & parentId)142 size_t CallStack::AppendInternalSlice(uint64_t startT,
143 uint64_t durationNs,
144 InternalTid internalTid,
145 DataIndex cat,
146 uint16_t nameIdentify,
147 DataIndex name,
148 uint8_t depth,
149 const std::optional<uint64_t>& parentId)
150 {
151 AppendCommonInfo(startT, durationNs, internalTid);
152 AppendCallStack(cat, name, depth, parentId);
153 identifys_.emplace_back(nameIdentify + depth);
154 ids_.emplace_back(ids_.size());
155 cookies_.emplace_back(INVALID_UINT64);
156 AppendDistributeInfo();
157 return Size() - 1;
158 }
159
AppendCommonInfo(uint64_t startT,uint64_t durationNs,InternalTid internalTid)160 void CallStack::AppendCommonInfo(uint64_t startT, uint64_t durationNs, InternalTid internalTid)
161 {
162 timeStamps_.emplace_back(startT);
163 durs_.emplace_back(durationNs);
164 callIds_.emplace_back(internalTid);
165 }
AppendCallStack(DataIndex cat,DataIndex name,uint8_t depth,std::optional<uint64_t> parentId)166 void CallStack::AppendCallStack(DataIndex cat, DataIndex name, uint8_t depth, std::optional<uint64_t> parentId)
167 {
168 parentIds_.emplace_back(parentId);
169 cats_.emplace_back(cat);
170 names_.emplace_back(name);
171 depths_.emplace_back(depth);
172 }
SetDistributeInfo(size_t index,const std::string & chainId,const std::string & spanId,const std::string & parentSpanId,const std::string & flag,const std::string & args)173 void CallStack::SetDistributeInfo(size_t index,
174 const std::string& chainId,
175 const std::string& spanId,
176 const std::string& parentSpanId,
177 const std::string& flag,
178 const std::string& args)
179 {
180 chainIds_[index] = chainId;
181 spanIds_[index] = spanId;
182 parentSpanIds_[index] = parentSpanId;
183 flags_[index] = flag;
184 args_[index] = args;
185 argSet_[index] = INVALID_UINT32;
186 }
AppendDistributeInfo(const std::string & chainId,const std::string & spanId,const std::string & parentSpanId,const std::string & flag,const std::string & args)187 void CallStack::AppendDistributeInfo(const std::string& chainId,
188 const std::string& spanId,
189 const std::string& parentSpanId,
190 const std::string& flag,
191 const std::string& args)
192 {
193 chainIds_.emplace_back(chainId);
194 spanIds_.emplace_back(spanId);
195 parentSpanIds_.emplace_back(parentSpanId);
196 flags_.emplace_back(flag);
197 args_.emplace_back(args);
198 argSet_.emplace_back(INVALID_UINT32);
199 }
AppendDistributeInfo()200 void CallStack::AppendDistributeInfo()
201 {
202 chainIds_.emplace_back("");
203 spanIds_.emplace_back("");
204 parentSpanIds_.emplace_back("");
205 flags_.emplace_back("");
206 args_.emplace_back("");
207 argSet_.emplace_back(INVALID_UINT32);
208 }
SetDuration(size_t index,uint64_t timestamp)209 void CallStack::SetDuration(size_t index, uint64_t timestamp)
210 {
211 durs_[index] = timestamp - timeStamps_[index];
212 }
213
SetIrqDurAndArg(size_t index,uint64_t timestamp,uint32_t argSetId)214 void CallStack::SetIrqDurAndArg(size_t index, uint64_t timestamp, uint32_t argSetId)
215 {
216 SetTimeStamp(index, timestamp);
217 argSet_[index] = argSetId;
218 }
SetTimeStamp(size_t index,uint64_t timestamp)219 void CallStack::SetTimeStamp(size_t index, uint64_t timestamp)
220 {
221 timeStamps_[index] = timestamp;
222 }
223
SetDepth(size_t index,uint8_t depth)224 void CallStack::SetDepth(size_t index, uint8_t depth)
225 {
226 depths_[index] = depth;
227 }
SetArgSetId(size_t index,uint32_t argSetId)228 void CallStack::SetArgSetId(size_t index, uint32_t argSetId)
229 {
230 argSet_[index] = argSetId;
231 }
ParentIdData() const232 const std::deque<std::optional<uint64_t>>& CallStack::ParentIdData() const
233 {
234 return parentIds_;
235 }
CatsData() const236 const std::deque<DataIndex>& CallStack::CatsData() const
237 {
238 return cats_;
239 }
IdentifysData() const240 const std::deque<uint16_t>& CallStack::IdentifysData() const
241 {
242 return identifys_;
243 }
NamesData() const244 const std::deque<DataIndex>& CallStack::NamesData() const
245 {
246 return names_;
247 }
Depths() const248 const std::deque<uint8_t>& CallStack::Depths() const
249 {
250 return depths_;
251 }
Cookies() const252 const std::deque<uint64_t>& CallStack::Cookies() const
253 {
254 return cookies_;
255 }
CallIds() const256 const std::deque<uint32_t>& CallStack::CallIds() const
257 {
258 return callIds_;
259 }
ChainIds() const260 const std::deque<std::string>& CallStack::ChainIds() const
261 {
262 return chainIds_;
263 }
SpanIds() const264 const std::deque<std::string>& CallStack::SpanIds() const
265 {
266 return spanIds_;
267 }
ParentSpanIds() const268 const std::deque<std::string>& CallStack::ParentSpanIds() const
269 {
270 return parentSpanIds_;
271 }
Flags() const272 const std::deque<std::string>& CallStack::Flags() const
273 {
274 return flags_;
275 }
ArgsData() const276 const std::deque<std::string>& CallStack::ArgsData() const
277 {
278 return args_;
279 }
ArgSetIdsData() const280 const std::deque<uint32_t>& CallStack::ArgSetIdsData() const
281 {
282 return argSet_;
283 }
284
AppendNewArg(DataIndex nameId,BaseDataType dataType,int64_t value,size_t argSet)285 size_t ArgSet::AppendNewArg(DataIndex nameId, BaseDataType dataType, int64_t value, size_t argSet)
286 {
287 dataTypes_.emplace_back(dataType);
288 argset_.emplace_back(argSet);
289 ids_.emplace_back(Size());
290 values_.emplace_back(value);
291 names_.emplace_back(nameId);
292 return Size() - 1;
293 }
DataTypes() const294 const std::deque<BaseDataType>& ArgSet::DataTypes() const
295 {
296 return dataTypes_;
297 }
ValuesData() const298 const std::deque<int64_t>& ArgSet::ValuesData() const
299 {
300 return values_;
301 }
ArgsData() const302 const std::deque<uint64_t>& ArgSet::ArgsData() const
303 {
304 return argset_;
305 }
NamesData() const306 const std::deque<DataIndex>& ArgSet::NamesData() const
307 {
308 return names_;
309 }
310
AppendNewFilter(uint64_t filterId,DataIndex type,DataIndex nameId)311 size_t SysMeasureFilter::AppendNewFilter(uint64_t filterId, DataIndex type, DataIndex nameId)
312 {
313 ids_.emplace_back(filterId);
314 names_.emplace_back(nameId);
315 types_.emplace_back(type);
316 return ids_.size() - 1;
317 }
NamesData() const318 const std::deque<DataIndex>& SysMeasureFilter::NamesData() const
319 {
320 return names_;
321 }
322
TypesData() const323 const std::deque<DataIndex>& SysMeasureFilter::TypesData() const
324 {
325 return types_;
326 }
AppendNewDataType(BaseDataType dataType,DataIndex dataDescIndex)327 size_t DataType::AppendNewDataType(BaseDataType dataType, DataIndex dataDescIndex)
328 {
329 ids_.emplace_back(Size());
330 dataTypes_.emplace_back(dataType);
331 descs_.emplace_back(dataDescIndex);
332 return Size() - 1;
333 }
334
DataTypes() const335 const std::deque<BaseDataType>& DataType::DataTypes() const
336 {
337 return dataTypes_;
338 }
DataDesc() const339 const std::deque<DataIndex>& DataType::DataDesc() const
340 {
341 return descs_;
342 }
AppendNewFilterData(std::string type,std::string name,uint64_t sourceArgSetId)343 size_t Filter::AppendNewFilterData(std::string type, std::string name, uint64_t sourceArgSetId)
344 {
345 nameDeque_.emplace_back(name);
346 sourceArgSetId_.emplace_back(sourceArgSetId);
347 ids_.emplace_back(Size());
348 typeDeque_.emplace_back(type);
349 return Size() - 1;
350 }
351
AppendMeasureData(uint32_t type,uint64_t timestamp,int64_t value,uint32_t filterId)352 size_t Measure::AppendMeasureData(uint32_t type, uint64_t timestamp, int64_t value, uint32_t filterId)
353 {
354 valuesDeque_.emplace_back(value);
355 filterIdDeque_.emplace_back(filterId);
356 typeDeque_.emplace_back(type);
357 timeStamps_.emplace_back(timestamp);
358 return Size() - 1;
359 }
360
AppendRawData(uint32_t id,uint64_t timestamp,uint32_t name,uint32_t cpu,uint32_t internalTid)361 size_t Raw::AppendRawData(uint32_t id, uint64_t timestamp, uint32_t name, uint32_t cpu, uint32_t internalTid)
362 {
363 ids_.emplace_back(id);
364 timeStamps_.emplace_back(timestamp);
365 nameDeque_.emplace_back(name);
366 cpuDeque_.emplace_back(cpu);
367 itidDeque_.emplace_back(internalTid);
368 return Size() - 1;
369 }
370
AppendNewFilter(uint64_t filterId,uint32_t nameIndex,uint64_t internalTid)371 size_t ThreadMeasureFilter::AppendNewFilter(uint64_t filterId, uint32_t nameIndex, uint64_t internalTid)
372 {
373 filterId_.emplace_back(filterId);
374 nameIndex_.emplace_back(nameIndex);
375 internalTids_.emplace_back(internalTid);
376 return Size() - 1;
377 }
378
AppendInstantEventData(uint64_t timestamp,DataIndex nameIndex,int64_t internalTid,int64_t wakeupFromInternalPid)379 size_t Instants::AppendInstantEventData(uint64_t timestamp,
380 DataIndex nameIndex,
381 int64_t internalTid,
382 int64_t wakeupFromInternalPid)
383 {
384 internalTids_.emplace_back(internalTid);
385 timeStamps_.emplace_back(timestamp);
386 NameIndexs_.emplace_back(nameIndex);
387 wakeupFromInternalPids_.emplace_back(wakeupFromInternalPid);
388 return Size() - 1;
389 }
AppendNewLogInfo(uint64_t seq,uint64_t timestamp,uint32_t pid,uint32_t tid,DataIndex level,DataIndex tag,DataIndex context,uint64_t originTs)390 size_t LogInfo::AppendNewLogInfo(uint64_t seq,
391 uint64_t timestamp,
392 uint32_t pid,
393 uint32_t tid,
394 DataIndex level,
395 DataIndex tag,
396 DataIndex context,
397 uint64_t originTs)
398 {
399 hilogLineSeqs_.emplace_back(seq);
400 timeStamps_.emplace_back(timestamp);
401 pids_.emplace_back(pid);
402 tids_.emplace_back(tid);
403 levels_.emplace_back(level);
404 tags_.emplace_back(tag);
405 contexts_.emplace_back(context);
406 originTs_.emplace_back(originTs);
407 return Size() - 1;
408 }
HilogLineSeqs() const409 const std::deque<uint64_t>& LogInfo::HilogLineSeqs() const
410 {
411 return hilogLineSeqs_;
412 }
Pids() const413 const std::deque<uint32_t>& LogInfo::Pids() const
414 {
415 return pids_;
416 }
Tids() const417 const std::deque<uint32_t>& LogInfo::Tids() const
418 {
419 return tids_;
420 }
Levels() const421 const std::deque<DataIndex>& LogInfo::Levels() const
422 {
423 return levels_;
424 }
Tags() const425 const std::deque<DataIndex>& LogInfo::Tags() const
426 {
427 return tags_;
428 }
Contexts() const429 const std::deque<DataIndex>& LogInfo::Contexts() const
430 {
431 return contexts_;
432 }
OriginTimeStamData() const433 const std::deque<uint64_t>& LogInfo::OriginTimeStamData() const
434 {
435 return originTs_;
436 }
437
AppendNewNativeHookData(uint64_t callChainId,uint32_t ipid,uint32_t itid,std::string eventType,DataIndex subType,uint64_t timestamp,uint64_t endTimestamp,uint64_t duration,uint64_t addr,int64_t memSize,int64_t allMemSize)438 size_t NativeHook::AppendNewNativeHookData(uint64_t callChainId,
439 uint32_t ipid,
440 uint32_t itid,
441 std::string eventType,
442 DataIndex subType,
443 uint64_t timestamp,
444 uint64_t endTimestamp,
445 uint64_t duration,
446 uint64_t addr,
447 int64_t memSize,
448 int64_t allMemSize)
449 {
450 callChainIds_.emplace_back(callChainId);
451 ipids_.emplace_back(ipid);
452 itids_.emplace_back(itid);
453 eventTypes_.emplace_back(eventType);
454 subTypes_.emplace_back(subType);
455 timeStamps_.emplace_back(timestamp);
456 endTimestamps_.emplace_back(endTimestamp);
457 durations_.emplace_back(duration);
458 addrs_.emplace_back(addr);
459 memSizes_.emplace_back(memSize);
460 if (eventType == ALLOC_EVET || eventType == FREE_EVENT) {
461 countHeapSizes_ += allMemSize;
462 allMemSizes_.emplace_back(countHeapSizes_);
463 } else if (eventType == MMAP_EVENT || eventType == MUNMAP_EVENT) {
464 countMmapSizes_ += allMemSize;
465 allMemSizes_.emplace_back(countMmapSizes_);
466 }
467 currentSizeDurs_.emplace_back(0);
468 lastCallerPathIndexs_.emplace_back(INVALID_UINT64);
469 return Size() - 1;
470 }
UpdateHeapDuration(size_t row,uint64_t endTimestamp)471 void NativeHook::UpdateHeapDuration(size_t row, uint64_t endTimestamp)
472 {
473 endTimestamps_[row] = endTimestamp;
474 durations_[row] = endTimestamp - timeStamps_[row];
475 }
UpdateCurrentSizeDur(size_t row,uint64_t timeStamp)476 void NativeHook::UpdateCurrentSizeDur(size_t row, uint64_t timeStamp)
477 {
478 currentSizeDurs_[row] = timeStamp - timeStamps_[row];
479 }
UpdateMemMapSubType()480 void NativeHook::UpdateMemMapSubType()
481 {
482 if (addrToMmapTag_.Empty()) {
483 return;
484 }
485 for (auto i = 0; i < Size(); ++i) {
486 if (eventTypes_[i].compare(MMAP_EVENT) == 0) {
487 auto tagId = addrToMmapTag_.Find(addrs_[i], memSizes_[i]);
488 if (tagId != INVALID_UINT64) {
489 subTypes_[i] = tagId;
490 }
491 }
492 }
493 }
UpdateAddrToMemMapSubType(uint64_t addr,int64_t size,uint64_t tagId)494 void NativeHook::UpdateAddrToMemMapSubType(uint64_t addr, int64_t size, uint64_t tagId)
495 {
496 addrToMmapTag_.Insert(addr, size, tagId);
497 }
UpdateLastCallerPathIndexs(std::map<uint64_t,uint64_t> & callIdToLasLibId)498 void NativeHook::UpdateLastCallerPathIndexs(std::map<uint64_t, uint64_t>& callIdToLasLibId)
499 {
500 if (callIdToLasLibId.empty()) {
501 return;
502 }
503 for (auto i = 0; i < Size(); ++i) {
504 auto symbolIt = callIdToLasLibId.find(callChainIds_[i]);
505 if (symbolIt != callIdToLasLibId.end()) {
506 lastCallerPathIndexs_[i] = symbolIt->second;
507 } else {
508 lastCallerPathIndexs_[i] = INVALID_UINT64;
509 }
510 }
511 }
CallChainIds() const512 const std::deque<uint64_t>& NativeHook::CallChainIds() const
513 {
514 return callChainIds_;
515 }
Ipids() const516 const std::deque<uint32_t>& NativeHook::Ipids() const
517 {
518 return ipids_;
519 }
Itids() const520 const std::deque<uint32_t>& NativeHook::Itids() const
521 {
522 return itids_;
523 }
EventTypes() const524 const std::deque<std::string>& NativeHook::EventTypes() const
525 {
526 return eventTypes_;
527 }
SubTypes() const528 const std::deque<DataIndex>& NativeHook::SubTypes() const
529 {
530 return subTypes_;
531 }
EndTimeStamps() const532 const std::deque<uint64_t>& NativeHook::EndTimeStamps() const
533 {
534 return endTimestamps_;
535 }
Durations() const536 const std::deque<uint64_t>& NativeHook::Durations() const
537 {
538 return durations_;
539 }
Addrs() const540 const std::deque<uint64_t>& NativeHook::Addrs() const
541 {
542 return addrs_;
543 }
MemSizes() const544 const std::deque<int64_t>& NativeHook::MemSizes() const
545 {
546 return memSizes_;
547 }
AllMemSizes() const548 const std::deque<int64_t>& NativeHook::AllMemSizes() const
549 {
550 return allMemSizes_;
551 }
CurrentSizeDurs() const552 const std::deque<uint64_t>& NativeHook::CurrentSizeDurs() const
553 {
554 return currentSizeDurs_;
555 }
LastCallerPathIndexs() const556 const std::deque<uint64_t>& NativeHook::LastCallerPathIndexs() const
557 {
558 return lastCallerPathIndexs_;
559 }
AppendNewNativeHookFrame(uint64_t callChainId,uint64_t depth,uint64_t ip,uint64_t sp,DataIndex symbolName,DataIndex filePath,uint64_t offset,uint64_t symbolOffset)560 size_t NativeHookFrame::AppendNewNativeHookFrame(uint64_t callChainId,
561 uint64_t depth,
562 uint64_t ip,
563 uint64_t sp,
564 DataIndex symbolName,
565 DataIndex filePath,
566 uint64_t offset,
567 uint64_t symbolOffset)
568 {
569 callChainIds_.emplace_back(callChainId);
570 ips_.emplace_back(ip);
571 sps_.emplace_back(sp);
572 depths_.emplace_back(depth);
573 symbolNames_.emplace_back(symbolName);
574 filePaths_.emplace_back(filePath);
575 offsets_.emplace_back(offset);
576 symbolOffsets_.emplace_back(symbolOffset);
577 return Size() - 1;
578 }
UpdateSymbolIdToNameMap(uint64_t originSymbolId,uint64_t symbolId)579 void NativeHookFrame::UpdateSymbolIdToNameMap(uint64_t originSymbolId, uint64_t symbolId)
580 {
581 symbolIdToSymbolName_.insert(std::make_pair(originSymbolId, symbolId));
582 }
583
UpdateSymbolId()584 void NativeHookFrame::UpdateSymbolId()
585 {
586 if (symbolIdToSymbolName_.empty()) {
587 return;
588 }
589 for (auto i = 0; i < Size(); ++i) {
590 auto symbolIt = symbolIdToSymbolName_.find(symbolNames_[i]);
591 if (symbolIt != symbolIdToSymbolName_.end()) {
592 symbolNames_[i] = symbolIt->second;
593 }
594 }
595 }
UpdateFileId(std::map<uint32_t,uint64_t> & filePathIdToFilePathName)596 void NativeHookFrame::UpdateFileId(std::map<uint32_t, uint64_t>& filePathIdToFilePathName)
597 {
598 if (filePathIdToFilePathName.empty()) {
599 return;
600 }
601 for (auto i = 0; i < Size(); ++i) {
602 auto symbolIt = filePathIdToFilePathName.find(filePaths_[i]);
603 if (symbolIt != filePathIdToFilePathName.end()) {
604 filePaths_[i] = symbolIt->second;
605 }
606 }
607 }
GetCallIdToLastLibId(const std::set<DataIndex> & invalidLibs,std::map<uint64_t,uint64_t> & callIdToLastCallerPathIndex)608 void NativeHookFrame::GetCallIdToLastLibId(const std::set<DataIndex>& invalidLibs,
609 std::map<uint64_t, uint64_t>& callIdToLastCallerPathIndex)
610 {
611 uint64_t lastLibId = INVALID_UINT64;
612 auto size = static_cast<int64_t>(Size());
613 uint32_t lastCallChainId = INVALID_UINT32;
614 bool foundLast = false;
615 for (auto i = size - 1; i > -1; i--) {
616 auto callChainId = callChainIds_[i];
617 if (callChainId == lastCallChainId) {
618 if (foundLast) {
619 continue;
620 }
621 }
622 if (callChainId != lastCallChainId) {
623 lastCallChainId = callChainId;
624 foundLast = false;
625 }
626 auto lower = std::lower_bound(invalidLibs.begin(), invalidLibs.end(), filePaths_[i]);
627 if (lower == invalidLibs.end() || *lower != filePaths_[i]) { // found
628 callIdToLastCallerPathIndex.insert(std::make_pair(callChainIds_[i], filePaths_[i]));
629 foundLast = true;
630 }
631 }
632 }
CallChainIds() const633 const std::deque<uint64_t>& NativeHookFrame::CallChainIds() const
634 {
635 return callChainIds_;
636 }
Depths() const637 const std::deque<uint64_t>& NativeHookFrame::Depths() const
638 {
639 return depths_;
640 }
Ips() const641 const std::deque<uint64_t>& NativeHookFrame::Ips() const
642 {
643 return ips_;
644 }
Sps() const645 const std::deque<uint64_t>& NativeHookFrame::Sps() const
646 {
647 return sps_;
648 }
SymbolNames() const649 const std::deque<DataIndex>& NativeHookFrame::SymbolNames() const
650 {
651 return symbolNames_;
652 }
FilePaths() const653 const std::deque<DataIndex>& NativeHookFrame::FilePaths() const
654 {
655 return filePaths_;
656 }
Offsets() const657 const std::deque<uint64_t>& NativeHookFrame::Offsets() const
658 {
659 return offsets_;
660 }
SymbolOffsets() const661 const std::deque<uint64_t>& NativeHookFrame::SymbolOffsets() const
662 {
663 return symbolOffsets_;
664 }
665
AppendNewHidumpInfo(uint64_t timestamp,uint32_t fps)666 size_t Hidump::AppendNewHidumpInfo(uint64_t timestamp, uint32_t fps)
667 {
668 timeStamps_.emplace_back(timestamp);
669 fpss_.emplace_back(fps);
670 return Size() - 1;
671 }
Fpss() const672 const std::deque<uint32_t>& Hidump::Fpss() const
673 {
674 return fpss_;
675 }
676
AppendNewPerfCallChain(uint64_t sampleId,uint64_t callChainId,uint64_t vaddrInFile,uint64_t fileId,uint64_t symbolId)677 size_t PerfCallChain::AppendNewPerfCallChain(uint64_t sampleId,
678 uint64_t callChainId,
679 uint64_t vaddrInFile,
680 uint64_t fileId,
681 uint64_t symbolId)
682 {
683 ids_.emplace_back(Size());
684 sampleIds_.emplace_back(sampleId);
685 callChainIds_.emplace_back(callChainId);
686 vaddrInFiles_.emplace_back(vaddrInFile);
687 fileIds_.emplace_back(fileId);
688 symbolIds_.emplace_back(symbolId);
689 names_.emplace_back("");
690 return Size() - 1;
691 }
SampleIds() const692 const std::deque<uint64_t>& PerfCallChain::SampleIds() const
693 {
694 return sampleIds_;
695 }
CallChainIds() const696 const std::deque<uint64_t>& PerfCallChain::CallChainIds() const
697 {
698 return callChainIds_;
699 }
VaddrInFiles() const700 const std::deque<uint64_t>& PerfCallChain::VaddrInFiles() const
701 {
702 return vaddrInFiles_;
703 }
FileIds() const704 const std::deque<uint64_t>& PerfCallChain::FileIds() const
705 {
706 return fileIds_;
707 }
SymbolIds() const708 const std::deque<uint64_t>& PerfCallChain::SymbolIds() const
709 {
710 return symbolIds_;
711 }
712
Names() const713 const std::deque<std::string>& PerfCallChain::Names() const
714 {
715 return names_;
716 }
SetName(uint64_t index,const std::string & name)717 void PerfCallChain::SetName(uint64_t index, const std::string& name)
718 {
719 names_[index] = name;
720 }
AppendNewPerfFiles(uint64_t fileIds,uint32_t serial,DataIndex symbols,DataIndex filePath)721 size_t PerfFiles::AppendNewPerfFiles(uint64_t fileIds, uint32_t serial, DataIndex symbols, DataIndex filePath)
722 {
723 ids_.emplace_back(Size());
724 fileIds_.emplace_back(fileIds);
725 serials_.emplace_back(serial);
726 symbols_.emplace_back(symbols);
727 filePaths_.emplace_back(filePath);
728 return Size() - 1;
729 }
FileIds() const730 const std::deque<uint64_t>& PerfFiles::FileIds() const
731 {
732 return fileIds_;
733 }
734
Serials() const735 const std::deque<uint32_t>& PerfFiles::Serials() const
736 {
737 return serials_;
738 }
Symbols() const739 const std::deque<DataIndex>& PerfFiles::Symbols() const
740 {
741 return symbols_;
742 }
FilePaths() const743 const std::deque<DataIndex>& PerfFiles::FilePaths() const
744 {
745 return filePaths_;
746 }
747
AppendNewPerfSample(uint64_t sampleId,uint64_t timestamp,uint64_t tid,uint64_t eventCount,uint64_t eventTypeId,uint64_t timestampTrace,uint64_t cpuId,uint64_t threadState)748 size_t PerfSample::AppendNewPerfSample(uint64_t sampleId,
749 uint64_t timestamp,
750 uint64_t tid,
751 uint64_t eventCount,
752 uint64_t eventTypeId,
753 uint64_t timestampTrace,
754 uint64_t cpuId,
755 uint64_t threadState)
756 {
757 ids_.emplace_back(Size());
758 sampleIds_.emplace_back(sampleId);
759 timeStamps_.emplace_back(timestamp);
760 tids_.emplace_back(tid);
761 eventCounts_.emplace_back(eventCount);
762 eventTypeIds_.emplace_back(eventTypeId);
763 timestampTraces_.emplace_back(timestampTrace);
764 cpuIds_.emplace_back(cpuId);
765 threadStates_.emplace_back(threadState);
766 return Size() - 1;
767 }
SampleIds() const768 const std::deque<uint64_t>& PerfSample::SampleIds() const
769 {
770 return sampleIds_;
771 }
Tids() const772 const std::deque<uint64_t>& PerfSample::Tids() const
773 {
774 return tids_;
775 }
EventCounts() const776 const std::deque<uint64_t>& PerfSample::EventCounts() const
777 {
778 return eventCounts_;
779 }
EventTypeIds() const780 const std::deque<uint64_t>& PerfSample::EventTypeIds() const
781 {
782 return eventTypeIds_;
783 }
TimestampTraces() const784 const std::deque<uint64_t>& PerfSample::TimestampTraces() const
785 {
786 return timestampTraces_;
787 }
CpuIds() const788 const std::deque<uint64_t>& PerfSample::CpuIds() const
789 {
790 return cpuIds_;
791 }
ThreadStates() const792 const std::deque<DataIndex>& PerfSample::ThreadStates() const
793 {
794 return threadStates_;
795 }
796
AppendNewPerfThread(uint64_t pid,uint64_t tid,DataIndex threadName)797 size_t PerfThread::AppendNewPerfThread(uint64_t pid, uint64_t tid, DataIndex threadName)
798 {
799 ids_.emplace_back(Size());
800 pids_.emplace_back(pid);
801 tids_.emplace_back(tid);
802 threadNames_.emplace_back(threadName);
803 return Size() - 1;
804 }
Pids() const805 const std::deque<uint64_t>& PerfThread::Pids() const
806 {
807 return pids_;
808 }
Tids() const809 const std::deque<uint64_t>& PerfThread::Tids() const
810 {
811 return tids_;
812 }
ThreadNames() const813 const std::deque<DataIndex>& PerfThread::ThreadNames() const
814 {
815 return threadNames_;
816 }
AppendNewPerfReport(DataIndex type,DataIndex value)817 size_t PerfReport::AppendNewPerfReport(DataIndex type, DataIndex value)
818 {
819 ids_.emplace_back(Size());
820 types_.emplace_back(type);
821 values_.emplace_back(value);
822 return Size() - 1;
823 }
Types() const824 const std::deque<DataIndex>& PerfReport::Types() const
825 {
826 return types_;
827 }
Values() const828 const std::deque<DataIndex>& PerfReport::Values() const
829 {
830 return values_;
831 }
AppendNewFilter(uint64_t id,DataIndex name,uint32_t internalPid)832 size_t ProcessMeasureFilter::AppendNewFilter(uint64_t id, DataIndex name, uint32_t internalPid)
833 {
834 internalPids_.emplace_back(internalPid);
835 ids_.emplace_back(id);
836 names_.emplace_back(name);
837 return Size() - 1;
838 }
AppendNewFilter(uint64_t id,DataIndex type,DataIndex name,uint64_t cpu)839 size_t ClockEventData::AppendNewFilter(uint64_t id, DataIndex type, DataIndex name, uint64_t cpu)
840 {
841 cpus_.emplace_back(cpu);
842 ids_.emplace_back(id);
843 types_.emplace_back(type);
844 names_.emplace_back(name);
845 return Size() - 1;
846 }
AppendNewFilter(uint64_t id,uint64_t rate,DataIndex name,uint64_t cpu)847 size_t ClkEventData::AppendNewFilter(uint64_t id, uint64_t rate, DataIndex name, uint64_t cpu)
848 {
849 ids_.emplace_back(id);
850 rates_.emplace_back(rate);
851 names_.emplace_back(name);
852 cpus_.emplace_back(cpu);
853 return Size() - 1;
854 }
AppendSysCallData(int64_t sysCallNum,DataIndex type,uint64_t ipid,uint64_t timestamp,int64_t ret)855 size_t SysCall::AppendSysCallData(int64_t sysCallNum, DataIndex type, uint64_t ipid, uint64_t timestamp, int64_t ret)
856 {
857 sysCallNums_.emplace_back(sysCallNum);
858 types_.emplace_back(type);
859 ipids_.emplace_back(ipid);
860 timeStamps_.emplace_back(timestamp);
861 rets_.emplace_back(ret);
862 return Size() - 1;
863 }
StatAndInfo()864 StatAndInfo::StatAndInfo()
865 {
866 // sched_switch_received | sched_switch_not_match | sched_switch_not_not_supported etc.
867 for (int i = TRACE_EVENT_START; i < TRACE_EVENT_MAX; i++) {
868 event_[i] = config_.eventNameMap_.at(static_cast<SupportedTraceEventType>(i));
869 }
870 for (int j = STAT_EVENT_START; j < STAT_EVENT_MAX; j++) {
871 stat_[j] = config_.eventErrorDescMap_.at(static_cast<StatType>(j));
872 }
873
874 for (int i = TRACE_EVENT_START; i < TRACE_EVENT_MAX; i++) {
875 for (int j = STAT_EVENT_START; j < STAT_EVENT_MAX; j++) {
876 statSeverity_[i][j] = config_.eventParserStatSeverityDescMap_.at(static_cast<SupportedTraceEventType>(i))
877 .at(static_cast<StatType>(j));
878 }
879 }
880
881 for (int i = TRACE_EVENT_START; i < TRACE_EVENT_MAX; i++) {
882 for (int j = STAT_EVENT_START; j < STAT_EVENT_MAX; j++) {
883 statSeverityDesc_[i][j] = config_.serverityLevelDescMap_.at(statSeverity_[i][j]);
884 }
885 }
886
887 for (int i = TRACE_EVENT_START; i < TRACE_EVENT_MAX; i++) {
888 for (int j = STAT_EVENT_START; j < STAT_EVENT_MAX; j++) {
889 statCount_[i][j] = 0;
890 }
891 }
892 clockid2ClockNameMap_ = {
893 {TS_CLOCK_UNKNOW, "unknown"}, {TS_CLOCK_BOOTTIME, "boottime"},
894 {TS_CLOCK_REALTIME, "realtime"}, {TS_CLOCK_REALTIME_COARSE, "realtime_corse"},
895 {TS_MONOTONIC, "monotonic"}, {TS_MONOTONIC_COARSE, "monotonic-coarse"},
896 {TS_MONOTONIC_RAW, "monotonic-raw"},
897 };
898 }
IncreaseStat(SupportedTraceEventType eventType,StatType type)899 void StatAndInfo::IncreaseStat(SupportedTraceEventType eventType, StatType type)
900 {
901 statCount_[eventType][type]++;
902 }
GetValue(SupportedTraceEventType eventType,StatType type) const903 const uint32_t& StatAndInfo::GetValue(SupportedTraceEventType eventType, StatType type) const
904 {
905 return statCount_[eventType][type];
906 }
GetEvent(SupportedTraceEventType eventType) const907 const std::string& StatAndInfo::GetEvent(SupportedTraceEventType eventType) const
908 {
909 return event_[eventType];
910 }
GetStat(StatType type) const911 const std::string& StatAndInfo::GetStat(StatType type) const
912 {
913 return stat_[type];
914 }
GetSeverityDesc(SupportedTraceEventType eventType,StatType type) const915 const std::string& StatAndInfo::GetSeverityDesc(SupportedTraceEventType eventType, StatType type) const
916 {
917 return statSeverityDesc_[eventType][type];
918 }
GetSeverity(SupportedTraceEventType eventType,StatType type) const919 const StatSeverityLevel& StatAndInfo::GetSeverity(SupportedTraceEventType eventType, StatType type) const
920 {
921 return statSeverity_[eventType][type];
922 }
923
Size() const924 uint64_t SymbolsData::Size() const
925 {
926 return addrs_.size();
927 }
InsertSymbol(const DataIndex & name,const uint64_t & addr)928 void SymbolsData::InsertSymbol(const DataIndex& name, const uint64_t& addr)
929 {
930 addrs_.emplace_back(addr);
931 funcName_.emplace_back(name);
932 }
GetConstFuncNames() const933 const std::deque<DataIndex>& SymbolsData::GetConstFuncNames() const
934 {
935 return funcName_;
936 }
GetConstAddrs() const937 const std::deque<uint64_t>& SymbolsData::GetConstAddrs() const
938 {
939 return addrs_;
940 }
MetaData()941 MetaData::MetaData()
942 {
943 columnNames_.resize(METADATA_ITEM_MAX);
944 values_.resize(METADATA_ITEM_MAX);
945 columnNames_[METADATA_ITEM_DATASIZE] = METADATA_ITEM_DATASIZE_COLNAME;
946 columnNames_[METADATA_ITEM_PARSETOOL_NAME] = METADATA_ITEM_PARSETOOL_NAME_COLNAME;
947 columnNames_[METADATA_ITEM_PARSERTOOL_VERSION] = METADATA_ITEM_PARSERTOOL_VERSION_COLNAME;
948 columnNames_[METADATA_ITEM_PARSERTOOL_PUBLISH_DATETIME] = METADATA_ITEM_PARSERTOOL_PUBLISH_DATETIME_COLNAME;
949 columnNames_[METADATA_ITEM_SOURCE_FILENAME] = METADATA_ITEM_SOURCE_FILENAME_COLNAME;
950 columnNames_[METADATA_ITEM_OUTPUT_FILENAME] = METADATA_ITEM_OUTPUT_FILENAME_COLNAME;
951 columnNames_[METADATA_ITEM_PARSERTIME] = METADATA_ITEM_PARSERTIME_COLNAME;
952 columnNames_[METADATA_ITEM_TRACE_DURATION] = METADATA_ITEM_TRACE_DURATION_COLNAME;
953 columnNames_[METADATA_ITEM_SOURCE_DATETYPE] = METADATA_ITEM_SOURCE_DATETYPE_COLNAME;
954 values_[METADATA_ITEM_PARSETOOL_NAME] = "trace_streamer";
955 }
SetTraceType(const std::string & traceType)956 void MetaData::SetTraceType(const std::string& traceType)
957 {
958 values_[METADATA_ITEM_SOURCE_DATETYPE] = traceType;
959 }
SetSourceFileName(const std::string & fileName)960 void MetaData::SetSourceFileName(const std::string& fileName)
961 {
962 MetaData::values_[METADATA_ITEM_SOURCE_FILENAME] = fileName;
963 }
SetOutputFileName(const std::string & fileName)964 void MetaData::SetOutputFileName(const std::string& fileName)
965 {
966 MetaData::values_[METADATA_ITEM_OUTPUT_FILENAME] = fileName;
967 }
SetParserToolVersion(const std::string & version)968 void MetaData::SetParserToolVersion(const std::string& version)
969 {
970 values_[METADATA_ITEM_PARSERTOOL_VERSION] = version;
971 }
SetParserToolPublishDateTime(const std::string & datetime)972 void MetaData::SetParserToolPublishDateTime(const std::string& datetime)
973 {
974 values_[METADATA_ITEM_PARSERTOOL_PUBLISH_DATETIME] = datetime;
975 }
SetTraceDataSize(uint64_t dataSize)976 void MetaData::SetTraceDataSize(uint64_t dataSize)
977 {
978 std::stringstream ss;
979 ss << dataSize;
980 values_[METADATA_ITEM_DATASIZE] = ss.str();
981 // Function 'time' may return error. It is not allowed to do anything that might fail inside the constructor.
982 time_t rawtime;
983 struct tm* timeinfo = nullptr;
984 void(time(&rawtime));
985 timeinfo = localtime(&rawtime);
986 values_[METADATA_ITEM_PARSERTIME] = asctime(timeinfo);
987 // sometimes there will be a extra \n at last
988 values_[METADATA_ITEM_PARSERTIME].pop_back();
989 }
SetTraceDuration(uint64_t dur)990 void MetaData::SetTraceDuration(uint64_t dur)
991 {
992 values_[METADATA_ITEM_TRACE_DURATION] = std::to_string(dur) + " s";
993 }
Value(uint64_t row) const994 const std::string& MetaData::Value(uint64_t row) const
995 {
996 return values_[row];
997 }
Name(uint64_t row) const998 const std::string& MetaData::Name(uint64_t row) const
999 {
1000 return columnNames_[row];
1001 }
GetStringIndex(std::string_view str)1002 DataIndex DataDict::GetStringIndex(std::string_view str)
1003 {
1004 auto hashValue = hashFun(str);
1005 auto itor = dataDictInnerMap_.find(hashValue);
1006 if (itor != dataDictInnerMap_.end()) {
1007 return itor->second;
1008 }
1009 mutex_.lock();
1010 dataDict_.emplace_back(std::string(str));
1011 DataIndex stringIdentity = dataDict_.size() - 1;
1012 dataDictInnerMap_.emplace(hashValue, stringIdentity);
1013 mutex_.unlock();
1014 return stringIdentity;
1015 }
GetStringIndexNoWrite(std::string_view str) const1016 DataIndex DataDict::GetStringIndexNoWrite(std::string_view str) const
1017 {
1018 auto hashValue = hashFun(str);
1019 auto itor = dataDictInnerMap_.find(hashValue);
1020 if (itor != dataDictInnerMap_.end()) {
1021 return itor->second;
1022 }
1023 return INVALID_UINT64;
1024 }
AppendNewData(uint64_t newTimeStamp,uint64_t dur,double totalLoad,double userLoad,double systemLoad,int64_t threads)1025 size_t CpuUsageDetailData::AppendNewData(uint64_t newTimeStamp,
1026 uint64_t dur,
1027 double totalLoad,
1028 double userLoad,
1029 double systemLoad,
1030 int64_t threads)
1031 {
1032 timeStamps_.emplace_back(newTimeStamp);
1033 durs_.emplace_back(dur);
1034 totalLoad_.emplace_back(totalLoad);
1035 userLoad_.emplace_back(userLoad);
1036 systemLoad_.emplace_back(systemLoad);
1037 threads_.emplace_back(threads);
1038 return Size() - 1;
1039 }
Durs() const1040 const std::deque<uint64_t>& CpuUsageDetailData::Durs() const
1041 {
1042 return durs_;
1043 }
TotalLoad() const1044 const std::deque<double>& CpuUsageDetailData::TotalLoad() const
1045 {
1046 return totalLoad_;
1047 }
UserLoad() const1048 const std::deque<double>& CpuUsageDetailData::UserLoad() const
1049 {
1050 return userLoad_;
1051 }
SystemLoad() const1052 const std::deque<double>& CpuUsageDetailData::SystemLoad() const
1053 {
1054 return systemLoad_;
1055 }
Threads() const1056 const std::deque<int64_t>& CpuUsageDetailData::Threads() const
1057 {
1058 return threads_;
1059 }
AppendNewData(uint64_t newTimeStamp,uint64_t dur,int32_t processID,std::string processName,int32_t parentProcessID,int32_t uid,std::string userName,double cpuUsage,int32_t pssInfo,uint64_t cpuTime,int32_t threads,int64_t diskWrites,int64_t diskReads)1060 size_t LiveProcessDetailData::AppendNewData(uint64_t newTimeStamp,
1061 uint64_t dur,
1062 int32_t processID,
1063 std::string processName,
1064 int32_t parentProcessID,
1065 int32_t uid,
1066 std::string userName,
1067 double cpuUsage,
1068 int32_t pssInfo,
1069 uint64_t cpuTime,
1070 int32_t threads,
1071 int64_t diskWrites,
1072 int64_t diskReads)
1073 {
1074 timeStamps_.emplace_back(newTimeStamp);
1075 durs_.emplace_back(dur);
1076 processID_.emplace_back(processID);
1077 processName_.emplace_back(processName);
1078 parentProcessID_.emplace_back(parentProcessID);
1079 uid_.emplace_back(uid);
1080 userName_.emplace_back(userName);
1081 cpuUsage_.emplace_back(cpuUsage);
1082 pssInfo_.emplace_back(pssInfo);
1083 threads_.emplace_back(threads);
1084 diskWrites_.emplace_back(diskWrites);
1085 diskReads_.emplace_back(diskReads);
1086 cpuTimes_.emplace_back(cpuTime);
1087 return Size() - 1;
1088 }
Durs() const1089 const std::deque<uint64_t>& LiveProcessDetailData::Durs() const
1090 {
1091 return durs_;
1092 }
ProcessID() const1093 const std::deque<int32_t>& LiveProcessDetailData::ProcessID() const
1094 {
1095 return processID_;
1096 }
ProcessName() const1097 const std::deque<std::string>& LiveProcessDetailData::ProcessName() const
1098 {
1099 return processName_;
1100 }
ParentProcessID() const1101 const std::deque<int32_t>& LiveProcessDetailData::ParentProcessID() const
1102 {
1103 return parentProcessID_;
1104 }
Uid() const1105 const std::deque<int32_t>& LiveProcessDetailData::Uid() const
1106 {
1107 return uid_;
1108 }
UserName() const1109 const std::deque<std::string>& LiveProcessDetailData::UserName() const
1110 {
1111 return userName_;
1112 }
CpuUsage() const1113 const std::deque<double>& LiveProcessDetailData::CpuUsage() const
1114 {
1115 return cpuUsage_;
1116 }
PssInfo() const1117 const std::deque<int32_t>& LiveProcessDetailData::PssInfo() const
1118 {
1119 return pssInfo_;
1120 }
Threads() const1121 const std::deque<int32_t>& LiveProcessDetailData::Threads() const
1122 {
1123 return threads_;
1124 }
DiskWrites() const1125 const std::deque<int64_t>& LiveProcessDetailData::DiskWrites() const
1126 {
1127 return diskWrites_;
1128 }
DiskReads() const1129 const std::deque<int64_t>& LiveProcessDetailData::DiskReads() const
1130 {
1131 return diskReads_;
1132 }
1133
CpuTimes() const1134 const std::deque<uint64_t>& LiveProcessDetailData::CpuTimes() const
1135 {
1136 return cpuTimes_;
1137 }
1138
AppendNewNetData(uint64_t newTimeStamp,uint64_t tx,uint64_t rx,uint64_t dur,double rxSpeed,double txSpeed,uint64_t packetIn,double packetInSec,uint64_t packetOut,double packetOutSec,const std::string & netType)1139 size_t NetDetailData::AppendNewNetData(uint64_t newTimeStamp,
1140 uint64_t tx,
1141 uint64_t rx,
1142 uint64_t dur,
1143 double rxSpeed,
1144 double txSpeed,
1145 uint64_t packetIn,
1146 double packetInSec,
1147 uint64_t packetOut,
1148 double packetOutSec,
1149 const std::string& netType)
1150 {
1151 timeStamps_.emplace_back(newTimeStamp);
1152 txs_.emplace_back(tx);
1153 rxs_.emplace_back(rx);
1154 durs_.emplace_back(dur);
1155 txSpeeds_.emplace_back(txSpeed);
1156 rxSpeeds_.emplace_back(rxSpeed);
1157 netTypes_.emplace_back(netType);
1158 packetIn_.emplace_back(packetIn);
1159 packetInSec_.emplace_back(packetInSec);
1160 packetOut_.emplace_back(packetOut);
1161 packetOutSec_.emplace_back(packetOutSec);
1162
1163 return Size() - 1;
1164 }
Durs() const1165 const std::deque<uint64_t>& NetDetailData::Durs() const
1166 {
1167 return durs_;
1168 }
RxSpeed() const1169 const std::deque<double>& NetDetailData::RxSpeed() const
1170 {
1171 return rxSpeeds_;
1172 }
TxSpeed() const1173 const std::deque<double>& NetDetailData::TxSpeed() const
1174 {
1175 return txSpeeds_;
1176 }
NetTypes() const1177 const std::deque<std::string>& NetDetailData::NetTypes() const
1178 {
1179 return netTypes_;
1180 }
RxDatas() const1181 const std::deque<uint64_t>& NetDetailData::RxDatas() const
1182 {
1183 return rxs_;
1184 }
TxDatas() const1185 const std::deque<uint64_t>& NetDetailData::TxDatas() const
1186 {
1187 return txs_;
1188 }
PacketIn() const1189 const std::deque<uint64_t>& NetDetailData::PacketIn() const
1190 {
1191 return packetIn_;
1192 }
PacketInSec() const1193 const std::deque<double>& NetDetailData::PacketInSec() const
1194 {
1195 return packetInSec_;
1196 }
PacketOut() const1197 const std::deque<uint64_t>& NetDetailData::PacketOut() const
1198 {
1199 return packetOut_;
1200 }
PacketOutSec() const1201 const std::deque<double>& NetDetailData::PacketOutSec() const
1202 {
1203 return packetOutSec_;
1204 }
1205
AppendNewData(uint64_t ts,uint64_t dur,uint64_t rd,uint64_t wr,uint64_t rdPerSec,uint64_t wrPerSec,double rdCountPerSec,double wrCountPerSec,uint64_t rdCount,uint64_t wrCount)1206 void DiskIOData::AppendNewData(uint64_t ts,
1207 uint64_t dur,
1208 uint64_t rd,
1209 uint64_t wr,
1210 uint64_t rdPerSec,
1211 uint64_t wrPerSec,
1212 double rdCountPerSec,
1213 double wrCountPerSec,
1214 uint64_t rdCount,
1215 uint64_t wrCount)
1216 {
1217 timeStamps_.emplace_back(ts);
1218 durs_.emplace_back(dur);
1219 rdDatas_.emplace_back(rd);
1220 wrDatas_.emplace_back(wr);
1221 rdPerSec_.emplace_back(rdPerSec);
1222 wrPerSec_.emplace_back(wrPerSec);
1223 rdCountPerSec_.emplace_back(rdCountPerSec);
1224 wrCountPerSec_.emplace_back(wrCountPerSec);
1225 rdCountDatas_.emplace_back(rdCount);
1226 wrCountDatas_.emplace_back(wrCount);
1227 }
Durs() const1228 const std::deque<uint64_t>& DiskIOData::Durs() const
1229 {
1230 return durs_;
1231 }
RdDatas() const1232 const std::deque<uint64_t>& DiskIOData::RdDatas() const
1233 {
1234 return rdDatas_;
1235 }
WrDatas() const1236 const std::deque<uint64_t>& DiskIOData::WrDatas() const
1237 {
1238 return wrDatas_;
1239 }
RdSpeedDatas() const1240 const std::deque<double>& DiskIOData::RdSpeedDatas() const
1241 {
1242 return rdPerSec_;
1243 }
WrSpeedDatas() const1244 const std::deque<double>& DiskIOData::WrSpeedDatas() const
1245 {
1246 return wrPerSec_;
1247 }
1248
RdCountPerSecDatas() const1249 const std::deque<double>& DiskIOData::RdCountPerSecDatas() const
1250 {
1251 return rdCountPerSec_;
1252 }
WrCountPerSecDatas() const1253 const std::deque<double>& DiskIOData::WrCountPerSecDatas() const
1254 {
1255 return wrCountPerSec_;
1256 }
RdCountDatas() const1257 const std::deque<uint64_t>& DiskIOData::RdCountDatas() const
1258 {
1259 return rdCountDatas_;
1260 }
WrCountDatas() const1261 const std::deque<uint64_t>& DiskIOData::WrCountDatas() const
1262 {
1263 return wrCountDatas_;
1264 }
1265
AppendNewData(uint64_t callChainId,uint16_t type,uint32_t ipid,uint32_t itid,uint64_t startTs,uint64_t endTs,uint64_t dur,DataIndex returnValue,DataIndex errorCode,size_t size,int32_t fd,DataIndex fileId,DataIndex firstArgument,DataIndex secondArgument,DataIndex thirdArgument,DataIndex fourthArgument)1266 size_t FileSystemSample::AppendNewData(uint64_t callChainId,
1267 uint16_t type,
1268 uint32_t ipid,
1269 uint32_t itid,
1270 uint64_t startTs,
1271 uint64_t endTs,
1272 uint64_t dur,
1273 DataIndex returnValue,
1274 DataIndex errorCode,
1275 size_t size,
1276 int32_t fd,
1277 DataIndex fileId,
1278 DataIndex firstArgument,
1279 DataIndex secondArgument,
1280 DataIndex thirdArgument,
1281 DataIndex fourthArgument)
1282 {
1283 callChainIds_.emplace_back(callChainId);
1284 types_.emplace_back(type);
1285 ipids_.emplace_back(ipid);
1286 itids_.emplace_back(itid);
1287 startTs_.emplace_back(startTs);
1288 endTs_.emplace_back(endTs);
1289 durs_.emplace_back(dur);
1290 returnValues_.emplace_back(returnValue);
1291 errorCodes_.emplace_back(errorCode);
1292 fds_.emplace_back(fd);
1293 fileIds_.emplace_back(fileId);
1294 Sizes_.emplace_back(size);
1295 firstArguments_.emplace_back(firstArgument);
1296 secondArguments_.emplace_back(secondArgument);
1297 thirdArguments_.emplace_back(thirdArgument);
1298 fourthArguments_.emplace_back(fourthArgument);
1299 ids_.emplace_back(Size());
1300 return Size() - 1;
1301 }
CallChainIds() const1302 const std::deque<uint64_t>& FileSystemSample::CallChainIds() const
1303 {
1304 return callChainIds_;
1305 }
Types() const1306 const std::deque<uint16_t>& FileSystemSample::Types() const
1307 {
1308 return types_;
1309 }
Ipids() const1310 const std::deque<uint32_t>& FileSystemSample::Ipids() const
1311 {
1312 return ipids_;
1313 }
Itids() const1314 const std::deque<uint32_t>& FileSystemSample::Itids() const
1315 {
1316 return itids_;
1317 }
StartTs() const1318 const std::deque<uint64_t>& FileSystemSample::StartTs() const
1319 {
1320 return startTs_;
1321 }
EndTs() const1322 const std::deque<uint64_t>& FileSystemSample::EndTs() const
1323 {
1324 return endTs_;
1325 }
Durs() const1326 const std::deque<uint64_t>& FileSystemSample::Durs() const
1327 {
1328 return durs_;
1329 }
ReturnValues() const1330 const std::deque<DataIndex>& FileSystemSample::ReturnValues() const
1331 {
1332 return returnValues_;
1333 }
ErrorCodes() const1334 const std::deque<DataIndex>& FileSystemSample::ErrorCodes() const
1335 {
1336 return errorCodes_;
1337 }
Fds() const1338 const std::deque<int32_t>& FileSystemSample::Fds() const
1339 {
1340 return fds_;
1341 }
FileIds() const1342 const std::deque<DataIndex>& FileSystemSample::FileIds() const
1343 {
1344 return fileIds_;
1345 }
Sizes() const1346 const std::deque<size_t>& FileSystemSample::Sizes() const
1347 {
1348 return Sizes_;
1349 }
FirstArguments() const1350 const std::deque<DataIndex>& FileSystemSample::FirstArguments() const
1351 {
1352 return firstArguments_;
1353 }
SecondArguments() const1354 const std::deque<DataIndex>& FileSystemSample::SecondArguments() const
1355 {
1356 return secondArguments_;
1357 }
ThirdArguments() const1358 const std::deque<DataIndex>& FileSystemSample::ThirdArguments() const
1359 {
1360 return thirdArguments_;
1361 }
FourthArguments() const1362 const std::deque<DataIndex>& FileSystemSample::FourthArguments() const
1363 {
1364 return fourthArguments_;
1365 }
1366
AppendNewData(uint64_t callChainId,uint16_t type,uint32_t ipid,uint64_t startTs,uint64_t endTs,uint64_t dur,size_t size,DataIndex addr,uint32_t itid)1367 size_t PagedMemorySampleData::AppendNewData(uint64_t callChainId,
1368 uint16_t type,
1369 uint32_t ipid,
1370 uint64_t startTs,
1371 uint64_t endTs,
1372 uint64_t dur,
1373 size_t size,
1374 DataIndex addr,
1375 uint32_t itid)
1376 {
1377 callChainIds_.emplace_back(callChainId);
1378 types_.emplace_back(type);
1379 ipids_.emplace_back(ipid);
1380 startTs_.emplace_back(startTs);
1381 endTs_.emplace_back(endTs);
1382 durs_.emplace_back(dur);
1383 Sizes_.emplace_back(size);
1384 addrs_.emplace_back(addr);
1385 itids_.emplace_back(itid);
1386 ids_.emplace_back(Size());
1387 return Size() - 1;
1388 }
CallChainIds() const1389 const std::deque<uint64_t>& PagedMemorySampleData::CallChainIds() const
1390 {
1391 return callChainIds_;
1392 }
Types() const1393 const std::deque<uint16_t>& PagedMemorySampleData::Types() const
1394 {
1395 return types_;
1396 }
Ipids() const1397 const std::deque<uint32_t>& PagedMemorySampleData::Ipids() const
1398 {
1399 return ipids_;
1400 }
Itids() const1401 const std::deque<uint32_t>& PagedMemorySampleData::Itids() const
1402 {
1403 return itids_;
1404 }
StartTs() const1405 const std::deque<uint64_t>& PagedMemorySampleData::StartTs() const
1406 {
1407 return startTs_;
1408 }
EndTs() const1409 const std::deque<uint64_t>& PagedMemorySampleData::EndTs() const
1410 {
1411 return endTs_;
1412 }
Durs() const1413 const std::deque<uint64_t>& PagedMemorySampleData::Durs() const
1414 {
1415 return durs_;
1416 }
Sizes() const1417 const std::deque<size_t>& PagedMemorySampleData::Sizes() const
1418 {
1419 return Sizes_;
1420 }
Addr() const1421 const std::deque<DataIndex>& PagedMemorySampleData::Addr() const
1422 {
1423 return addrs_;
1424 }
1425
AppendNewData(uint64_t callChainId,uint32_t depth,uint64_t ip,uint64_t symbolId,uint64_t filePathId)1426 size_t EbpfCallStackData::AppendNewData(uint64_t callChainId,
1427 uint32_t depth,
1428 uint64_t ip,
1429 uint64_t symbolId,
1430 uint64_t filePathId)
1431 {
1432 callChainIds_.emplace_back(callChainId);
1433 depths_.emplace_back(depth);
1434 ips_.emplace_back(ip);
1435 symbolIds_.emplace_back(symbolId);
1436 filePathIds_.emplace_back(filePathId);
1437 ids_.emplace_back(Size());
1438 return Size() - 1;
1439 }
CallChainIds() const1440 const std::deque<uint64_t>& EbpfCallStackData::CallChainIds() const
1441 {
1442 return callChainIds_;
1443 }
Depths() const1444 const std::deque<uint32_t>& EbpfCallStackData::Depths() const
1445 {
1446 return depths_;
1447 }
Ips() const1448 const std::deque<uint64_t>& EbpfCallStackData::Ips() const
1449 {
1450 return ips_;
1451 }
SymbolIds() const1452 const std::deque<uint64_t>& EbpfCallStackData::SymbolIds() const
1453 {
1454 return symbolIds_;
1455 }
FilePathIds() const1456 const std::deque<uint64_t>& EbpfCallStackData::FilePathIds() const
1457 {
1458 return filePathIds_;
1459 }
1460 #if WITH_EBPF_HELP
AppendNewData(uint64_t start,uint64_t end,uint32_t offset,uint32_t pid,uint32_t fileNameLen,uint64_t fileNameIndex)1461 size_t EbpfProcessMaps::AppendNewData(uint64_t start,
1462 uint64_t end,
1463 uint32_t offset,
1464 uint32_t pid,
1465 uint32_t fileNameLen,
1466 uint64_t fileNameIndex)
1467 {
1468 starts_.emplace_back(start);
1469 ends_.emplace_back(end);
1470 offsets_.emplace_back(offset);
1471 pids_.emplace_back(pid);
1472 fileNameLens_.emplace_back(fileNameLen);
1473 fileNameIndexs_.emplace_back(fileNameIndex);
1474 ids_.emplace_back(Size());
1475 return Size() - 1;
1476 }
1477
Starts() const1478 const std::deque<uint64_t>& EbpfProcessMaps::Starts() const
1479 {
1480 return starts_;
1481 }
Ends() const1482 const std::deque<uint64_t>& EbpfProcessMaps::Ends() const
1483 {
1484 return ends_;
1485 }
Offsets() const1486 const std::deque<uint32_t>& EbpfProcessMaps::Offsets() const
1487 {
1488 return offsets_;
1489 }
Pids() const1490 const std::deque<uint32_t>& EbpfProcessMaps::Pids() const
1491 {
1492 return pids_;
1493 }
FileNameLens() const1494 const std::deque<uint32_t>& EbpfProcessMaps::FileNameLens() const
1495 {
1496 return fileNameLens_;
1497 }
FileNameIndexs() const1498 const std::deque<uint64_t>& EbpfProcessMaps::FileNameIndexs() const
1499 {
1500 return fileNameIndexs_;
1501 }
1502
AppendNewData(uint64_t elfId,uint64_t textVaddr,uint32_t textOffset,uint32_t strTabLen,uint32_t symTabLen,uint32_t fileNameLen,uint32_t symEntLen,uint64_t fileNameIndex)1503 size_t EbpfElf::AppendNewData(uint64_t elfId,
1504 uint64_t textVaddr,
1505 uint32_t textOffset,
1506 uint32_t strTabLen,
1507 uint32_t symTabLen,
1508 uint32_t fileNameLen,
1509 uint32_t symEntLen,
1510 uint64_t fileNameIndex)
1511 {
1512 elfIds_.emplace_back(elfId);
1513 textVaddrs_.emplace_back(textVaddr);
1514 textOffsets_.emplace_back(textOffset);
1515 strTabLens_.emplace_back(strTabLen);
1516 symTabLens_.emplace_back(symTabLen);
1517 fileNameLens_.emplace_back(fileNameLen);
1518 symEntLens_.emplace_back(symEntLen);
1519 fileNameIndexs_.emplace_back(fileNameIndex);
1520 ids_.emplace_back(Size());
1521 return Size() - 1;
1522 }
ElfIds() const1523 const std::deque<uint64_t>& EbpfElf::ElfIds() const
1524 {
1525 return elfIds_;
1526 }
TextVaddrs() const1527 const std::deque<uint64_t>& EbpfElf::TextVaddrs() const
1528 {
1529 return textVaddrs_;
1530 }
TextOffsets() const1531 const std::deque<uint32_t>& EbpfElf::TextOffsets() const
1532 {
1533 return textOffsets_;
1534 }
StrTabLens() const1535 const std::deque<uint32_t>& EbpfElf::StrTabLens() const
1536 {
1537 return strTabLens_;
1538 }
SymTabLens() const1539 const std::deque<uint32_t>& EbpfElf::SymTabLens() const
1540 {
1541 return symTabLens_;
1542 }
FileNameLens() const1543 const std::deque<uint32_t>& EbpfElf::FileNameLens() const
1544 {
1545 return fileNameLens_;
1546 }
SymEntLens() const1547 const std::deque<uint32_t>& EbpfElf::SymEntLens() const
1548 {
1549 return symEntLens_;
1550 }
FileNameIndexs() const1551 const std::deque<uint64_t>& EbpfElf::FileNameIndexs() const
1552 {
1553 return fileNameIndexs_;
1554 }
1555
AppendNewData(uint64_t elfId,uint32_t stName,uint64_t stValue,uint64_t stSize)1556 size_t EbpfElfSymbol::AppendNewData(uint64_t elfId, uint32_t stName, uint64_t stValue, uint64_t stSize)
1557 {
1558 elfIds_.emplace_back(elfId);
1559 stNames_.emplace_back(stName);
1560 stValues_.emplace_back(stValue);
1561 stSizes_.emplace_back(stSize);
1562 ids_.emplace_back(Size());
1563 return Size() - 1;
1564 }
ElfIds() const1565 const std::deque<uint64_t>& EbpfElfSymbol::ElfIds() const
1566 {
1567 return elfIds_;
1568 }
StNames() const1569 const std::deque<uint32_t>& EbpfElfSymbol::StNames() const
1570 {
1571 return stNames_;
1572 }
StValues() const1573 const std::deque<uint64_t>& EbpfElfSymbol::StValues() const
1574 {
1575 return stValues_;
1576 }
StSizes() const1577 const std::deque<uint64_t>& EbpfElfSymbol::StSizes() const
1578 {
1579 return stSizes_;
1580 }
1581 #endif
AppendAppName(uint8_t flags,DataIndex eventSource,DataIndex appName)1582 uint32_t AppNames::AppendAppName(uint8_t flags, DataIndex eventSource, DataIndex appName)
1583 {
1584 flags_.push_back(flags);
1585 appNames_.push_back(eventSource);
1586 keyNames_.push_back(appName);
1587 ids_.push_back(keyNames_.size() - 1);
1588 return Size() - 1;
1589 }
Falgs() const1590 const std::deque<uint8_t>& AppNames::Falgs() const
1591 {
1592 return flags_;
1593 }
EventSourceId() const1594 const std::deque<DataIndex>& AppNames::EventSourceId() const
1595 {
1596 return appNames_;
1597 }
AppName() const1598 const std::deque<DataIndex>& AppNames::AppName() const
1599 {
1600 return keyNames_;
1601 }
1602
AppendData(uint64_t serial,uint64_t ts,uint32_t nameId,uint32_t keyId,int32_t type,double numericValue,DataIndex stringValue)1603 void SysEventMeasureData::AppendData(uint64_t serial,
1604 uint64_t ts,
1605 uint32_t nameId,
1606 uint32_t keyId,
1607 int32_t type,
1608 double numericValue,
1609 DataIndex stringValue)
1610 {
1611 serial_.emplace_back(serial);
1612 ts_.emplace_back(ts);
1613 nameFilterIds_.emplace_back(nameId);
1614 appKeyFilterIds_.emplace_back(keyId);
1615 types_.emplace_back(type);
1616 numValues_.emplace_back(numericValue);
1617 stringValues_.emplace_back(stringValue);
1618 ids_.push_back(rowCount_);
1619 rowCount_++;
1620 }
Serial() const1621 const std::deque<uint64_t>& SysEventMeasureData::Serial() const
1622 {
1623 return serial_;
1624 }
Ts() const1625 const std::deque<uint64_t>& SysEventMeasureData::Ts() const
1626 {
1627 return ts_;
1628 }
NameFilterId() const1629 const std::deque<uint32_t>& SysEventMeasureData::NameFilterId() const
1630 {
1631 return nameFilterIds_;
1632 }
AppKeyFilterId() const1633 const std::deque<uint32_t>& SysEventMeasureData::AppKeyFilterId() const
1634 {
1635 return appKeyFilterIds_;
1636 }
Type() const1637 const std::deque<int32_t>& SysEventMeasureData::Type() const
1638 {
1639 return types_;
1640 }
NumValue() const1641 const std::deque<double>& SysEventMeasureData::NumValue() const
1642 {
1643 return numValues_;
1644 }
StringValue() const1645 const std::deque<DataIndex>& SysEventMeasureData::StringValue() const
1646 {
1647 return stringValues_;
1648 }
AppendNewData(int32_t brightness,int32_t btState,int32_t location,int32_t wifi,int32_t streamDefault,int32_t voiceCall,int32_t music,int32_t streamRing,int32_t media,int32_t voiceAssistant,int32_t system,int32_t alarm,int32_t notification,int32_t btSco,int32_t enforcedAudible,int32_t streamDtmf,int32_t streamTts,int32_t accessibility,int32_t recording,int32_t streamAll)1649 void DeviceStateData::AppendNewData(int32_t brightness,
1650 int32_t btState,
1651 int32_t location,
1652 int32_t wifi,
1653 int32_t streamDefault,
1654 int32_t voiceCall,
1655 int32_t music,
1656 int32_t streamRing,
1657 int32_t media,
1658 int32_t voiceAssistant,
1659 int32_t system,
1660 int32_t alarm,
1661 int32_t notification,
1662 int32_t btSco,
1663 int32_t enforcedAudible,
1664 int32_t streamDtmf,
1665 int32_t streamTts,
1666 int32_t accessibility,
1667 int32_t recording,
1668 int32_t streamAll)
1669 {
1670 brightness_.emplace_back(brightness);
1671 btStates_.emplace_back(btState);
1672 locations_.emplace_back(location);
1673 wifis_.emplace_back(wifi);
1674 streamDefaults_.emplace_back(streamDefault);
1675 voiceCalls_.emplace_back(voiceCall);
1676 musics_.emplace_back(music);
1677 streamRings_.emplace_back(streamRing);
1678 medias_.emplace_back(media);
1679 voiceAssistants_.emplace_back(voiceAssistant);
1680 systems_.emplace_back(system);
1681 alarms_.emplace_back(alarm);
1682 notifications_.emplace_back(notification);
1683 btScos_.emplace_back(btSco);
1684 enforcedAudibles_.emplace_back(enforcedAudible);
1685 streamDtmfs_.emplace_back(streamDtmf);
1686 streamTts_.emplace_back(streamTts);
1687 accessibilitys_.emplace_back(accessibility);
1688 recordings_.emplace_back(recording);
1689 streamAlls_.emplace_back(streamAll);
1690 ids_.push_back(rowCounts_);
1691 rowCounts_++;
1692 }
Brightness() const1693 const std::deque<int32_t>& DeviceStateData::Brightness() const
1694 {
1695 return brightness_;
1696 }
BtState() const1697 const std::deque<int32_t>& DeviceStateData::BtState() const
1698 {
1699 return btStates_;
1700 }
Location() const1701 const std::deque<int32_t>& DeviceStateData::Location() const
1702 {
1703 return locations_;
1704 }
Wifi() const1705 const std::deque<int32_t>& DeviceStateData::Wifi() const
1706 {
1707 return wifis_;
1708 }
StreamDefault() const1709 const std::deque<int32_t>& DeviceStateData::StreamDefault() const
1710 {
1711 return streamDefaults_;
1712 }
VoiceCall() const1713 const std::deque<int32_t>& DeviceStateData::VoiceCall() const
1714 {
1715 return voiceCalls_;
1716 }
Music() const1717 const std::deque<int32_t>& DeviceStateData::Music() const
1718 {
1719 return musics_;
1720 }
StreamRing() const1721 const std::deque<int32_t>& DeviceStateData::StreamRing() const
1722 {
1723 return streamRings_;
1724 }
Media() const1725 const std::deque<int32_t>& DeviceStateData::Media() const
1726 {
1727 return medias_;
1728 }
VoiceAssistant() const1729 const std::deque<int32_t>& DeviceStateData::VoiceAssistant() const
1730 {
1731 return voiceAssistants_;
1732 }
System() const1733 const std::deque<int32_t>& DeviceStateData::System() const
1734 {
1735 return systems_;
1736 }
Alarm() const1737 const std::deque<int32_t>& DeviceStateData::Alarm() const
1738 {
1739 return alarms_;
1740 }
Notification() const1741 const std::deque<int32_t>& DeviceStateData::Notification() const
1742 {
1743 return notifications_;
1744 }
BtSco() const1745 const std::deque<int32_t>& DeviceStateData::BtSco() const
1746 {
1747 return btScos_;
1748 }
EnforcedAudible() const1749 const std::deque<int32_t>& DeviceStateData::EnforcedAudible() const
1750 {
1751 return enforcedAudibles_;
1752 }
StreamDtmf() const1753 const std::deque<int32_t>& DeviceStateData::StreamDtmf() const
1754 {
1755 return streamDtmfs_;
1756 }
StreamTts() const1757 const std::deque<int32_t>& DeviceStateData::StreamTts() const
1758 {
1759 return streamTts_;
1760 }
Accessibility() const1761 const std::deque<int32_t>& DeviceStateData::Accessibility() const
1762 {
1763 return accessibilitys_;
1764 }
Recording() const1765 const std::deque<int32_t>& DeviceStateData::Recording() const
1766 {
1767 return recordings_;
1768 }
StreamAll() const1769 const std::deque<int32_t>& DeviceStateData::StreamAll() const
1770 {
1771 return streamAlls_;
1772 }
AppendNewData(uint64_t timeStamp,std::string startAddr,std::string endAddr,uint64_t dirty,uint64_t swapper,uint64_t rss,uint64_t pss,uint64_t size,double reside,DataIndex protectionId,DataIndex pathId)1773 void SmapsData::AppendNewData(uint64_t timeStamp,
1774 std::string startAddr,
1775 std::string endAddr,
1776 uint64_t dirty,
1777 uint64_t swapper,
1778 uint64_t rss,
1779 uint64_t pss,
1780 uint64_t size,
1781 double reside,
1782 DataIndex protectionId,
1783 DataIndex pathId)
1784 {
1785 timeStamps_.emplace_back(timeStamp);
1786 startAddrs_.emplace_back(startAddr);
1787 endAddrs_.emplace_back(endAddr);
1788 dirtys_.emplace_back(dirty);
1789 swappers_.emplace_back(swapper);
1790 rss_.emplace_back(rss);
1791 pss_.emplace_back(pss);
1792 sizes_.emplace_back(size);
1793 resides_.emplace_back(reside);
1794 protectionIds_.emplace_back(protectionId);
1795 pathIds_.emplace_back(pathId);
1796 ids_.push_back(rowCount_);
1797 rowCount_++;
1798 }
TimeStamps() const1799 const std::deque<uint64_t>& SmapsData::TimeStamps() const
1800 {
1801 return timeStamps_;
1802 }
StartAddrs() const1803 const std::deque<std::string>& SmapsData::StartAddrs() const
1804 {
1805 return startAddrs_;
1806 }
EndAddrs() const1807 const std::deque<std::string>& SmapsData::EndAddrs() const
1808 {
1809 return endAddrs_;
1810 }
Dirtys() const1811 const std::deque<uint64_t>& SmapsData::Dirtys() const
1812 {
1813 return dirtys_;
1814 }
Swappers() const1815 const std::deque<uint64_t>& SmapsData::Swappers() const
1816 {
1817 return swappers_;
1818 }
Rss() const1819 const std::deque<uint64_t>& SmapsData::Rss() const
1820 {
1821 return rss_;
1822 }
Pss() const1823 const std::deque<uint64_t>& SmapsData::Pss() const
1824 {
1825 return pss_;
1826 }
Sizes() const1827 const std::deque<uint64_t>& SmapsData::Sizes() const
1828 {
1829 return sizes_;
1830 }
Resides() const1831 const std::deque<double>& SmapsData::Resides() const
1832 {
1833 return resides_;
1834 }
ProtectionIds() const1835 const std::deque<DataIndex>& SmapsData::ProtectionIds() const
1836 {
1837 return protectionIds_;
1838 }
PathIds() const1839 const std::deque<DataIndex>& SmapsData::PathIds() const
1840 {
1841 return pathIds_;
1842 }
AppendNewData(uint64_t callChainId,uint64_t type,uint64_t ipid,uint64_t itid,uint64_t startTs,uint64_t endTs,uint64_t latencyDur,uint32_t tier,uint64_t size,uint64_t blockNumber,uint64_t filePathId,uint64_t durPer4k)1843 void BioLatencySampleData::AppendNewData(uint64_t callChainId,
1844 uint64_t type,
1845 uint64_t ipid,
1846 uint64_t itid,
1847 uint64_t startTs,
1848 uint64_t endTs,
1849 uint64_t latencyDur,
1850 uint32_t tier,
1851 uint64_t size,
1852 uint64_t blockNumber,
1853 uint64_t filePathId,
1854 uint64_t durPer4k)
1855 {
1856 callChainIds_.emplace_back(callChainId);
1857 types_.emplace_back(type);
1858 ipids_.emplace_back(ipid);
1859 itids_.emplace_back(itid);
1860 startTs_.emplace_back(startTs);
1861 endTs_.emplace_back(endTs);
1862 latencyDurs_.emplace_back(latencyDur);
1863 tiers_.emplace_back(tier);
1864 sizes_.emplace_back(size);
1865 blockNumbers_.emplace_back(blockNumber);
1866 filePathIds_.emplace_back(filePathId);
1867 durPer4ks_.emplace_back(durPer4k);
1868 ids_.emplace_back(rowCount_);
1869 rowCount_++;
1870 }
CallChainIds() const1871 const std::deque<uint64_t>& BioLatencySampleData::CallChainIds() const
1872 {
1873 return callChainIds_;
1874 }
Types() const1875 const std::deque<uint64_t>& BioLatencySampleData::Types() const
1876 {
1877 return types_;
1878 }
Ipids() const1879 const std::deque<uint64_t>& BioLatencySampleData::Ipids() const
1880 {
1881 return ipids_;
1882 }
Itids() const1883