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 #include "ebpf_stdtype.h" 16 17 namespace SysTuning { 18 namespace TraceStdtype { AppendNewData(const FileSystemSampleRow & context)19size_t FileSystemSample::AppendNewData(const FileSystemSampleRow &context) 20 { 21 callChainIds_.emplace_back(context.callChainId); 22 types_.emplace_back(context.type); 23 ipids_.emplace_back(context.ipid); 24 itids_.emplace_back(context.itid); 25 startTs_.emplace_back(context.startTs); 26 endTs_.emplace_back(context.endTs); 27 durs_.emplace_back(context.dur); 28 returnValues_.emplace_back(context.returnValue); 29 errorCodes_.emplace_back(context.errorCode); 30 fds_.emplace_back(context.fd); 31 fileIds_.emplace_back(context.fileId); 32 Sizes_.emplace_back(context.size); 33 firstArguments_.emplace_back(context.firstArgument); 34 secondArguments_.emplace_back(context.secondArgument); 35 thirdArguments_.emplace_back(context.thirdArgument); 36 fourthArguments_.emplace_back(context.fourthArgument); 37 ids_.emplace_back(Size()); 38 return Size() - 1; 39 } CallChainIds() const40const std::deque<uint32_t> &FileSystemSample::CallChainIds() const 41 { 42 return callChainIds_; 43 } Types() const44const std::deque<uint16_t> &FileSystemSample::Types() const 45 { 46 return types_; 47 } Ipids() const48const std::deque<uint32_t> &FileSystemSample::Ipids() const 49 { 50 return ipids_; 51 } Itids() const52const std::deque<uint32_t> &FileSystemSample::Itids() const 53 { 54 return itids_; 55 } StartTs() const56const std::deque<uint64_t> &FileSystemSample::StartTs() const 57 { 58 return startTs_; 59 } EndTs() const60const std::deque<uint64_t> &FileSystemSample::EndTs() const 61 { 62 return endTs_; 63 } Durs() const64const std::deque<uint64_t> &FileSystemSample::Durs() const 65 { 66 return durs_; 67 } ReturnValues() const68const std::deque<DataIndex> &FileSystemSample::ReturnValues() const 69 { 70 return returnValues_; 71 } ErrorCodes() const72const std::deque<DataIndex> &FileSystemSample::ErrorCodes() const 73 { 74 return errorCodes_; 75 } Fds() const76const std::deque<int32_t> &FileSystemSample::Fds() const 77 { 78 return fds_; 79 } FileIds() const80const std::deque<DataIndex> &FileSystemSample::FileIds() const 81 { 82 return fileIds_; 83 } Sizes() const84const std::deque<size_t> &FileSystemSample::Sizes() const 85 { 86 return Sizes_; 87 } FirstArguments() const88const std::deque<DataIndex> &FileSystemSample::FirstArguments() const 89 { 90 return firstArguments_; 91 } SecondArguments() const92const std::deque<DataIndex> &FileSystemSample::SecondArguments() const 93 { 94 return secondArguments_; 95 } ThirdArguments() const96const std::deque<DataIndex> &FileSystemSample::ThirdArguments() const 97 { 98 return thirdArguments_; 99 } FourthArguments() const100const std::deque<DataIndex> &FileSystemSample::FourthArguments() const 101 { 102 return fourthArguments_; 103 } 104 AppendNewData(const PagedMemorySampleDataRow & context)105size_t PagedMemorySampleData::AppendNewData(const PagedMemorySampleDataRow &context) 106 { 107 callChainIds_.emplace_back(context.callChainId); 108 types_.emplace_back(context.type); 109 ipids_.emplace_back(context.ipid); 110 startTs_.emplace_back(context.startTs); 111 endTs_.emplace_back(context.endTs); 112 durs_.emplace_back(context.dur); 113 Sizes_.emplace_back(context.size); 114 addrs_.emplace_back(context.addr); 115 itids_.emplace_back(context.itid); 116 ids_.emplace_back(Size()); 117 return Size() - 1; 118 } CallChainIds() const119const std::deque<uint32_t> &PagedMemorySampleData::CallChainIds() const 120 { 121 return callChainIds_; 122 } Types() const123const std::deque<uint16_t> &PagedMemorySampleData::Types() const 124 { 125 return types_; 126 } Ipids() const127const std::deque<uint32_t> &PagedMemorySampleData::Ipids() const 128 { 129 return ipids_; 130 } Itids() const131const std::deque<uint32_t> &PagedMemorySampleData::Itids() const 132 { 133 return itids_; 134 } StartTs() const135const std::deque<uint64_t> &PagedMemorySampleData::StartTs() const 136 { 137 return startTs_; 138 } EndTs() const139const std::deque<uint64_t> &PagedMemorySampleData::EndTs() const 140 { 141 return endTs_; 142 } Durs() const143const std::deque<uint64_t> &PagedMemorySampleData::Durs() const 144 { 145 return durs_; 146 } Sizes() const147const std::deque<size_t> &PagedMemorySampleData::Sizes() const 148 { 149 return Sizes_; 150 } Addr() const151const std::deque<DataIndex> &PagedMemorySampleData::Addr() const 152 { 153 return addrs_; 154 } 155 AppendNewData(const BioLatencySampleDataRow & context)156void BioLatencySampleData::AppendNewData(const BioLatencySampleDataRow &context) 157 { 158 callChainIds_.emplace_back(context.callChainId); 159 types_.emplace_back(context.type); 160 ipids_.emplace_back(context.ipid); 161 itids_.emplace_back(context.itid); 162 startTs_.emplace_back(context.startTs); 163 endTs_.emplace_back(context.endTs); 164 latencyDurs_.emplace_back(context.latencyDur); 165 tiers_.emplace_back(context.tier); 166 sizes_.emplace_back(context.size); 167 blockNumbers_.emplace_back(context.blockNumber); 168 filePathIds_.emplace_back(context.filePathId); 169 durPer4ks_.emplace_back(context.durPer4k); 170 ids_.emplace_back(rowCount_); 171 rowCount_++; 172 } CallChainIds() const173const std::deque<uint32_t> &BioLatencySampleData::CallChainIds() const 174 { 175 return callChainIds_; 176 } Types() const177const std::deque<uint64_t> &BioLatencySampleData::Types() const 178 { 179 return types_; 180 } Ipids() const181const std::deque<uint32_t> &BioLatencySampleData::Ipids() const 182 { 183 return ipids_; 184 } Itids() const185const std::deque<uint32_t> &BioLatencySampleData::Itids() const 186 { 187 return itids_; 188 } StartTs() const189const std::deque<uint64_t> &BioLatencySampleData::StartTs() const 190 { 191 return startTs_; 192 } EndTs() const193const std::deque<uint64_t> &BioLatencySampleData::EndTs() const 194 { 195 return endTs_; 196 } LatencyDurs() const197const std::deque<uint64_t> &BioLatencySampleData::LatencyDurs() const 198 { 199 return latencyDurs_; 200 } Tiers() const201const std::deque<uint32_t> &BioLatencySampleData::Tiers() const 202 { 203 return tiers_; 204 } Sizes() const205const std::deque<uint64_t> &BioLatencySampleData::Sizes() const 206 { 207 return sizes_; 208 } BlockNumbers() const209const std::deque<uint64_t> &BioLatencySampleData::BlockNumbers() const 210 { 211 return blockNumbers_; 212 } FilePathIds() const213const std::deque<uint64_t> &BioLatencySampleData::FilePathIds() const 214 { 215 return filePathIds_; 216 } DurPer4k() const217const std::deque<uint64_t> &BioLatencySampleData::DurPer4k() const 218 { 219 return durPer4ks_; 220 } 221 AppendNewData(const EbpfCallStackDataRow & context)222size_t EbpfCallStackData::AppendNewData(const EbpfCallStackDataRow &context) 223 { 224 callChainIds_.emplace_back(context.callChainId); 225 depths_.emplace_back(context.depth); 226 ips_.emplace_back(context.ip); 227 symbolIds_.emplace_back(context.symbolId); 228 filePathIds_.emplace_back(context.filePathId); 229 vaddrs_.emplace_back(context.vaddr); 230 ids_.emplace_back(Size()); 231 return Size() - 1; 232 } UpdateEbpfSymbolInfo(size_t row,DataIndex symbolId)233void EbpfCallStackData::UpdateEbpfSymbolInfo(size_t row, DataIndex symbolId) 234 { 235 if (row >= Size()) { 236 TS_LOGE("The updated row does not exist!"); 237 return; 238 } 239 symbolIds_[row] = symbolId; 240 } CallChainIds() const241const std::deque<uint32_t> &EbpfCallStackData::CallChainIds() const 242 { 243 return callChainIds_; 244 } Depths() const245const std::deque<uint32_t> &EbpfCallStackData::Depths() const 246 { 247 return depths_; 248 } Ips() const249const std::deque<DataIndex> &EbpfCallStackData::Ips() const 250 { 251 return ips_; 252 } SymbolIds() const253const std::deque<DataIndex> &EbpfCallStackData::SymbolIds() const 254 { 255 return symbolIds_; 256 } FilePathIds() const257const std::deque<DataIndex> &EbpfCallStackData::FilePathIds() const 258 { 259 return filePathIds_; 260 } Vaddrs() const261const std::deque<uint64_t> &EbpfCallStackData::Vaddrs() const 262 { 263 return vaddrs_; 264 } 265 } // namespace TraceStdtype 266 } // namespace SysTuning 267