static ssize_t sysprof_sample_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[MAX_LONG_DIGITS]; unsigned long val; if (cnt > MAX_LONG_DIGITS-1) cnt = MAX_LONG_DIGITS-1; if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = 0; val = simple_strtoul(buf, NULL, 10); /* * Enforce a minimum sample period of 100 usecs: */ if (val < 100) val = 100; mutex_lock(&sample_timer_lock); stop_stack_timers(); sample_period = val * 1000; start_stack_timers(); mutex_unlock(&sample_timer_lock); return cnt; }
static void start_stack_trace(struct trace_array *tr) { mutex_lock(&sample_timer_lock); tracing_reset_online_cpus(tr); start_stack_timers(); tracer_enabled = 1; mutex_unlock(&sample_timer_lock); }
static int stack_trace_init(struct trace_array *tr) { sysprof_trace = tr; tracing_start_cmdline_record(); mutex_lock(&sample_timer_lock); start_stack_timers(); tracer_enabled = 1; mutex_unlock(&sample_timer_lock); return 0; }