1419b0af8Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 2419b0af8Sopenharmony_ci/* 3419b0af8Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 4419b0af8Sopenharmony_ci */ 5419b0af8Sopenharmony_ci#ifndef __UNIFIED_COLLECTION_DATA__ 6419b0af8Sopenharmony_ci#define __UNIFIED_COLLECTION_DATA__ 7419b0af8Sopenharmony_ci 8419b0af8Sopenharmony_ci#include <linux/ioctl.h> 9419b0af8Sopenharmony_ci 10419b0af8Sopenharmony_ci// kernel struct, modify at the same time 11419b0af8Sopenharmony_cistruct ucollection_process_cpu_item { 12419b0af8Sopenharmony_ci int pid; 13419b0af8Sopenharmony_ci unsigned int thread_total; 14419b0af8Sopenharmony_ci unsigned long long min_flt; 15419b0af8Sopenharmony_ci unsigned long long maj_flt; 16419b0af8Sopenharmony_ci unsigned long long cpu_usage_utime; 17419b0af8Sopenharmony_ci unsigned long long cpu_usage_stime; 18419b0af8Sopenharmony_ci unsigned long long cpu_load_time; 19419b0af8Sopenharmony_ci}; 20419b0af8Sopenharmony_ci 21419b0af8Sopenharmony_cistruct ucollection_process_filter { 22419b0af8Sopenharmony_ci int uid; 23419b0af8Sopenharmony_ci int pid; 24419b0af8Sopenharmony_ci int tid; 25419b0af8Sopenharmony_ci}; 26419b0af8Sopenharmony_ci 27419b0af8Sopenharmony_cistruct ucollection_process_cpu_entry { 28419b0af8Sopenharmony_ci int magic; 29419b0af8Sopenharmony_ci unsigned int total_count; 30419b0af8Sopenharmony_ci unsigned int cur_count; 31419b0af8Sopenharmony_ci struct ucollection_process_filter filter; 32419b0af8Sopenharmony_ci struct ucollection_process_cpu_item datas[]; 33419b0af8Sopenharmony_ci}; 34419b0af8Sopenharmony_ci 35419b0af8Sopenharmony_cistruct ucollection_process_thread_count { 36419b0af8Sopenharmony_ci int pid; 37419b0af8Sopenharmony_ci unsigned int thread_count; 38419b0af8Sopenharmony_ci}; 39419b0af8Sopenharmony_ci 40419b0af8Sopenharmony_cistruct ucollection_thread_cpu_item { 41419b0af8Sopenharmony_ci int tid; 42419b0af8Sopenharmony_ci char name[16]; // 16 : max length of thread name 43419b0af8Sopenharmony_ci unsigned long long cpu_usage_utime; 44419b0af8Sopenharmony_ci unsigned long long cpu_usage_stime; 45419b0af8Sopenharmony_ci unsigned long long cpu_load_time; 46419b0af8Sopenharmony_ci}; 47419b0af8Sopenharmony_ci 48419b0af8Sopenharmony_cistruct ucollection_thread_filter { 49419b0af8Sopenharmony_ci int uid; 50419b0af8Sopenharmony_ci int pid; 51419b0af8Sopenharmony_ci int tid; 52419b0af8Sopenharmony_ci}; 53419b0af8Sopenharmony_ci 54419b0af8Sopenharmony_cistruct ucollection_thread_cpu_entry { 55419b0af8Sopenharmony_ci int magic; 56419b0af8Sopenharmony_ci unsigned int total_count; 57419b0af8Sopenharmony_ci unsigned int cur_count; 58419b0af8Sopenharmony_ci struct ucollection_thread_filter filter; 59419b0af8Sopenharmony_ci struct ucollection_thread_cpu_item datas[]; 60419b0af8Sopenharmony_ci}; 61419b0af8Sopenharmony_ci 62419b0af8Sopenharmony_cienum collection_type { 63419b0af8Sopenharmony_ci COLLECT_ALL_PROC = 1, 64419b0af8Sopenharmony_ci COLLECT_THE_PROC, 65419b0af8Sopenharmony_ci COLLECT_APP_PROC, 66419b0af8Sopenharmony_ci COLLECT_PROC_COUNT, 67419b0af8Sopenharmony_ci COLLECT_THREAD_COUNT, 68419b0af8Sopenharmony_ci COLLECT_APP_THREAD, 69419b0af8Sopenharmony_ci COLLECT_THE_THREAD, 70419b0af8Sopenharmony_ci COLLECT_APP_THREAD_COUNT, 71419b0af8Sopenharmony_ci}; 72419b0af8Sopenharmony_ci 73419b0af8Sopenharmony_ci#define DMIPS_NUM 128 74419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_CPU_BASE 0 75419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_ALL_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_ALL_PROC, \ 76419b0af8Sopenharmony_ci struct ucollection_process_cpu_entry) 77419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_THE_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_PROC, \ 78419b0af8Sopenharmony_ci struct ucollection_process_cpu_entry) 79419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_THREAD_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THREAD_COUNT, \ 80419b0af8Sopenharmony_ci struct ucollection_process_thread_count) 81419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_APP_THREAD_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_APP_THREAD_COUNT, \ 82419b0af8Sopenharmony_ci struct ucollection_process_thread_count) 83419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_APP_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_APP_THREAD, struct ucollection_thread_cpu_entry) 84419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_THE_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_THREAD, struct ucollection_thread_cpu_entry) 85419b0af8Sopenharmony_ci#define IOCTRL_COLLECT_PROC_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_PROC_COUNT, unsigned int) 86419b0af8Sopenharmony_ci#endif // __UNIFIED_COLLECTION_DATA__