/* * Infrastructure for profiling code inserted by 'gcc -pg'. * * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> * Copyright (C) 2004-2008 Ingo Molnar <mingo@redhat.com> * * Originally ported from the -rt patch by: * Copyright (C) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> * * Based on code in the latency_tracer, that is: * * Copyright (C) 2004-2006 Ingo Molnar * Copyright (C) 2004 William Lee Irwin III */#include<linux/stop_machine.h>#include<linux/clocksource.h>#include<linux/kallsyms.h>#include<linux/seq_file.h>#include<linux/debugfs.h>#include<linux/hardirq.h>#include<linux/kthread.h>#include<linux/uaccess.h>#include<linux/ftrace.h>#include<linux/sysctl.h>#include<linux/ctype.h>#include<linux/hash.h>#include<linux/list.h>#include"trace.h"/* ftrace_enabled is a method to turn ftrace on or off */intftrace_enabled__read_mostly;staticintlast_ftrace_enabled;/* * ftrace_disabled is set when an anomaly is discovered. * ftrace_disabled is much stronger than ftrace_enabled. */staticintftrace_disabled__read_mostly;staticDEFINE_SPINLOCK(ftrace_lock);staticDEFINE_MUTEX(ftrace_sysctl_lock);staticstructftrace_opsftrace_list_end__read_mostly={.func=ftrace_stub,};staticstructftrace_ops*ftrace_list__read_mostly=&ftrace_list_end;ftrace_func_tftrace_trace_function__read_mostly=ftrace_stub;voidftrace_list_func(unsignedlongip,unsignedlongparent_ip){structftrace_ops*op=ftrace_list;/* in case someone actually ports this to alpha! */read_barrier_depends();while(op!=&ftrace_list_end){/* silly alpha */read_barrier_depends();op->func(ip,parent_ip);op=op->next;};}/** * clear_ftrace_function - reset the ftrace function * * This NULLs the ftrace function and in essence stops * tracing. There may be lag */voidclear_ftrace_function(void){ftrace_trace_function=ftrace_stub;}staticint__register_ftrace_function(structftrace_ops*ops){/* Should never be called by interrupts */spin_lock(&ftrace_lock);ops->next=ftrace_list;/*