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_data_cache_reader.h" 17 #include "log.h" 18 namespace SysTuning { 19 namespace TraceStreamer { 20 using namespace TraceStdtype; ~TraceDataCacheReader()21TraceDataCacheReader::~TraceDataCacheReader() {} GetDataFromDict(DataIndex id) const22const std::string& TraceDataCacheReader::GetDataFromDict(DataIndex id) const 23 { 24 return dataDict_.GetDataFromDict(id); 25 } 26 GetConstProcessData() const27const std::deque<Process>& TraceDataCacheReader::GetConstProcessData() const 28 { 29 return internalProcessesData_; 30 } GetConstProcessData(InternalPid internalPid) const31const Process& TraceDataCacheReader::GetConstProcessData(InternalPid internalPid) const 32 { 33 TS_ASSERT(internalPid < internalProcessesData_.size()); 34 return internalProcessesData_[internalPid]; 35 } GetConstThreadData(InternalTid internalTid) const36const Thread& TraceDataCacheReader::GetConstThreadData(InternalTid internalTid) const 37 { 38 TS_ASSERT(internalTid < internalThreadsData_.size()); 39 return internalThreadsData_[internalTid]; 40 } 41 GetConstThreadData() const42const std::deque<Thread>& TraceDataCacheReader::GetConstThreadData() const 43 { 44 return internalThreadsData_; 45 } GetConstInternalSlicesData() const46const CallStack& TraceDataCacheReader::GetConstInternalSlicesData() const 47 { 48 return callstackData_; 49 } GetConstIrqData() const50const CallStack& TraceDataCacheReader::GetConstIrqData() const 51 { 52 return irqData_; 53 } GetConstFilterData() const54const Filter& TraceDataCacheReader::GetConstFilterData() const 55 { 56 return filterData_; 57 } GetConstRawTableData() const58const Raw& TraceDataCacheReader::GetConstRawTableData() const 59 { 60 return rawData_; 61 } GetConstMeasureData() const62const Measure& TraceDataCacheReader::GetConstMeasureData() const 63 { 64 return measureData_; 65 } GetConstSysMemMeasureData() const66const Measure& TraceDataCacheReader::GetConstSysMemMeasureData() const 67 { 68 return sysMemMeasureData_; 69 } GetConstProcessMeasureData() const70const Measure& TraceDataCacheReader::GetConstProcessMeasureData() const 71 { 72 return processMeasureData_; 73 } 74 75 GetConstThreadMeasureFilterData() const76const ThreadMeasureFilter& TraceDataCacheReader::GetConstThreadMeasureFilterData() const 77 { 78 return threadMeasureFilterData_; 79 } GetConstThreadStateData() const80const ThreadState& TraceDataCacheReader::GetConstThreadStateData() const 81 { 82 return threadStateData_; 83 } GetConstSchedSliceData() const84const SchedSlice& TraceDataCacheReader::GetConstSchedSliceData() const 85 { 86 return schedSliceData_; 87 } GetConstCpuMeasureData() const88const CpuMeasureFilter& TraceDataCacheReader::GetConstCpuMeasureData() const 89 { 90 return cpuMeasureData_; 91 } GetConstThreadFilterData() const92const ThreadMeasureFilter& TraceDataCacheReader::GetConstThreadFilterData() const 93 { 94 return threadFilterData_; 95 } GetConstInstantsData() const96const Instants& TraceDataCacheReader::GetConstInstantsData() const 97 { 98 return instantsData_; 99 } GetConstProcessFilterData() const100const ProcessMeasureFilter& TraceDataCacheReader::GetConstProcessFilterData() const 101 { 102 return processFilterData_; 103 } GetConstProcessMeasureFilterData() const104const ProcessMeasureFilter& TraceDataCacheReader::GetConstProcessMeasureFilterData() const 105 { 106 return processMeasureFilterData_; 107 } 108 GetConstClockEventFilterData() const109const ClockEventData& TraceDataCacheReader::GetConstClockEventFilterData() const 110 { 111 return clockEventFilterData_; 112 } GetConstClkEventFilterData() const113const ClkEventData& TraceDataCacheReader::GetConstClkEventFilterData() const 114 { 115 return clkEventFilterData_; 116 } GetConstSchedStateData(uint64_t rowId) const117const std::string& TraceDataCacheReader::GetConstSchedStateData(uint64_t rowId) const 118 { 119 TS_ASSERT(statusString_.find(rowId) != statusString_.end()); 120 return statusString_.at(rowId); 121 } TraceStartTime() const122uint64_t TraceDataCacheReader::TraceStartTime() const 123 { 124 return traceStartTime_; 125 } TraceEndTime() const126uint64_t TraceDataCacheReader::TraceEndTime() const 127 { 128 return traceEndTime_; 129 } 130 GetConstStatAndInfo() const131const StatAndInfo& TraceDataCacheReader::GetConstStatAndInfo() const 132 { 133 return stat_; 134 } GetConstMetaData() const135const MetaData& TraceDataCacheReader::GetConstMetaData() const 136 { 137 return metaData_; 138 } 139 GetConstSymbolsData() const140const SymbolsData& TraceDataCacheReader::GetConstSymbolsData() const 141 { 142 return symbolsData_; 143 } 144 GetConstHilogData() const145const LogInfo& TraceDataCacheReader::GetConstHilogData() const 146 { 147 return hilogData_; 148 } 149 GetConstNativeHookData() const150const NativeHook& TraceDataCacheReader::GetConstNativeHookData() const 151 { 152 return nativeHookData_; 153 } 154 GetConstNativeHookFrameData() const155const NativeHookFrame& TraceDataCacheReader::GetConstNativeHookFrameData() const 156 { 157 return nativeHookFrameData_; 158 } 159 GetConstHidumpData() const160const Hidump& TraceDataCacheReader::GetConstHidumpData() const 161 { 162 return hidumpData_; 163 } 164 GetConstPerfCallChainData() const165const PerfCallChain& TraceDataCacheReader::GetConstPerfCallChainData() const 166 { 167 return perfCallChain_; 168 } GetConstPerfFilesData() const169const PerfFiles& TraceDataCacheReader::GetConstPerfFilesData() const 170 { 171 return perfFiles_; 172 } GetConstPerfSampleData() const173const PerfSample& TraceDataCacheReader::GetConstPerfSampleData() const 174 { 175 return perfSample_; 176 } GetConstPerfThreadData() const177const PerfThread& TraceDataCacheReader::GetConstPerfThreadData() const 178 { 179 return perfThread_; 180 } GetConstPerfReportData() const181const PerfReport& TraceDataCacheReader::GetConstPerfReportData() const 182 { 183 return perfReport_; 184 } GetConstSysCallData() const185const SysCall& TraceDataCacheReader::GetConstSysCallData() const 186 { 187 return sysCallData_; 188 } GetConstArgSetData() const189const ArgSet& TraceDataCacheReader::GetConstArgSetData() const 190 { 191 return argSet_; 192 } 193 GetConstDataTypeData() const194const DataType& TraceDataCacheReader::GetConstDataTypeData() const 195 { 196 return dataType_; 197 } 198 GetConstSysMeasureFilterData() const199const SysMeasureFilter& TraceDataCacheReader::GetConstSysMeasureFilterData() const 200 { 201 return sysEvent_; 202 } GetConstNetworkData() const203const NetDetailData& TraceDataCacheReader::GetConstNetworkData() const 204 { 205 return networkData_; 206 } GetConstCpuUsageInfoData() const207const CpuUsageDetailData& TraceDataCacheReader::GetConstCpuUsageInfoData() const 208 { 209 return cpuUsageData_; 210 } GetConstDiskIOData() const211const DiskIOData& TraceDataCacheReader::GetConstDiskIOData() const 212 { 213 return diskIOData_; 214 } GetConstLiveProcessData() const215const LiveProcessDetailData& TraceDataCacheReader::GetConstLiveProcessData() const 216 { 217 return liveProcessDetailData_; 218 } GetConstFileSystemSample() const219const FileSystemSample& TraceDataCacheReader::GetConstFileSystemSample() const 220 { 221 return fileSamplingTableData_; 222 } GetConstEbpfCallStackData() const223const EbpfCallStackData& TraceDataCacheReader::GetConstEbpfCallStackData() const 224 { 225 return ebpfCallStackData_; 226 } GetConstPagedMemorySampleData() const227const PagedMemorySampleData& TraceDataCacheReader::GetConstPagedMemorySampleData() const 228 { 229 return PagedMemorySampleData_; 230 } 231 #if WITH_EBPF_HELP GetConstEbpfProcessMaps() const232const EbpfProcessMaps& TraceDataCacheReader::GetConstEbpfProcessMaps() const 233 { 234 return ebpfProcessMaps_; 235 } GetConstEbpfElf() const236const EbpfElf& TraceDataCacheReader::GetConstEbpfElf() const 237 { 238 return ebpfElf_; 239 } GetConstEbpfElfSymbol() const240const EbpfElfSymbol& TraceDataCacheReader::GetConstEbpfElfSymbol() const 241 { 242 return ebpfElfSymbol_; 243 } 244 #endif GetConstAppNamesData() const245const AppNames& TraceDataCacheReader::GetConstAppNamesData() const 246 { 247 return appNames_; 248 } GetConstSyseventMeasureData() const249const SysEventMeasureData& TraceDataCacheReader::GetConstSyseventMeasureData() const 250 { 251 return sysEventMeasureData_; 252 } GetConstDeviceStateData() const253const DeviceStateData& TraceDataCacheReader::GetConstDeviceStateData() const 254 { 255 return deviceStateData_; 256 } GetConstSmapsData() const257const SmapsData& TraceDataCacheReader::GetConstSmapsData() const 258 { 259 return smapsData_; 260 } GetConstBioLatencySampleData() const261const BioLatencySampleData& TraceDataCacheReader::GetConstBioLatencySampleData() const 262 { 263 return bioLatencySampleData_; 264 } 265 GetConstClockSnapshotData() const266const ClockSnapshotData& TraceDataCacheReader::GetConstClockSnapshotData() const 267 { 268 return clockSnapshotData_; 269 } 270 GetConstDataSourceClockIdData() const271const DataSourceClockIdData& TraceDataCacheReader::GetConstDataSourceClockIdData() const 272 { 273 return dataSourceClockIdData_; 274 } 275 } // namespace TraceStreamer 276 } // namespace SysTuning 277