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 IRQ_FILTER_H 17 #define IRQ_FILTER_H 18 19 #include <unordered_set> 20 #include "args_set.h" 21 #include "filter_base.h" 22 #include "trace_data_cache.h" 23 #include "trace_streamer_filters.h" 24 namespace SysTuning { 25 namespace TraceStreamer { 26 class IrqFilter : private FilterBase { 27 public: 28 IrqFilter(TraceDataCache *, const TraceStreamerFilters *); 29 IrqFilter(const IrqFilter &) = delete; 30 IrqFilter &operator=(const IrqFilter &) = delete; 31 ~IrqFilter() override; 32 33 public: 34 void IrqHandlerEntry(int64_t ts, uint32_t cpu, DataIndex nameId); 35 void IrqHandlerExit(int64_t ts, uint32_t cpu, uint32_t irq, uint32_t ret); 36 void IpiHandlerEntry(int64_t ts, uint32_t cpu, DataIndex nameId); 37 void IpiHandlerExit(int64_t ts, uint32_t cpu); 38 void SoftIrqEntry(int64_t ts, uint32_t cpu, uint32_t vec); 39 void SoftIrqExit(int64_t ts, uint32_t cpu, uint32_t vec); 40 void Clear(); 41 42 private: 43 const DataIndex irqId_ = traceDataCache_->GetDataIndex("irq_id"); 44 const DataIndex irqRet_ = traceDataCache_->GetDataIndex("irq_ret"); 45 const DataIndex irq_ = traceDataCache_->GetDataIndex("irq"); 46 const DataIndex irqVec_ = traceDataCache_->GetDataIndex("vec"); 47 const DataIndex irqHandled_ = traceDataCache_->GetDataIndex("handled"); 48 const DataIndex irqUnHandled_ = traceDataCache_->GetDataIndex("unhandled"); 49 const DataIndex irqCatalog_ = traceDataCache_->GetDataIndex("irq"); 50 const DataIndex ipiCatalog_ = traceDataCache_->GetDataIndex("ipi"); 51 const DataIndex softIrqCatalog_ = traceDataCache_->GetDataIndex("softirq"); 52 std::unordered_map<uint64_t, int64_t> lastEventTs_ = {}; 53 std::unordered_set<uint64_t> transReplyWaitingReply_ = {}; 54 std::unordered_map<uint64_t, FilterId> transWaitingRcv_ = {}; 55 std::unordered_map<uint64_t, ArgsSet> transNoNeedReply_ = {}; 56 std::unordered_map<int32_t, std::string> binderFlagDescs_ = {}; 57 std::vector<std::string> irqActionNames_ = {"HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", 58 "BLOCK_IOPOLL", "TASKLET", "SCHED", "HRTIMER", "RCU"}; 59 std::vector<DataIndex> irqActionNameIds_ = {}; 60 }; 61 } // namespace TraceStreamer 62 } // namespace SysTuning 63 64 #endif // IRQ_FILTER_H 65