• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 
16 #ifndef DFX_UTIL_H
17 #define DFX_UTIL_H
18 
19 #include <cstdio>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 #include "dfx_define.h"
24 
25 namespace OHOS {
26 namespace HiviewDFX {
27 AT_SYMBOL_HIDDEN bool TrimAndDupStr(const std::string &source, std::string &str);
28 AT_SYMBOL_HIDDEN uint64_t GetTimeMilliSeconds(void);
29 AT_SYMBOL_DEFAULT std::string GetCurrentTimeStr(uint64_t current = 0);
30 AT_SYMBOL_HIDDEN bool ReadDirFiles(const std::string& path, std::vector<std::string>& files);
31 AT_SYMBOL_HIDDEN bool ReadDirFilesByPid(const int& pid, std::vector<std::string>& files);
32 AT_SYMBOL_HIDDEN bool VerifyFilePath(const std::string& filePath, const std::vector<const std::string>& validPaths);
33 AT_SYMBOL_HIDDEN off_t GetFileSize(const int& fd);
34 AT_SYMBOL_HIDDEN int GetStackRange(uintptr_t& stackBottom, uintptr_t& stackTop);
35 } // nameapace HiviewDFX
36 } // nameapace OHOS
37 #endif
38