diff options
Diffstat (limited to 'source/module')
| -rw-r--r-- | source/module/monitor_proc.c | 16 | ||||
| -rw-r--r-- | source/module/monitor_proc.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source/module/monitor_proc.c b/source/module/monitor_proc.c index f7960f8..7678e97 100644 --- a/source/module/monitor_proc.c +++ b/source/module/monitor_proc.c @@ -9,6 +9,7 @@ const char* proc_dir = "variable_monitor"; int def_interval_ns = DEFAULT_INTERVAL_NS; int dump_reset_sec = DEFAULT_DUMP_RESET_SEC; int sample_all = DEFAULT_SAMPLE_ALL; +int stack_capture_mode = STACK_CAPTURE_AGGREGATE; static ssize_t read_proc(struct file *file, char __user *buf, size_t count, loff_t *offset, int *var) { @@ -64,6 +65,15 @@ static ssize_t write_proc_sample_all(struct file *file, loff_t *offset) { return write_proc(file, buf, count, offset, &sample_all); } +static ssize_t read_stack_capture_mode(struct file *file, char __user *buf, + size_t count, loff_t *offset) { + return read_proc(file, buf, count, offset, &stack_capture_mode); +} +static ssize_t write_stack_capture_mode(struct file *file, + const char __user *buf, size_t count, + loff_t *offset) { + return write_proc(file, buf, count, offset, &stack_capture_mode); +} static const struct proc_ops proc_def_interval_ns_ops = { .proc_read = read_proc_def_interval_ns, @@ -80,6 +90,11 @@ static const struct proc_ops proc_sample_all_ops = { .proc_write = write_proc_sample_all, }; +static const struct proc_ops stack_capture_mode_ops = { + .proc_read = read_stack_capture_mode, + .proc_write = write_stack_capture_mode, +}; + int monitor_proc_init(void) { struct proc_dir_entry *dir; @@ -92,6 +107,7 @@ int monitor_proc_init(void) { proc_create("def_interval_ns", 0666, dir, &proc_def_interval_ns_ops); proc_create("dump_reset_sec", 0666, dir, &proc_dump_reset_sec_ops); proc_create("sample_all", 0666, dir, &proc_sample_all_ops); + proc_create("stack_capture_mode", 0666, dir, &stack_capture_mode_ops); return 0; } diff --git a/source/module/monitor_proc.h b/source/module/monitor_proc.h index 8ed4efc..af8f743 100644 --- a/source/module/monitor_proc.h +++ b/source/module/monitor_proc.h @@ -4,10 +4,13 @@ #define DEFAULT_INTERVAL_NS 10000 // 10us #define DEFAULT_DUMP_RESET_SEC 10 // 60s #define DEFAULT_SAMPLE_ALL 0 +#define STACK_CAPTURE_IMMEDIATE 0 +#define STACK_CAPTURE_AGGREGATE 1 extern int def_interval_ns; extern int dump_reset_sec; extern int sample_all; +extern int stack_capture_mode; int monitor_proc_init(void); int monitor_proc_exit(void); |
