• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef KERNEL_SYMBOLS_PROCESSOR_H
16 #define KERNEL_SYMBOLS_PROCESSOR_H
17 
18 #include <functional>
19 #include <string>
20 #include <vector>
21 #include "trace_data_cache.h"
22 #include "trace_streamer_filters.h"
23 
24 namespace SysTuning {
25 namespace TraceStreamer {
26 class KernelSymbolsProcessor {
27 public:
28     KernelSymbolsProcessor(TraceDataCache *dataCache, const TraceStreamerFilters *filters);
29     ~KernelSymbolsProcessor();
30 
31     bool HandleKallSyms(const std::string &kallsyms);
32 
33 private:
34     struct KernelSymbol {
35         char type{0};
36         uint64_t addr{0};
37         std::string name;
38     };
39 
40 private:
41     static bool IsValidKernelSymbol(const KernelSymbol &symbol);
42 
43 private:
44     TraceDataCache *traceDataCache_;
45     const TraceStreamerFilters *streamFilters_;
46 };
47 } // namespace TraceStreamer
48 } // namespace SysTuning
49 #endif // KERNEL_SYMBOLS_PROCESSOR_H
50