diff --git a/source/module/monitor_kernel_lib.c b/source/module/monitor_kernel_lib.c index d962ca5..d85087e 100644 --- a/source/module/monitor_kernel_lib.c +++ b/source/module/monitor_kernel_lib.c @@ -132,13 +132,21 @@ static void push_tskinfo_2_buffer(variable_monitor_task *tsk_info, diag_variant_buffer_spin_unlock(&load_monitor_variant_buffer, *flags); } -static void push_tskinfo_22_buffer(variable_monitor_task *tsk_info, - unsigned long *flags) { - diag_variant_buffer_reserve(&load_monitor_variant_buffer, - sizeof(variable_monitor_task)); - diag_variant_buffer_write_nolock(&load_monitor_variant_buffer, tsk_info, - sizeof(variable_monitor_task)); - diag_variant_buffer_seal(&load_monitor_variant_buffer); +static void push_tskinfo_22_buffer(variable_monitor_task *tsk_info, unsigned long *flags){ + variable_monitor_task_system *tsk_info_system; + if (tsk_info->task.sys_task == 0) // system task + { + tsk_info_system = (variable_monitor_task_system *)tsk_info; + diag_variant_buffer_reserve(&load_monitor_variant_buffer, sizeof(variable_monitor_task_system)); + diag_variant_buffer_write_nolock(&load_monitor_variant_buffer, tsk_info_system, + sizeof(variable_monitor_task_system)); + diag_variant_buffer_seal(&load_monitor_variant_buffer); + } + else { + diag_variant_buffer_reserve(&load_monitor_variant_buffer, sizeof(variable_monitor_task)); + diag_variant_buffer_write_nolock(&load_monitor_variant_buffer, tsk_info, sizeof(variable_monitor_task)); + diag_variant_buffer_seal(&load_monitor_variant_buffer); + } } /// @brief clear all watch and reset kernel_wtimer_list/kernel_wtimer_num diff --git a/source/module/monitor_trace.h b/source/module/monitor_trace.h index 98edf9c..9ec2fe8 100644 --- a/source/module/monitor_trace.h +++ b/source/module/monitor_trace.h @@ -22,6 +22,7 @@ // dump type #define VARIABLE_MONITOR_RECORD_TYPE 0x0 #define VARIABLE_MONITOR_TASK_TYPE 0x1 +#define VARIABLE_MONITOR_TASK_TYPE_SYSTEM 0x2 typedef struct { pid_t task_id; // current process id @@ -102,6 +103,14 @@ typedef struct { raw_stack_detail raw_stack; } variable_monitor_task; // main struct +typedef struct { + int et_type; + unsigned long id; + unsigned long long tv; + task_detail task; // brief + kern_stack_detail kern_stack; // kernel stack +} variable_monitor_task_system; + typedef struct { struct radix_tree_root mm_tree; spinlock_t mm_tree_lock; diff --git a/source/ucli/ucli.cc b/source/ucli/ucli.cc index 64fff5d..f00b434 100644 --- a/source/ucli/ucli.cc +++ b/source/ucli/ucli.cc @@ -91,6 +91,7 @@ static int task_info_extract(void *buf, unsigned int len, void *) { int *et_type; variable_monitor_record *vm_record; variable_monitor_task *tsk_info; + variable_monitor_task_system *tsk_info_system; struct load_monitor_cpu_run *cpu_run; static int seq = 0; @@ -151,8 +152,26 @@ static int task_info_extract(void *buf, unsigned int len, void *) { printf("#* 0xffffffffffffff %s (UNKNOWN)\n", tsk_info->task.comm); diag_printf_proc_chains(&tsk_info->proc_chains); printf("##\n"); + break; + case VARIABLE_MONITOR_TASK_TYPE_SYSTEM: + if (len < sizeof(variable_monitor_task_system)) + break; + tsk_info_system = (variable_monitor_task_system *)buf; + seq++; + + printf("##CGROUP:[%s] %d [%03d] [%s] state: %d\n", + tsk_info_system->task.cgroup_buf, tsk_info_system->task.pid, seq, + state_str(tsk_info_system->task.state).c_str(),tsk_info_system->task.state); + + printk_task_brief(&tsk_info_system->task); + // system task no need print raw_stack + diag_printf_kern_stack(&tsk_info_system->kern_stack); + printf("#* 0xffffffffffffff %s (UNKNOWN)\n", tsk_info_system->task.comm); + // diag_printf_proc_chains(&tsk_info_system->proc_chains); + printf("##\n"); break; + default: break; } diff --git a/source/ucli/ucli.h b/source/ucli/ucli.h index a8fbb21..c2a65bd 100644 --- a/source/ucli/ucli.h +++ b/source/ucli/ucli.h @@ -15,6 +15,7 @@ // dump type #define VARIABLE_MONITOR_RECORD_TYPE 0x0 #define VARIABLE_MONITOR_TASK_TYPE 0x1 +#define VARIABLE_MONITOR_TASK_TYPE_SYSTEM 0x2 #define DEVICE "/dev/variable_monitor" #define DEVICE_BAK "/host/dev/variable_monitor" @@ -108,6 +109,14 @@ typedef struct { raw_stack_detail raw_stack; } variable_monitor_task; +typedef struct { + int et_type; + unsigned long id; + unsigned long long tv; + task_detail task; // brief + kern_stack_detail kern_stack; // kernel stack +} variable_monitor_task_system; + #define DIAG_VARIANT_BUFFER_HEAD_MAGIC_SEALED 197612031122 #define DIAG_VARIANT_BUFFER_HEAD_MAGIC_UNSEALED 197612031234