• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef EBPF_DATA_PARSER_H
16 #define EBPF_DATA_PARSER_H
17 #include "bio_latency_data_parser.h"
18 #include "ebpf_data_reader.h"
19 #include "ebpf_stdtype.h"
20 #include "file_system_data_parser.h"
21 #include "paged_memory_data_parser.h"
22 #include "trace_data/trace_data_cache.h"
23 #include "trace_streamer_filters.h"
24 
25 namespace SysTuning {
26 namespace TraceStreamer {
27 class EbpfDataParser : public FileSystemDataParser, public PagedMemoryDataParser, public BioLatencyDataParser {
28 public:
29     EbpfDataParser(TraceDataCache* dataCache, const TraceStreamerFilters* ctx);
30     ~EbpfDataParser();
31     void InitAndParseEbpfData(const std::deque<uint8_t>& dequeBuffer, uint64_t size);
32     void Finish();
SupportImportSymbolTable()33     bool SupportImportSymbolTable()
34     {
35         return ebpfDataReader_ ? true : false;
36     }
37 
38 private:
39     bool Init(const std::deque<uint8_t> dequeBuffer, uint64_t size);
40     std::unique_ptr<EbpfDataReader> ebpfDataReader_;
41     uint64_t ebpfAllEventStartTime_ = std::numeric_limits<uint64_t>::max();
42     uint64_t ebpfAllEventEndTime_ = 0;
43 };
44 } // namespace TraceStreamer
45 } // namespace SysTuning
46 #endif // EBPF_DATA_PARSER_H
47