diff options
| author | zy <[email protected]> | 2023-11-16 18:26:49 +0800 |
|---|---|---|
| committer | zy <[email protected]> | 2023-11-16 18:26:49 +0800 |
| commit | d94f916f2d57d8237a67100e2c4134885f441e1c (patch) | |
| tree | ef61c549fef018d472dd7194770e58ed5a1ed7f3 /source/module/monitor_timer.c | |
| parent | 67b53ae0481872acd30be0541ff679a7f41c376d (diff) | |
fix multiple definition
Diffstat (limited to 'source/module/monitor_timer.c')
| -rw-r--r-- | source/module/monitor_timer.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/source/module/monitor_timer.c b/source/module/monitor_timer.c index ef40d94..96152a3 100644 --- a/source/module/monitor_timer.c +++ b/source/module/monitor_timer.c @@ -1,5 +1,14 @@ #include "monitor_timer.h" +// Global variable +kernel_watch_timer kernel_wtimer_list[MAX_TIMER_NUM] = { + 0}; // all kernel_watch_timer +int kernel_wtimer_num = 0; // current kernel_watch_timer number + +EXPORT_SYMBOL(kernel_wtimer_list); // export kernel_watch_timer_list +EXPORT_SYMBOL(kernel_wtimer_num); // export kernel_watch_timer_num + + #define TIMER_FILLED(timer) ((timer)->sentinel >= TIMER_MAX_WATCH_NUM) #define TIMER_EMPTY(timer) (!((timer)->time_ns | (timer)->sentinel)) #define TIMER_NO_KWARG(timer) ((timer)->sentinel == 0) @@ -113,23 +122,23 @@ enum hrtimer_restart check_variable_cb(struct hrtimer *timer) { int i = 0, j = 0; int buffer[TIMER_MAX_WATCH_NUM]; // Buffer to store the messages - // check all watched kernel_watch_arg - for (i = 0; i < k_watch_timer->sentinel; i++) { - if (read_and_compare(&k_watch_timer->k_watch_args[i])) { - // snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), " - // name: %s, threshold: %lld, pid: %d\n", - // k_watch_timer->k_watch_args[i].name, - // k_watch_timer->k_watch_args[i].threshold, - // k_watch_timer->k_watch_args[i].task_id); - buffer[j] = i; - j++; - - // printk(KERN_INFO "j: name %s, threshold: %lld\n", - // k_watch_timer->k_watch_args[i].name, - // k_watch_timer->k_watch_args[i].threshold); - // printk(KERN_INFO "j: %d\n", j); - } - } + // // check all watched kernel_watch_arg + // for (i = 0; i < k_watch_timer->sentinel; i++) { + // if (read_and_compare(&k_watch_timer->k_watch_args[i])) { + // // snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), " + // // name: %s, threshold: %lld, pid: %d\n", + // // k_watch_timer->k_watch_args[i].name, + // // k_watch_timer->k_watch_args[i].threshold, + // // k_watch_timer->k_watch_args[i].task_id); + // buffer[j] = i; + // j++; + + // // printk(KERN_INFO "j: name %s, threshold: %lld\n", + // // k_watch_timer->k_watch_args[i].name, + // // k_watch_timer->k_watch_args[i].threshold); + // // printk(KERN_INFO "j: %d\n", j); + // } + // } if (j > 0) // if any threshold reached { printk("-------------------------------------\n"); @@ -142,7 +151,7 @@ enum hrtimer_restart check_variable_cb(struct hrtimer *timer) { k_watch_timer->k_watch_args[buffer[i]].threshold, k_watch_timer->k_watch_args[buffer[i]].task_id); } - print_task_stack(); + // print_task_stack(); // restart timer after 1s hrtimer_forward(timer, timer->base->get_time(), ktime_set(1, 0)); //! todo printk("-------------------------------------\n"); |
