1 /* 2 * Copyright (c) 2022 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 TBOX_H 16 #define TBOX_H 17 18 #include <map> 19 #include <sstream> 20 #include <stack> 21 #include <string> 22 #include <vector> 23 24 #include "common_defines.h" 25 #include "common_utils.h" 26 #include "file_util.h" 27 28 namespace OHOS { 29 namespace HiviewDFX { 30 class Tbox { 31 public: 32 Tbox(); 33 ~Tbox(); 34 static std::string CalcFingerPrint(const std::string& val, size_t mask, int mode); 35 static bool GetPartial(const std::string& src, const std::string& res, std::string& des); 36 static bool IsCallStack(std::string& line); 37 static std::string GetStackName(std::string line); 38 static bool HasCausedBy(const std::string& line); 39 static void FilterTrace(std::map<std::string, std::string>& eventInfo); 40 static bool WaitForDoneFile(const std::string& file, unsigned int timeout); 41 42 public: 43 static const std::string ARRAY_STR; 44 static const std::string CAUSEDBY_HEADER; 45 static const std::string SUPPRESSED_HEADER; 46 }; 47 } 48 } 49 #endif /* TBOX_H */ 50