1 /* 2 * Copyright (c) 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 HIVIEWDFX_HIDEBUG_TYPE_H 17 #define HIVIEWDFX_HIDEBUG_TYPE_H 18 /** 19 * @addtogroup HiDebug 20 * @{ 21 * 22 * @brief Provides debug code define. 23 * 24 * For example, you can use these code for check result or parameter of HiDebug function. 25 * 26 * @since 12 27 */ 28 29 /** 30 * @file hideug_type.h 31 * 32 * @brief Defines the code of the HiDebug module. 33 * 34 * @kit PerformanceAnalysisKit 35 * @library libohhidebug.so 36 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug 37 * @since 12 38 */ 39 40 #include <stdint.h> 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif // __cplusplus 45 46 /** 47 * @brief Defines error code 48 * 49 * @since 12 50 */ 51 typedef enum HiDebug_ErrorCode { 52 /** Success */ 53 HIDEBUG_SUCCESS = 0, 54 /** Invalid argument */ 55 HIDEBUG_INVALID_ARGUMENT = 401, 56 /** Have already capture trace */ 57 HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102, 58 /** No write permission on the file */ 59 HIDEBUG_NO_PERMISSION = 11400103, 60 /** The status of the trace is abnormal */ 61 HIDEBUG_TRACE_ABNORMAL = 11400104, 62 /** No trace running */ 63 HIDEBUG_NO_TRACE_RUNNING = 11400105 64 } HiDebug_ErrorCode; 65 66 /** 67 * @brief Defines application cpu usage of all threads structure type. 68 * 69 * @since 12 70 */ 71 typedef struct HiDebug_ThreadCpuUsage { 72 /** 73 * Thread id 74 */ 75 uint32_t threadId; 76 /** 77 * Cpu usage of thread 78 */ 79 double cpuUsage; 80 /** 81 * Next thread cpu usage 82 */ 83 struct HiDebug_ThreadCpuUsage *next; 84 } HiDebug_ThreadCpuUsage; 85 86 /** 87 * @brief Defines pointer of HiDebug_ThreadCpuUsage. 88 * 89 * @since 12 90 */ 91 typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; 92 93 /** 94 * @brief Defines system memory information structure type. 95 * 96 * @since 12 97 */ 98 typedef struct HiDebug_SystemMemInfo { 99 /** 100 * Total system memory size, in kibibytes 101 */ 102 uint32_t totalMem; 103 /** 104 * System free memory size, in kibibytes 105 */ 106 uint32_t freeMem; 107 /** 108 * System available memory size, in kibibytes 109 */ 110 uint32_t availableMem; 111 } HiDebug_SystemMemInfo; 112 113 /** 114 * @brief Defines application process native memory information structure type. 115 * 116 * @since 12 117 */ 118 typedef struct HiDebug_NativeMemInfo { 119 /** 120 * Process proportional set size memory, in kibibytes 121 */ 122 uint32_t pss; 123 /** 124 * Virtual set size memory, in kibibytes 125 */ 126 uint32_t vss; 127 /** 128 * Resident set size, in kibibytes 129 */ 130 uint32_t rss; 131 /** 132 * The size of the shared dirty memory, in kibibytes 133 */ 134 uint32_t sharedDirty; 135 /** 136 * The size of the private dirty memory, in kibibytes 137 */ 138 uint32_t privateDirty; 139 /** 140 * The size of the shared clean memory, in kibibytes 141 */ 142 uint32_t sharedClean; 143 /** 144 * The size of the private clean memory, in kibibytes 145 */ 146 uint32_t privateClean; 147 } HiDebug_NativeMemInfo; 148 149 /** 150 * @brief Defines application process memory limit structure type. 151 * 152 * @since 12 153 */ 154 typedef struct HiDebug_MemoryLimit { 155 /** 156 * The limit of the application process's resident set, in kibibytes 157 */ 158 uint64_t rssLimit; 159 /** 160 * The limit of the application process's virtual memory, in kibibytes 161 */ 162 uint64_t vssLimit; 163 } HiDebug_MemoryLimit; 164 165 /** 166 * @brief Enum for trace flag. 167 * 168 * @since 12 169 */ 170 typedef enum HiDebug_TraceFlag { 171 /** Only capture main thread trace */ 172 HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1, 173 /** Capture all thread trace */ 174 HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 175 } HiDebug_TraceFlag; 176 #ifdef __cplusplus 177 } 178 #endif // __cplusplus 179 180 /** 181 * @brief FFRT tasks. 182 * 183 * @since 12 184 */ 185 #define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) 186 /** 187 * @brief Common library subsystem tag. 188 * 189 * @since 12 190 */ 191 #define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) 192 /** 193 * @brief HDF subsystem tag. 194 * 195 * @since 12 196 */ 197 #define HIDEBUG_TRACE_TAG_HDF (1ULL << 18) 198 /** 199 * @brief Net tag. 200 * 201 * @since 12 202 */ 203 #define HIDEBUG_TRACE_TAG_NET (1ULL << 23) 204 /** 205 * @brief NWeb tag. 206 * 207 * @since 12 208 */ 209 #define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) 210 /** 211 * @brief Distributed audio tag. 212 * 213 * @since 12 214 */ 215 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) 216 /** 217 * @brief File management tag. 218 * 219 * @since 12 220 */ 221 #define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) 222 /** 223 * @brief OHOS generic tag. 224 * 225 * @since 12 226 */ 227 #define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) 228 /** 229 * @brief Ability Manager tag. 230 * 231 * @since 12 232 */ 233 #define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) 234 /** 235 * @brief Camera module tag. 236 * 237 * @since 12 238 */ 239 #define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) 240 /** 241 * @brief Media module tag. 242 * 243 * @since 12 244 */ 245 #define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) 246 /** 247 * @brief Image module tag. 248 * 249 * @since 12 250 */ 251 #define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) 252 /** 253 * @brief Audio module tag. 254 * 255 * @since 12 256 */ 257 #define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) 258 /** 259 * @brief Distributed data manager module tag. 260 * 261 * @since 12 262 */ 263 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) 264 /** 265 * @brief Graphics module tag. 266 * 267 * @since 12 268 */ 269 #define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) 270 /** 271 * @brief ARKUI development framework tag. 272 * 273 * @since 12 274 */ 275 #define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) 276 /** 277 * @brief Notification module tag. 278 * 279 * @since 12 280 */ 281 #define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) 282 /** 283 * @brief MISC module tag. 284 * 285 * @since 12 286 */ 287 #define HIDEBUG_TRACE_TAG_MISC (1ULL << 41) 288 /** 289 * @brief Multimodal input module tag. 290 * 291 * @since 12 292 */ 293 #define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) 294 /** 295 * @brief RPC tag. 296 * 297 * @since 12 298 */ 299 #define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) 300 /** 301 * @brief ARK tag. 302 * 303 * @since 12 304 */ 305 #define HIDEBUG_TRACE_TAG_ARK (1ULL << 47) 306 /** 307 * @brief Window manager tag. 308 * 309 * @since 12 310 */ 311 #define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) 312 /** 313 * @brief Distributed screen tag. 314 * 315 * @since 12 316 */ 317 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) 318 /** 319 * @brief Distributed camera tag. 320 * 321 * @since 12 322 */ 323 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) 324 /** 325 * @brief Distributed hardware framework tag. 326 * 327 * @since 12 328 */ 329 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) 330 /** 331 * @brief Global resource manager tag. 332 * 333 * @since 12 334 */ 335 #define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) 336 /** 337 * @brief Distributed hardware device manager tag. 338 * 339 * @since 12 340 */ 341 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) 342 /** 343 * @brief SA tag. 344 * 345 * @since 12 346 */ 347 #define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) 348 /** 349 * @brief Power manager tag. 350 * 351 * @since 12 352 */ 353 #define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) 354 /** 355 * @brief Distributed scheduler tag. 356 * 357 * @since 12 358 */ 359 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) 360 /** 361 * @brief Distributed input tag. 362 * 363 * @since 12 364 */ 365 #define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) 366 /** 367 * @brief bluetooth tag. 368 * 369 * @since 12 370 */ 371 #define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) 372 373 /** @} */ 374 375 #endif // HIVIEWDFX_HIDEBUG_TYPE_H