コード例 #1
0
ファイル: trace_selftest.c プロジェクト: AlexShiLucky/linux
/*
 * Pretty much the same than for the function tracer from which the selftest
 * has been borrowed.
 */
__init int
trace_selftest_startup_function_graph(struct tracer *trace,
					struct trace_array *tr)
{
	int ret;
	unsigned long count;

#ifdef CONFIG_DYNAMIC_FTRACE
	if (ftrace_filter_param) {
		printk(KERN_CONT " ... kernel command line filter set: force PASS ... ");
		return 0;
	}
#endif

	/*
	 * Simulate the init() callback but we attach a watchdog callback
	 * to detect and recover from possible hangs
	 */
	tracing_reset_online_cpus(&tr->trace_buffer);
	set_graph_array(tr);
	ret = register_ftrace_graph(&fgraph_ops);
	if (ret) {
		warn_failed_init_tracer(trace, ret);
		goto out;
	}
	tracing_start_cmdline_record();

	/* Sleep for a 1/10 of a second */
	msleep(100);

	/* Have we just recovered from a hang? */
	if (graph_hang_thresh > GRAPH_MAX_FUNC_TEST) {
		tracing_selftest_disabled = true;
		ret = -1;
		goto out;
	}

	tracing_stop();

	/* check the trace buffer */
	ret = trace_test_buffer(&tr->trace_buffer, &count);

	trace->reset(tr);
	tracing_start();

	if (!ret && !count) {
		printk(KERN_CONT ".. no entries found ..");
		ret = -1;
		goto out;
	}

	/* Don't test dynamic tracing, the function tracer already did */

out:
	/* Stop it if we failed */
	if (ret)
		ftrace_graph_stop();

	return ret;
}
コード例 #2
0
ファイル: trace_functions.c プロジェクト: mpalmer/linux-2.6
static void start_function_trace(struct trace_array *tr)
{
	tr->cpu = get_cpu();
	function_reset(tr);
	put_cpu();

	tracing_start_cmdline_record();
	tracing_start_function_trace();
}
コード例 #3
0
ファイル: trace_functions.c プロジェクト: ANFS/ANFS-kernel
static int function_trace_init(struct trace_array *tr)
{
	func_trace = tr;
	tr->cpu = get_cpu();
	put_cpu();

	tracing_start_cmdline_record();
	tracing_start_function_trace();
	return 0;
}
コード例 #4
0
int
trace_selftest_startup_function_graph(struct tracer *trace,
					struct trace_array *tr)
{
	int ret;
	unsigned long count;

	/*
                                                                  
                                             
  */
	tracing_reset_online_cpus(tr);
	set_graph_array(tr);
	ret = register_ftrace_graph(&trace_graph_return,
				    &trace_graph_entry_watchdog);
	if (ret) {
		warn_failed_init_tracer(trace, ret);
		goto out;
	}
	tracing_start_cmdline_record();

	/*                              */
	msleep(100);

	/*                                     */
	if (graph_hang_thresh > GRAPH_MAX_FUNC_TEST) {
		tracing_selftest_disabled = true;
		ret = -1;
		goto out;
	}

	tracing_stop();

	/*                        */
	ret = trace_test_buffer(tr, &count);

	trace->reset(tr);
	tracing_start();

	if (!ret && !count) {
		printk(KERN_CONT ".. no entries found ..");
		ret = -1;
		goto out;
	}

	/*                                                             */

out:
	/*                      */
	if (ret)
		ftrace_graph_stop();

	return ret;
}
コード例 #5
0
ファイル: trace_sysprof.c プロジェクト: snake1361222/LVS
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;
}
コード例 #6
0
static int persistent_tracer_init(struct trace_array *tr)
{
	persistent_trace_array = tr;
	tr->cpu = get_cpu();
	put_cpu();

	tracing_start_cmdline_record();

	persistent_trace_enabled = 0;
	smp_wmb();

	register_ftrace_function(&trace_ops);

	smp_wmb();
	persistent_trace_enabled = 1;

	return 0;
}
コード例 #7
0
static void start_sched_trace(struct trace_array *tr)
{
	sched_switch_reset(tr);
	tracing_start_cmdline_record();
	tracer_enabled = 1;
}