• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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 HITRACE_COMMON_UTILS_H
17 #define HITRACE_COMMON_UTILS_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 namespace Hitrace {
24 std::string CanonicalizeSpecPath(const char* src);
25 
26 bool MarkClockSync(const std::string& traceRootPath);
27 
28 bool IsNumber(const std::string& str);
29 
30 int GetCpuProcessors();
31 
32 void ReadCurrentCpuFrequencies(std::string& freqs);
33 
34 std::string GetPropertyInner(const std::string& property, const std::string& value);
35 
36 bool SetPropertyInner(const std::string& property, const std::string& value);
37 
38 bool IsHmKernel();
39 
40 bool IsDeveloperMode();
41 
42 bool IsRootVersion();
43 
44 bool IsTraceMounted(std::string& traceRootPath);
45 
46 std::string GetFilePath(const std::string& fileName, const std::string& traceRootPath);
47 
48 std::string ReadFileInner(const std::string& filename);
49 
50 std::string ReadFile(const std::string& filename, const std::string& traceRootPath);
51 
52 bool IsTracingOn(const std::string& traceRootPath);
53 
54 bool StringToInt(const std::string &str, int &val);
55 
56 bool StringToInt64(const std::string &str, int64_t &val);
57 
58 bool StringToUint64(const std::string &str, uint64_t &val);
59 
60 bool StringToDouble(const std::string &str, double &val);
61 
62 constexpr int DECIMAL_SCALE = 10;
63 } // namespace Hitrace
64 } // namespace HiviewDFX
65 } // namespace OHOS
66 #endif // HITRACE_COMMON_UTILS_H