mirror of
https://github.com/openharmony/kernel_linux_common_modules.git
synced 2026-08-26 17:16:37 -04:00
@@ -176,7 +176,7 @@ static long ioctrl_collect_thread_count(void __user *argp)
|
||||
}
|
||||
|
||||
static long read_thread_info_locked(struct ucollection_thread_cpu_entry *kentry,
|
||||
struct ucollection_thread_cpu_entry __user *entry)
|
||||
struct ucollection_thread_cpu_entry __user *entry)
|
||||
{
|
||||
rcu_read_lock();
|
||||
if (!is_pid_alive(kentry->filter.pid)) {
|
||||
@@ -218,7 +218,7 @@ static long ioctrl_collect_app_thread_cpu(void __user *argp)
|
||||
(void)copy_from_user(&kentry, entry, sizeof(struct ucollection_thread_cpu_entry));
|
||||
if (current->pid != kentry.filter.pid || kentry.cur_count >= kentry.total_count) {
|
||||
pr_err("pid=%d is not self current:%d , or current count over total count"
|
||||
, kentry.filter.pid, current->pid);
|
||||
, kentry.filter.pid, current->pid);
|
||||
return -EINVAL;
|
||||
}
|
||||
return read_thread_info_locked(&kentry, entry);
|
||||
@@ -236,7 +236,7 @@ static long ioctrl_collect_the_thread_cpu(void __user *argp)
|
||||
(void)copy_from_user(&kentry, entry, sizeof(struct ucollection_thread_cpu_entry));
|
||||
if (kentry.cur_count >= kentry.total_count) {
|
||||
pr_err("pid=%d is not self current:%d , or current count over total count"
|
||||
, kentry.filter.pid, current->pid);
|
||||
, kentry.filter.pid, current->pid);
|
||||
return -EINVAL;
|
||||
}
|
||||
return read_thread_info_locked(&kentry, entry);
|
||||
|
||||
@@ -32,49 +32,49 @@ struct ucollection_process_cpu_entry {
|
||||
};
|
||||
|
||||
struct ucollection_process_thread_count {
|
||||
uint32_t pid;
|
||||
uint32_t thread_count;
|
||||
uint32_t pid;
|
||||
uint32_t thread_count;
|
||||
};
|
||||
|
||||
struct ucollection_thread_cpu_item {
|
||||
int tid;
|
||||
unsigned long long cpu_usage_utime;
|
||||
unsigned long long cpu_usage_stime;
|
||||
unsigned long long cpu_load_time;
|
||||
int tid;
|
||||
unsigned long long cpu_usage_utime;
|
||||
unsigned long long cpu_usage_stime;
|
||||
unsigned long long cpu_load_time;
|
||||
};
|
||||
|
||||
struct ucollection_thread_filter {
|
||||
int uid;
|
||||
int pid;
|
||||
int tid;
|
||||
int uid;
|
||||
int pid;
|
||||
int tid;
|
||||
};
|
||||
|
||||
struct ucollection_thread_cpu_entry {
|
||||
int magic;
|
||||
unsigned int total_count;
|
||||
unsigned int cur_count;
|
||||
struct ucollection_thread_filter filter;
|
||||
struct ucollection_thread_cpu_item datas[];
|
||||
int magic;
|
||||
unsigned int total_count;
|
||||
unsigned int cur_count;
|
||||
struct ucollection_thread_filter filter;
|
||||
struct ucollection_thread_cpu_item datas[];
|
||||
};
|
||||
|
||||
enum collection_type {
|
||||
COLLECT_ALL_PROC = 1,
|
||||
COLLECT_THE_PROC,
|
||||
COLLECT_APP_PROC,
|
||||
COLLECT_PROC_COUNT,
|
||||
COLLECT_THREAD_COUNT,
|
||||
COLLECT_APP_THREAD,
|
||||
COLLECT_THE_THREAD,
|
||||
COLLECT_ALL_PROC = 1,
|
||||
COLLECT_THE_PROC,
|
||||
COLLECT_APP_PROC,
|
||||
COLLECT_PROC_COUNT,
|
||||
COLLECT_THREAD_COUNT,
|
||||
COLLECT_APP_THREAD,
|
||||
COLLECT_THE_THREAD,
|
||||
};
|
||||
|
||||
#define DMIPS_NUM 128
|
||||
#define IOCTRL_COLLECT_CPU_BASE 0
|
||||
#define IOCTRL_COLLECT_ALL_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_ALL_PROC, \
|
||||
struct ucollection_process_cpu_entry)
|
||||
struct ucollection_process_cpu_entry)
|
||||
#define IOCTRL_COLLECT_THE_PROC_CPU _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_PROC, \
|
||||
struct ucollection_process_cpu_entry)
|
||||
struct ucollection_process_cpu_entry)
|
||||
#define IOCTRL_COLLECT_THREAD_COUNT _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THREAD_COUNT, \
|
||||
struct ucollection_process_thread_count)
|
||||
struct ucollection_process_thread_count)
|
||||
#define IOCTRL_COLLECT_APP_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_APP_THREAD, struct ucollection_thread_cpu_entry)
|
||||
#define IOCTRL_COLLECT_THE_THREAD _IOR(IOCTRL_COLLECT_CPU_BASE, COLLECT_THE_THREAD, struct ucollection_thread_cpu_entry)
|
||||
#endif // __UNIFIED_COLLECTION_DATA__
|
||||
Reference in New Issue
Block a user