summaryrefslogtreecommitdiff
path: root/source/module/monitor_timer.c
diff options
context:
space:
mode:
authorzy <[email protected]>2023-11-16 21:15:51 -0500
committerzy <[email protected]>2023-11-16 21:15:51 -0500
commitd30b761d039602fb0801423f7058afd709d89bf6 (patch)
tree68aa2463ec2e3386e2f5f833d9371280c5415661 /source/module/monitor_timer.c
parent6397e0da75473c75a15695dbf8b27b3dac43fe07 (diff)
check_variable_cb move to lib.c
Diffstat (limited to 'source/module/monitor_timer.c')
-rw-r--r--source/module/monitor_timer.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/source/module/monitor_timer.c b/source/module/monitor_timer.c
index 2bef95d..dbc57ea 100644
--- a/source/module/monitor_timer.c
+++ b/source/module/monitor_timer.c
@@ -115,53 +115,6 @@ unsigned char timer_del_watch_by_pid(kernel_watch_timer *timer, pid_t pid) {
return 0;
}
-/// @brief hrTimer handler
-enum hrtimer_restart check_variable_cb(struct hrtimer *timer) {
- kernel_watch_timer *k_watch_timer =
- container_of(timer, kernel_watch_timer, hr_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);
- // }
- // }
- if (j > 0) // if any threshold reached
- {
- printk("-------------------------------------\n");
- printk("-------------watch monitor-----------\n");
- printk("Threshold reached:\n");
-
- for (i = 0; i < j; i++) {
- printk(" name: %s, threshold: %lld, pid: %d\n",
- k_watch_timer->k_watch_args[buffer[i]].name, //! todo
- k_watch_timer->k_watch_args[buffer[i]].threshold,
- k_watch_timer->k_watch_args[buffer[i]].task_id);
- }
- // print_task_stack();
- // restart timer after 1s
- hrtimer_forward(timer, timer->base->get_time(), ktime_set(1, 0)); //! todo
- printk("-------------------------------------\n");
- } else {
- // keep frequency
- hrtimer_forward(timer, timer->base->get_time(), k_watch_timer->kt);
- }
- return HRTIMER_RESTART; // restart timer
-}
-
/// @brief start hrTimer
/// @param timeout: timeout in us
/// @return 0 is success