summaryrefslogtreecommitdiff
path: root/source/module
diff options
context:
space:
mode:
authorzy <[email protected]>2023-11-27 04:21:47 -0500
committerzy <[email protected]>2023-11-27 04:21:47 -0500
commit7e3b4ded0ccfe149a96aec009836bcb35293fb63 (patch)
tree91174e3ddef6bc0133b5f5eaab5a6124701fd2a2 /source/module
parenta56fa77dc824132c8df064c3398414ffaa0eedc6 (diff)
watch_arg: greater_flag -> above_threshold
Diffstat (limited to 'source/module')
-rw-r--r--source/module/monitor_kernel.c1
-rw-r--r--source/module/monitor_kernel_lib.c4
-rw-r--r--source/module/monitor_mem.c4
-rw-r--r--source/module/monitor_mem.h2
-rw-r--r--source/module/monitor_timer.h4
5 files changed, 8 insertions, 7 deletions
diff --git a/source/module/monitor_kernel.c b/source/module/monitor_kernel.c
index fd26828..2e6e35c 100644
--- a/source/module/monitor_kernel.c
+++ b/source/module/monitor_kernel.c
@@ -67,6 +67,7 @@ static long device_ioctl(struct file *file, unsigned int ioctl_num,
"time_ns=%ld, threshold=%lld\n",
warg.task_id, warg.name, warg.ptr, warg.length_byte, warg.time_ns,
warg.threshold);
+ warg.time_ns = warg.time_ns == 0 ? 10000 : warg.time_ns; // default 10us
// start watch variable
start_watch_variable(warg);
break;
diff --git a/source/module/monitor_kernel_lib.c b/source/module/monitor_kernel_lib.c
index f7032f1..2d12ef6 100644
--- a/source/module/monitor_kernel_lib.c
+++ b/source/module/monitor_kernel_lib.c
@@ -29,7 +29,7 @@ static unsigned char w_arg2k_w_arg(void *kptr, watch_arg warg,
k_watch_arg->length_byte = warg.length_byte;
k_watch_arg->threshold = warg.threshold;
k_watch_arg->unsigned_flag = warg.unsigned_flag;
- k_watch_arg->greater_flag = warg.greater_flag;
+ k_watch_arg->above_threshold = warg.above_threshold;
return 0;
}
@@ -296,7 +296,7 @@ enum hrtimer_restart check_variable_cb(struct hrtimer *timer) {
// check all watched kernel_watch_arg
for (i = 0; i < k_watch_timer->sentinel; i++) {
kwarg = &k_watch_timer->k_watch_args[i];
- if (read_and_compare(kwarg->kptr, kwarg->length_byte, kwarg->greater_flag,
+ if (read_and_compare(kwarg->kptr, kwarg->length_byte, kwarg->above_threshold,
kwarg->unsigned_flag, kwarg->threshold)) {
k_watch_timer->threshold_buffer[j] = i;
j++;
diff --git a/source/module/monitor_mem.c b/source/module/monitor_mem.c
index 17375a0..e2dc096 100644
--- a/source/module/monitor_mem.c
+++ b/source/module/monitor_mem.c
@@ -161,7 +161,7 @@ static int func_indices[2][9] = {{0, 0, 1, 0, 2, 0, 0, 0, 3},
/// @brief read k_arg->kptr and compare with threshold
/// @param k_arg
/// @return result of compare
-unsigned char read_and_compare(void *ptr, int len, unsigned char greater_flag,
+unsigned char read_and_compare(void *ptr, int len, unsigned char above_threshold,
unsigned char is_unsigned, long long threshold) {
unsigned char result = 0;
@@ -177,7 +177,7 @@ unsigned char read_and_compare(void *ptr, int len, unsigned char greater_flag,
// %d \n", k_arg->name, *(int *)ptr,
// threshold, result);
- if (greater_flag)
+ if (above_threshold)
return result;
else
return !result;
diff --git a/source/module/monitor_mem.h b/source/module/monitor_mem.h
index 391c609..394d900 100644
--- a/source/module/monitor_mem.h
+++ b/source/module/monitor_mem.h
@@ -23,5 +23,5 @@ void *convert_user_space_ptr(pid_t pid, unsigned long kaddr);
void free_page_list(pid_t task_id);
void free_all_page_list(void);
-unsigned char read_and_compare(void *ptr, int len, unsigned char greater_flag,
+unsigned char read_and_compare(void *ptr, int len, unsigned char above_threshold,
unsigned char is_unsigned, long long threshold);
diff --git a/source/module/monitor_timer.h b/source/module/monitor_timer.h
index 3253ba9..3db413e 100644
--- a/source/module/monitor_timer.h
+++ b/source/module/monitor_timer.h
@@ -12,7 +12,7 @@ typedef struct {
int length_byte; // byte
long long threshold; // threshold value
unsigned char unsigned_flag; // unsigned flag (true: unsigned, false: signed)
- unsigned char greater_flag; // reverse flag (true: >, false: <)
+ unsigned char above_threshold; // reverse flag (true: >, false: <)
unsigned long time_ns; // timer interval (ns)
} watch_arg;
@@ -24,7 +24,7 @@ typedef struct {
int length_byte; // byte
long long threshold; // threshold value
unsigned char unsigned_flag; // unsigned flag (true: unsigned, false: signed)
- unsigned char greater_flag; // reverse flag (true: >, false: <)
+ unsigned char above_threshold; // reverse flag (true: >, false: <)
} kernel_watch_arg;
typedef struct {