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