• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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_OPTION_H
17 #define HITRACE_OPTION_H
18 
19 #ifndef __cplusplus
20 #include <sys/types.h>
21 void FilterAppTrace(const char* app, pid_t pid);
22 #else
23 #include <cstdint>
24 #include <string>
25 #include <vector>
26 
27 namespace OHOS {
28 namespace HiviewDFX {
29 namespace Hitrace {
30 
31 constexpr int32_t HITRACE_NO_ERROR = 0;
32 constexpr int32_t HITRACE_SET_PARAM_ERROR = -1;
33 constexpr int32_t HITRACE_WRITE_FILE_ERROR = -2;
34 
35 int32_t SetFilterAppName(const std::string& app);
36 
37 int32_t AddFilterPid(const pid_t pid);
38 
39 int32_t AddFilterPids(const std::vector<std::string>& pids);
40 
41 int32_t ClearFilterPid();
42 
43 extern "C" {
44 void FilterAppTrace(const char* app, pid_t pid);
45 }
46 
47 } // namespace Hitrace
48 } // namespace HiviewDFX
49 } // namespace OHOS
50 #endif // __cplusplus
51 
52 #endif // HITRACE_OPTION_H