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 PERF_DATA_FILTER_H 17 #define PERF_DATA_FILTER_H 18 #include <map> 19 #include <set> 20 #include <unordered_set> 21 #include "double_map.h" 22 #include "filter_base.h" 23 #include "trace_data_cache.h" 24 #include "trace_streamer_filters.h" 25 namespace SysTuning { 26 namespace TraceStreamer { 27 constexpr int FLAG_SHIFT_LEFT = 63; 28 class PerfDataFilter : private FilterBase { 29 public: 30 PerfDataFilter(TraceDataCache *, const TraceStreamerFilters *); 31 PerfDataFilter(const PerfDataFilter &) = delete; 32 PerfDataFilter &operator=(const PerfDataFilter &) = delete; 33 ~PerfDataFilter() override; 34 35 public: 36 size_t AppendPerfFiles(uint64_t fileId, uint32_t serial, DataIndex symbols, DataIndex filePath); 37 void Finish(); 38 void BeforeReload(); 39 40 private: 41 DoubleMap<uint64_t, uint32_t, uint64_t> fileIdToRowInFileTable_; 42 std::set<uint64_t> fileIds_; 43 std::map<uint64_t, uint64_t> fileIdToRow_{}; 44 }; 45 } // namespace TraceStreamer 46 } // namespace SysTuning 47 48 #endif // PERF_DATA_FILTER_H 49