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 SEGMENT_ANALYSIS_ONELAYER_H 16 #define SEGMENT_ANALYSIS_ONELAYER_H 17 #include "segment_analysis.h" 18 namespace OHOS { 19 namespace HiviewDFX { 20 namespace { 21 static const std::string DEFAULT_LAYER_ONE_STACK_MATCH = "\\w+\\+0x[0-9a-f]+/0x[0-9a-f]+"; 22 } 23 // analyze one-layer segments, such as hungtask panic 24 class SegmentAnalysisOneLayer : public SegmentAnalysis { 25 public: SegmentAnalysisOneLayer()26 SegmentAnalysisOneLayer() {} ~SegmentAnalysisOneLayer()27 ~SegmentAnalysisOneLayer() override {} 28 SegmentAnalysisOneLayer(const SegmentAnalysisOneLayer&) = delete; 29 SegmentAnalysisOneLayer& operator=(const SegmentAnalysisOneLayer&) = delete; 30 SegmentAnalysisOneLayer(SegmentAnalysisOneLayer&&) = delete; 31 SegmentAnalysisOneLayer& operator=(SegmentAnalysisOneLayer&&) = delete; 32 33 protected: 34 bool CheckParam(const ParamFeature& feature, const std::vector<std::string>& startSeg) const override; RecordOtherSegment(const ParamFeature & feature,int layerOneId,ParamFeatureIter begin,ParamFeatureIter end)35 void RecordOtherSegment(const ParamFeature& feature, 36 int layerOneId, ParamFeatureIter begin, ParamFeatureIter end) override {} 37 bool GetStartSegment(const std::vector<std::string>& startSeg) override; NeedAnalyzeBlockedChain(void)38 bool NeedAnalyzeBlockedChain(void) const override 39 { 40 return false; 41 } AnalyzeBlockedChain()42 void AnalyzeBlockedChain() override {} GetBlockedChain(void)43 void GetBlockedChain(void) override {} 44 void GetEndStack(const std::vector<std::string>& segStack) override; 45 }; 46 } // namespace HiviewDFX 47 } // namespace OHOS 48 #endif /* SEGMENT_ANALYSIS_ONELAYER_H */ 49