1 /* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 11 * of conditions and the following disclaimer in the documentation and/or other materials 12 * provided with the distribution. 13 * 14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific prior written 16 * permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef _LOS_INFO_PRI_H 32 #define _LOS_INFO_PRI_H 33 34 #include "los_process_pri.h" 35 #include "los_sched_pri.h" 36 37 #ifdef __cplusplus 38 #if __cplusplus 39 extern "C" { 40 #endif /* __cplusplus */ 41 #endif /* __cplusplus */ 42 43 typedef struct TagTaskInfo { 44 UINT32 tid; 45 UINT32 pid; 46 UINT16 status; 47 UINT16 policy; 48 UINT16 priority; 49 #ifdef LOSCFG_KERNEL_SMP 50 UINT16 currCpu; 51 UINT16 cpuAffiMask; 52 #endif 53 UINT32 stackSize; 54 UINTPTR stackPoint; 55 UINTPTR topOfStack; 56 UINT32 waitFlag; 57 UINT32 waitID; 58 VOID *taskMux; 59 UINT32 waterLine; 60 #ifdef LOSCFG_KERNEL_CPUP 61 UINT32 cpup1sUsage; 62 UINT32 cpup10sUsage; 63 UINT32 cpupAllsUsage; 64 #endif 65 CHAR name[OS_TCB_NAME_LEN]; 66 } TaskInfo; 67 68 typedef struct TagProcessInfo { 69 UINT32 pid; 70 UINT32 ppid; 71 UINT16 status; 72 UINT16 mode; 73 UINT32 pgroupID; 74 UINT32 userID; 75 UINT16 policy; 76 UINT32 basePrio; 77 UINT32 threadGroupID; 78 UINT32 threadNumber; 79 #ifdef LOSCFG_KERNEL_VM 80 UINT32 virtualMem; 81 UINT32 shareMem; 82 UINT32 physicalMem; 83 #endif 84 #ifdef LOSCFG_KERNEL_CPUP 85 UINT32 cpup1sUsage; 86 UINT32 cpup10sUsage; 87 UINT32 cpupAllsUsage; 88 #endif 89 CHAR name[OS_PCB_NAME_LEN]; 90 } ProcessInfo; 91 92 typedef struct TagProcessThreadInfo { 93 ProcessInfo processInfo; 94 UINT32 threadCount; 95 TaskInfo taskInfo[LOSCFG_BASE_CORE_TSK_LIMIT]; 96 } ProcessThreadInfo; 97 98 UINT32 OsGetAllProcessInfo(ProcessInfo *pcbArray); 99 100 UINT32 OsGetProcessThreadInfo(UINT32 pid, ProcessThreadInfo *threadInfo); 101 102 #ifdef __cplusplus 103 #if __cplusplus 104 } 105 #endif /* __cplusplus */ 106 #endif /* __cplusplus */ 107 108 #endif /* _LOS_INFO_PRI_H */ 109