temp save
This commit is contained in:
@@ -33,6 +33,35 @@ static unsigned char w_arg2k_w_arg(void *kptr, watch_arg warg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// static long long convert_to_longlong(void *ptr, int size, char isUnsigned) {
|
||||
// // ptr is null
|
||||
// if (!ptr) {
|
||||
// return 0;
|
||||
// }
|
||||
// switch (size) {
|
||||
// case 1: // 8-bit integer.
|
||||
// if (isUnsigned) {
|
||||
// return (long long)(*(uint8_t*)ptr);
|
||||
// } else {
|
||||
// return (long long)(*(int8_t*)ptr);
|
||||
// }
|
||||
// case 2: // 16-bit integer.
|
||||
// if (isUnsigned) {
|
||||
// return (long long)(*(uint16_t*)ptr);
|
||||
// } else {
|
||||
// return (long long)(*(int16_t*)ptr);
|
||||
// }
|
||||
// case 4: // 32-bit integer.
|
||||
// if (isUnsigned) {
|
||||
// return (long long)(*(uint32_t*)ptr);
|
||||
// } else {
|
||||
// return (long long)(*(int32_t*)ptr);
|
||||
// }
|
||||
// default:
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief kernel_watch_arg to threshold
|
||||
*
|
||||
@@ -46,6 +75,9 @@ static void k_w_arg2threshold(kernel_watch_arg *k_watch_arg,
|
||||
threshold->name[MAX_NAME_LEN + 1] = '\0';
|
||||
threshold->ptr = k_watch_arg->ptr;
|
||||
threshold->threshold = k_watch_arg->threshold;
|
||||
// read true value
|
||||
// threshold->true_value = convert_to_longlong(k_watch_arg->ptr, k_watch_arg->length_byte, k_watch_arg->is_unsigned);
|
||||
|
||||
}
|
||||
|
||||
static void init_mm_tree(mm_tree *mm_tree) {
|
||||
@@ -149,9 +181,9 @@ void diag_task_info_work(struct work_struct *work) {
|
||||
kwarg = &k_watch_timer->k_watch_args[k_watch_timer->threshold_buffer[i]];
|
||||
k_w_arg2threshold(kwarg, &vm_record.threshold_record[i]);
|
||||
}
|
||||
printk(KERN_INFO "-------------------------------------\n");
|
||||
// printk(KERN_INFO "-------------------------------------\n");
|
||||
printk(KERN_INFO "-----------variable monitor----------\n");
|
||||
printk(KERN_INFO "超出阈值:%lld\n", vm_record.tv);
|
||||
printk(KERN_INFO "threshold exceeded, Timestamp %lld:\n", vm_record.tv);
|
||||
|
||||
for (i = 0; i < vm_record.threshold_num; i++) {
|
||||
printk(KERN_INFO "\t: pid: %d, name: %s, ptr: %p, threshold:%lld\n",
|
||||
@@ -160,6 +192,7 @@ void diag_task_info_work(struct work_struct *work) {
|
||||
.name, // Assuming name is a null-terminated string
|
||||
vm_record.threshold_record[i].ptr,
|
||||
vm_record.threshold_record[i].threshold);
|
||||
// vm_record.threshold_record[i].true_value);
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
Reference in New Issue
Block a user