#define pr_fmt(fmt) …
#include <linux/ftrace.h>
#include <linux/ktime.h>
#include <linux/module.h>
#include <asm/barrier.h>
static unsigned int nr_function_calls = …;
module_param(nr_function_calls, uint, 0);
MODULE_PARM_DESC(…) …;
static unsigned int nr_ops_relevant = …;
module_param(nr_ops_relevant, uint, 0);
MODULE_PARM_DESC(…) …;
static unsigned int nr_ops_irrelevant;
module_param(nr_ops_irrelevant, uint, 0);
MODULE_PARM_DESC(…) …;
static bool save_regs;
module_param(save_regs, bool, 0);
MODULE_PARM_DESC(…) …;
static bool assist_recursion;
module_param(assist_recursion, bool, 0);
MODULE_PARM_DESC(…) …;
static bool assist_rcu;
module_param(assist_rcu, bool, 0);
MODULE_PARM_DESC(…) …;
static bool check_count;
module_param(check_count, bool, 0);
MODULE_PARM_DESC(…) …;
static bool persist;
module_param(persist, bool, 0);
MODULE_PARM_DESC(…) …;
static noinline void tracee_relevant(void)
{ … }
static noinline void tracee_irrelevant(void)
{ … }
struct sample_ops { … };
static void ops_func_nop(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static void ops_func_count(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static struct sample_ops *ops_relevant;
static struct sample_ops *ops_irrelevant;
static struct sample_ops *ops_alloc_init(void *tracee, ftrace_func_t func,
unsigned long flags, int nr)
{ … }
static void ops_destroy(struct sample_ops *ops, int nr)
{ … }
static void ops_check(struct sample_ops *ops, int nr,
unsigned int expected_count)
{ … }
static ftrace_func_t tracer_relevant = …;
static ftrace_func_t tracer_irrelevant = …;
static int __init ftrace_ops_sample_init(void)
{ … }
module_init(…) …;
static void __exit ftrace_ops_sample_exit(void)
{ … }
module_exit(ftrace_ops_sample_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;