linux/samples/ftrace/sample-trace-array.c

// SPDX-License-Identifier: GPL-2.0-only
#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/trace.h>
#include <linux/trace_events.h>
#include <linux/timer.h>
#include <linux/err.h>
#include <linux/jiffies.h>
#include <linux/workqueue.h>

/*
 * Any file that uses trace points, must include the header.
 * But only one file, must include the header by defining
 * CREATE_TRACE_POINTS first.  This will make the C code that
 * creates the handles for the trace points.
 */
#define CREATE_TRACE_POINTS
#include "sample-trace-array.h"

struct trace_array *tr;
static void mytimer_handler(struct timer_list *unused);
static struct task_struct *simple_tsk;

static void trace_work_fn(struct work_struct *work)
{}
static DECLARE_WORK(trace_work, trace_work_fn);

/*
 * mytimer: Timer setup to disable tracing for event "sample_event". This
 * timer is only for the purposes of the sample module to demonstrate access of
 * Ftrace instances from within kernel.
 */
static DEFINE_TIMER(mytimer, mytimer_handler);

static void mytimer_handler(struct timer_list *unused)
{}

static void simple_thread_func(int count)
{}

static int simple_thread(void *arg)
{}

static int __init sample_trace_array_init(void)
{}

static void __exit sample_trace_array_exit(void)
{}

module_init(sample_trace_array_init);
module_exit(sample_trace_array_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();