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 #include "htrace_cpu_detail_parser.h"
16 #include "stat_filter.h"
17 #include "trace_plugin_result.pbreader.h"
18 namespace SysTuning {
19 namespace TraceStreamer {
HtraceCpuDetailParser(TraceDataCache * dataCache,const TraceStreamerFilters * ctx)20 HtraceCpuDetailParser::HtraceCpuDetailParser(TraceDataCache *dataCache, const TraceStreamerFilters *ctx)
21 : eventParser_(std::make_unique<HtraceEventParser>(dataCache, ctx))
22 {
23 }
24
25 HtraceCpuDetailParser::~HtraceCpuDetailParser() = default;
Parse(PbreaderDataSegment & tracePacket,ProtoReader::TracePluginResult_Reader & tracePluginResult,bool & haveSplitSeg)26 void HtraceCpuDetailParser::Parse(PbreaderDataSegment &tracePacket,
27 ProtoReader::TracePluginResult_Reader &tracePluginResult,
28 bool &haveSplitSeg)
29 {
30 eventParser_->ParseDataItem(tracePacket, tracePluginResult, haveSplitSeg);
31 }
FilterAllEventsReader()32 void HtraceCpuDetailParser::FilterAllEventsReader()
33 {
34 eventParser_->FilterAllEventsReader();
35 }
FilterAllEvents()36 void HtraceCpuDetailParser::FilterAllEvents()
37 {
38 eventParser_->FilterAllEvents();
39 eventParser_->Clear();
40 }
41 } // namespace TraceStreamer
42 } // namespace SysTuning
43