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 HIVIEWDFX_HIDEBUG_NATIVE_TYPE_H 17 #define HIVIEWDFX_HIDEBUG_NATIVE_TYPE_H 18 #include <cstdint> 19 20 namespace OHOS { 21 namespace HiviewDFX { 22 23 constexpr int NATIVE_SUCCESS = 0; 24 constexpr int NATIVE_FAIL = -1; 25 26 enum TraceErrorCode { 27 /** Success */ 28 TRACE_SUCCESS = NATIVE_SUCCESS, 29 /** Invalid argument */ 30 TRACE_INVALID_ARGUMENT = 401, 31 /** Have already capture trace */ 32 TRACE_CAPTURED_ALREADY = 11400102, 33 /** No write permission on the file */ 34 TRACE_NO_PERMISSION = 11400103, 35 /** The status of the trace is abnormal */ 36 TRACE_ABNORMAL = 11400104, 37 /** No trace running */ 38 NO_TRACE_RUNNING = 11400105, 39 }; 40 41 struct NativeMemInfo { 42 /** 43 * Process proportional set size memory, in kibibytes 44 */ 45 uint32_t pss = 0; 46 /** 47 * Virtual set size memory, in kibibytes 48 */ 49 uint32_t vss = 0; 50 /** 51 * Resident set size, in kibibytes 52 */ 53 uint32_t rss = 0; 54 /** 55 * The size of the shared dirty memory, in kibibytes 56 */ 57 uint32_t sharedDirty = 0; 58 /** 59 * The size of the private dirty memory, in kibibytes 60 */ 61 uint32_t privateDirty = 0; 62 /** 63 * The size of the shared clean memory, in kibibytes 64 */ 65 uint32_t sharedClean = 0; 66 /** 67 * The size of the private clean memory, in kibibytes 68 */ 69 uint32_t privateClean = 0; 70 }; 71 72 struct MemoryLimitInfo { 73 /** 74 * The limit of the application process's resident set, in kibibytes 75 */ 76 uint64_t rssLimit = 0; 77 /** 78 * The limit of the application process's virtual memory, in kibibytes 79 */ 80 uint64_t vssLimit = 0; 81 }; 82 83 struct SystemMemoryInfo { 84 /** 85 * Total system memory size, in kibibytes 86 */ 87 uint32_t totalMem = 0; 88 /** 89 * System free memory size, in kibibytes 90 */ 91 uint32_t freeMem = 0; 92 /** 93 * System available memory size, in kibibytes 94 */ 95 uint32_t availableMem = 0; 96 }; 97 } 98 } 99 100 #endif // HIVIEWDFX_HIDEBUG_NATIVE_TYPE_H 101