capture_immediate adjust print
This commit is contained in:
@@ -141,9 +141,10 @@ static void push_tskinfo_2_sa_buffer(variable_monitor_task *tsk_info,
|
||||
* @param tsk_info
|
||||
* @param flags
|
||||
*/
|
||||
static void push_tskinfo_2_buffer_unlock_orig(variable_monitor_task *tsk_info,
|
||||
unsigned long *flags,
|
||||
struct diag_variant_buffer *buffer) {
|
||||
static void
|
||||
push_tskinfo_2_buffer_unlock_orig(variable_monitor_task *tsk_info,
|
||||
unsigned long *flags,
|
||||
struct diag_variant_buffer *buffer) {
|
||||
variable_monitor_task_system *tsk_info_system;
|
||||
if (tsk_info->task.sys_task == 1) // system task
|
||||
{
|
||||
@@ -162,12 +163,13 @@ static void push_tskinfo_2_buffer_unlock_orig(variable_monitor_task *tsk_info,
|
||||
}
|
||||
|
||||
static void push_tskinfo_2_buffer_unlock(variable_monitor_task *tsk_info,
|
||||
unsigned long *flags) {
|
||||
push_tskinfo_2_buffer_unlock_orig(tsk_info, flags, &load_monitor_variant_buffer);
|
||||
unsigned long *flags) {
|
||||
push_tskinfo_2_buffer_unlock_orig(tsk_info, flags,
|
||||
&load_monitor_variant_buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief diag sign task info
|
||||
* @brief diag sign task info
|
||||
* system task: kernel stack | proc chains
|
||||
* other task(user / unknow): kernel stack | proc chains | raw stack
|
||||
* stack
|
||||
@@ -175,7 +177,8 @@ static void push_tskinfo_2_buffer_unlock(variable_monitor_task *tsk_info,
|
||||
* @param p
|
||||
* @param tsk_info
|
||||
*/
|
||||
static void diag_task_signal(struct task_struct *p, variable_monitor_task *tsk_info) {
|
||||
static void diag_task_signal(struct task_struct *p,
|
||||
variable_monitor_task *tsk_info) {
|
||||
unsigned int nr_bt;
|
||||
// printk(KERN_INFO "diag_task_signal\n");
|
||||
diag_task_brief(p, &tsk_info->task); // task brief
|
||||
@@ -197,7 +200,7 @@ static void diag_task_signal(struct task_struct *p, variable_monitor_task *tsk_i
|
||||
* @param is_print 1 mean print to dmesg
|
||||
*/
|
||||
static void diag_threshold_reached_record(kernel_watch_timer *k_watch_timer,
|
||||
unsigned char is_print) {
|
||||
unsigned char is_print) {
|
||||
|
||||
unsigned long long start_time = ktime_get_real();
|
||||
|
||||
@@ -257,7 +260,8 @@ static void diag_threshold_reached_record(kernel_watch_timer *k_watch_timer,
|
||||
*
|
||||
* @param tgid
|
||||
*/
|
||||
static void diag_task_by_tgid_orig(pid_t tgid, struct diag_variant_buffer *buffer) {
|
||||
static void diag_task_by_tgid_orig(pid_t tgid,
|
||||
struct diag_variant_buffer *buffer) {
|
||||
|
||||
// pr_info("diag_task_by_tgid %d\n", tgid);
|
||||
|
||||
@@ -289,7 +293,8 @@ static void diag_task_by_tgid_orig(pid_t tgid, struct diag_variant_buffer *buffe
|
||||
tsk_info.id = event_id;
|
||||
tsk_info.tv = ktime_get_real();
|
||||
diag_task_signal(t, &tsk_info);
|
||||
push_tskinfo_2_buffer_unlock_orig(&tsk_info, &flags, buffer); // push to buffer
|
||||
push_tskinfo_2_buffer_unlock_orig(&tsk_info, &flags,
|
||||
buffer); // push to buffer
|
||||
}
|
||||
diag_variant_buffer_spin_unlock(buffer, flags);
|
||||
rcu_read_unlock();
|
||||
@@ -336,9 +341,8 @@ void diag_task_all(void) {
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
|
||||
void diag_task_by_tsk(struct task_struct *tsk,
|
||||
struct diag_variant_buffer *buffer) {
|
||||
struct diag_variant_buffer *buffer) {
|
||||
unsigned long flags;
|
||||
|
||||
static variable_monitor_task tsk_info;
|
||||
@@ -353,7 +357,8 @@ void diag_task_by_tsk(struct task_struct *tsk,
|
||||
tsk_info.tv = ktime_get_real();
|
||||
diag_task_signal(tsk, &tsk_info);
|
||||
|
||||
push_tskinfo_2_buffer_unlock_orig(&tsk_info, &flags, buffer); // push to buffer
|
||||
push_tskinfo_2_buffer_unlock_orig(&tsk_info, &flags,
|
||||
buffer); // push to buffer
|
||||
|
||||
diag_variant_buffer_spin_unlock(buffer, flags);
|
||||
rcu_read_unlock();
|
||||
@@ -377,12 +382,6 @@ void diag_task(kernel_watch_timer *k_watch_timer) {
|
||||
// pr_info("diag_stack, sample threshold reached\n");
|
||||
diag_task_by_tgid_orig(k_watch_timer->task->tgid,
|
||||
&load_monitor_variant_buffer);
|
||||
// int i;
|
||||
// kernel_watch_arg *kwarg;
|
||||
// for (i = 0; i < k_watch_timer->threshold_over_count; i++) {
|
||||
// kwarg = &k_watch_timer->k_watch_args[k_watch_timer->threshold_buffer[i]];
|
||||
// diag_task_by_tgid_orig(kwarg->task_id, &load_monitor_variant_buffer);
|
||||
// }
|
||||
}
|
||||
// pr_info("diag_stack, finish tv %lld\n", ktime_get_real());
|
||||
}
|
||||
@@ -525,13 +524,13 @@ void clear_watch(pid_t pid) {
|
||||
|
||||
/**
|
||||
* @brief for ipi call
|
||||
*
|
||||
* @param info
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
static void capture_immediate_diag_ipi(void *info) {
|
||||
struct task_struct *tsk = current;
|
||||
struct diag_variant_buffer *buffer =
|
||||
&stand_alone_buffer; //! todo change to global buffer
|
||||
struct diag_variant_buffer *buffer = &load_monitor_variant_buffer;
|
||||
|
||||
diag_task_by_tsk(tsk, buffer);
|
||||
}
|
||||
|
||||
@@ -550,6 +549,11 @@ static int capture_immediate_entry(kernel_watch_timer *k_watch_timer) {
|
||||
if (read_and_compare(kwarg->kptr, kwarg->length_byte,
|
||||
kwarg->above_threshold, kwarg->is_unsigned,
|
||||
kwarg->threshold)) {
|
||||
// k_watch_timer->tv = ktime_get_real();
|
||||
kwarg->true_value = convert_to_longlong(kwarg->kptr, kwarg->length_byte,
|
||||
kwarg->is_unsigned);
|
||||
k_watch_timer->threshold_over_count = 1;
|
||||
diag_threshold_reached_record(k_watch_timer, 1);
|
||||
// some value reached threshold
|
||||
// if task run on cpu, call ipi immediately
|
||||
if (k_watch_timer->task->on_cpu) {
|
||||
@@ -558,6 +562,7 @@ static int capture_immediate_entry(kernel_watch_timer *k_watch_timer) {
|
||||
} else {
|
||||
diag_task_by_tsk(k_watch_timer->task, &load_monitor_variant_buffer);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#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
|
||||
#define STACK_CAPTURE_AGGREGATE 0
|
||||
#define STACK_CAPTURE_IMMEDIATE 1
|
||||
|
||||
extern int def_interval_ns;
|
||||
extern int dump_reset_sec;
|
||||
|
||||
Reference in New Issue
Block a user