1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2023 Huawei Device Co., Ltd. 4 */ 5 #ifndef __UNIFIED_COLLECTION_DATA__ 6 #define __UNIFIED_COLLECTION_DATA__ 7 8 #include <linux/ioctl.h> 9 10 // kernel struct, modify at the same time 11 struct ucollection_process_cpu_item { 12 int pid; 13 unsigned int thread_total; 14 unsigned long long min_flt; 15 unsigned long long maj_flt; 16 unsigned long long cpu_usage_utime; 17 unsigned long long cpu_usage_stime; 18 unsigned long long cpu_load_time; 19 }; 20 21 struct ucollection_process_filter { 22 int uid; 23 int pid; 24 int tid; 25 }; 26 27 struct ucollection_process_cpu_entry { 28 int magic; 29 unsigned int total_count; 30 unsigned int cur_count; 31 struct ucollection_process_filter filter; 32 struct ucollection_process_cpu_item datas[]; 33 }; 34 35 struct ucollection_process_thread_count { 36 int pid; 37 unsigned int thread_count; 38 }; 39 40 struct ucollection_thread_cpu_item { 41 int tid; 42 unsigned long long cpu_usage_utime; 43 unsigned long long cpu_usage_stime; 44 unsigned long long cpu_load_time; 45 }; 46 47 struct ucollection_thread_filter { 48 int uid; 49 int pid; 50 int tid; 51 }; 52 53 struct ucollection_thread_cpu_entry { 54 int magic; 55 unsigned int total_count; 56 unsigned int cur_count; 57 struct ucollection_thread_filter filter; 58 struct ucollection_thread_cpu_item datas[]; 59 }; 60 61 enum collection_type { 62 COLLECT_ALL_PROC = 1, 63 COLLECT_THE_PROC, 64 COLLECT_APP_PROC, 65 COLLECT_PROC_COUNT, 66 COLLECT_THREAD_COUNT, 67 COLLECT_APP_THREAD, 68 COLLECT_THE_THREAD, 69 COLLECT_APP_THREAD_COUNT, 70 }; 71 72 #define DMIPS_NUM 128 73 #define IOCTRL_COLLECT_CPU_BASE 0 74 #define IOCTRL_COLLECT_ALL_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_ALL_PROC, \ 75 struct ucollection_process_cpu_entry) 76 #define IOCTRL_COLLECT_THE_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_PROC, \ 77 struct ucollection_process_cpu_entry) 78 #define IOCTRL_COLLECT_THREAD_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THREAD_COUNT, \ 79 struct ucollection_process_thread_count) 80 #define IOCTRL_COLLECT_APP_THREAD_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_APP_THREAD_COUNT, \ 81 struct ucollection_process_thread_count) 82 #define IOCTRL_COLLECT_APP_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_APP_THREAD, struct ucollection_thread_cpu_entry) 83 #define IOCTRL_COLLECT_THE_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_THREAD, struct ucollection_thread_cpu_entry) 84 #define IOCTRL_COLLECT_PROC_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_PROC_COUNT, unsigned int) 85 #endif // __UNIFIED_COLLECTION_DATA__