This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-variable-monitor/source/module/monitor_kernel.h

46 lines
1.4 KiB
C
Raw Normal View History

2023-11-16 17:39:26 +08:00
#include "monitor_kallsyms.h"
#include "monitor_mem.h"
2023-11-27 22:22:30 -05:00
#include "monitor_proc.h"
2023-11-16 17:39:26 +08:00
#include "monitor_timer.h"
#include "monitor_trace.h"
2023-12-13 03:17:52 -05:00
#include "monitor_perf.h"
2023-11-16 13:17:49 +08:00
2023-12-05 00:48:37 -05:00
#include <linux/ioctl.h> // for ioctl
2023-11-27 20:59:18 -05:00
// ioctl
2023-12-05 00:48:37 -05:00
#define IOCTL_MAGIC_NUMBER 'k'
2023-11-27 20:51:25 -05:00
#define IOCTL_WATCH_VARIABLE 0
#define IOCTL_DUMP_LOG 1
2023-12-05 00:48:37 -05:00
#define IOCTL_PID _IOWR(IOCTL_MAGIC_NUMBER, 2, int)
2023-12-05 02:42:07 -05:00
#define IOCTL_TGID _IOWR(IOCTL_MAGIC_NUMBER, 3, int)
2023-12-12 04:05:56 -05:00
#define IOCTL_DUMP_LOG_SA _IOWR(IOCTL_MAGIC_NUMBER, 4, int)
2023-11-27 20:51:25 -05:00
2023-11-27 22:22:30 -05:00
// default value
extern int def_interval_ns;
extern int dump_reset_sec;
2023-11-16 17:39:26 +08:00
extern mm_tree mm_tree_struct;
2023-11-27 15:16:35 +08:00
extern struct diag_variant_buffer load_monitor_variant_buffer; // global buffer
2023-12-12 04:05:56 -05:00
#define VARIABLE_MONITOR_BUFFER_SIZE 256 * 1024 * 1024 // 256MB
extern struct diag_variant_buffer stand_alone_buffer; // buffer for single work
#define STAND_ALONE_BUFFER_SIZE 50 * 1024 * 1024 // 50 MB
2023-11-16 13:17:49 +08:00
2023-12-19 22:29:11 -05:00
// for buffer
int dump_log(ioctl_dump_param *dump_param, unsigned long ioctl_param,
struct diag_variant_buffer *buffer);
2023-11-27 22:22:30 -05:00
int monitor_init(void); // monitor init
2023-11-27 15:16:35 +08:00
void monitor_exit(void); // monitor exit
2023-11-16 13:17:49 +08:00
2023-11-27 15:16:35 +08:00
int start_watch_variable(watch_arg warg); // for open
2023-11-27 22:22:30 -05:00
void clear_watch(pid_t pid); // for release
2023-11-16 21:15:51 -05:00
2023-11-27 22:22:30 -05:00
enum hrtimer_restart
check_variable_cb(struct hrtimer *timer); // hrtimer callback
2023-11-23 00:29:21 -05:00
2023-12-14 02:22:17 -05:00
// for test
2023-12-12 04:05:56 -05:00
int diag_pid(int id); // for test
2023-12-14 02:22:17 -05:00
int diag_tgid(int id); // for test
2023-12-14 06:24:38 -05:00
void diag_task(kernel_watch_timer *k_watch_timer);
2023-12-14 02:22:17 -05:00
void diag_task_all(void);
void diag_task_by_tgid(pid_t tgid);