aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/irq.h9
-rw-r--r--include/trace/irq_event_types.h33
-rw-r--r--include/trace/kmemtrace.h75
-rw-r--r--include/trace/power.h34
-rw-r--r--include/trace/sched.h49
-rw-r--r--include/trace/sched_event_types.h151
-rw-r--r--include/trace/trace_event_types.h4
-rw-r--r--include/trace/trace_events.h4
-rw-r--r--include/trace/workqueue.h25
9 files changed, 336 insertions, 48 deletions
diff --git a/include/trace/irq.h b/include/trace/irq.h
new file mode 100644
index 000000000000..ff5d4495dc37
--- /dev/null
+++ b/include/trace/irq.h
@@ -0,0 +1,9 @@
+#ifndef _TRACE_IRQ_H
+#define _TRACE_IRQ_H
+
+#include <linux/interrupt.h>
+#include <linux/tracepoint.h>
+
+#include <trace/irq_event_types.h>
+
+#endif
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h
new file mode 100644
index 000000000000..65850bc5ea06
--- /dev/null
+++ b/include/trace/irq_event_types.h
@@ -0,0 +1,33 @@
+
+/* use <trace/irq.h> instead */
+#ifndef TRACE_FORMAT
+# error Do not include this file directly.
+# error Unless you know what you are doing.
+#endif
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM irq
+
+TRACE_EVENT_FORMAT(irq_handler_entry,
+ TPPROTO(int irq, struct irqaction *action),
+ TPARGS(irq, action),
+ TPFMT("irq=%d handler=%s", irq, action->name),
+ TRACE_STRUCT(
+ TRACE_FIELD(int, irq, irq)
+ ),
+ TPRAWFMT("irq %d")
+ );
+
+TRACE_EVENT_FORMAT(irq_handler_exit,
+ TPPROTO(int irq, struct irqaction *action, int ret),
+ TPARGS(irq, action, ret),
+ TPFMT("irq=%d handler=%s return=%s",
+ irq, action->name, ret ? "handled" : "unhandled"),
+ TRACE_STRUCT(
+ TRACE_FIELD(int, irq, irq)
+ TRACE_FIELD(int, ret, ret)
+ ),
+ TPRAWFMT("irq %d ret %d")
+ );
+
+#undef TRACE_SYSTEM
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h
new file mode 100644
index 000000000000..ad8b7857855a
--- /dev/null
+++ b/include/trace/kmemtrace.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 Eduard - Gabriel Munteanu
+ *
+ * This file is released under GPL version 2.
+ */
+
+#ifndef _LINUX_KMEMTRACE_H
+#define _LINUX_KMEMTRACE_H
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/marker.h>
+
+enum kmemtrace_type_id {
+ KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
+ KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
+ KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
+};
+
+#ifdef CONFIG_KMEMTRACE
+
+extern void kmemtrace_init(void);
+
+extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
+ unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags,
+ int node);
+
+extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
+ unsigned long call_site,
+ const void *ptr);
+
+#else /* CONFIG_KMEMTRACE */
+
+static inline void kmemtrace_init(void)
+{
+}
+
+static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
+ unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags,
+ int node)
+{
+}
+
+static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
+ unsigned long call_site,
+ const void *ptr)
+{
+}
+
+#endif /* CONFIG_KMEMTRACE */
+
+static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id,
+ unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags)
+{
+ kmemtrace_mark_alloc_node(type_id, call_site, ptr,
+ bytes_req, bytes_alloc, gfp_flags, -1);
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_KMEMTRACE_H */
+
diff --git a/include/trace/power.h b/include/trace/power.h
new file mode 100644
index 000000000000..2c733e58e89c
--- /dev/null
+++ b/include/trace/power.h
@@ -0,0 +1,34 @@
+#ifndef _TRACE_POWER_H
+#define _TRACE_POWER_H
+
+#include <linux/ktime.h>
+#include <linux/tracepoint.h>
+
+enum {
+ POWER_NONE = 0,
+ POWER_CSTATE = 1,
+ POWER_PSTATE = 2,
+};
+
+struct power_trace {
+#ifdef CONFIG_POWER_TRACER
+ ktime_t stamp;
+ ktime_t end;
+ int type;
+ int state;
+#endif
+};
+
+DECLARE_TRACE(power_start,
+ TPPROTO(struct power_trace *it, unsigned int type, unsigned int state),
+ TPARGS(it, type, state));
+
+DECLARE_TRACE(power_mark,
+ TPPROTO(struct power_trace *it, unsigned int type, unsigned int state),
+ TPARGS(it, type, state));
+
+DECLARE_TRACE(power_end,
+ TPPROTO(struct power_trace *it),
+ TPARGS(it));
+
+#endif /* _TRACE_POWER_H */
diff --git a/include/trace/sched.h b/include/trace/sched.h
index 0d81098ee9fc..4e372a1a29bf 100644
--- a/include/trace/sched.h
+++ b/include/trace/sched.h
@@ -4,53 +4,6 @@
#include <linux/sched.h>
#include <linux/tracepoint.h>
-DECLARE_TRACE(sched_kthread_stop,
- TPPROTO(struct task_struct *t),
- TPARGS(t));
-
-DECLARE_TRACE(sched_kthread_stop_ret,
- TPPROTO(int ret),
- TPARGS(ret));
-
-DECLARE_TRACE(sched_wait_task,
- TPPROTO(struct rq *rq, struct task_struct *p),
- TPARGS(rq, p));
-
-DECLARE_TRACE(sched_wakeup,
- TPPROTO(struct rq *rq, struct task_struct *p, int success),
- TPARGS(rq, p, success));
-
-DECLARE_TRACE(sched_wakeup_new,
- TPPROTO(struct rq *rq, struct task_struct *p, int success),
- TPARGS(rq, p, success));
-
-DECLARE_TRACE(sched_switch,
- TPPROTO(struct rq *rq, struct task_struct *prev,
- struct task_struct *next),
- TPARGS(rq, prev, next));
-
-DECLARE_TRACE(sched_migrate_task,
- TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
- TPARGS(p, orig_cpu, dest_cpu));
-
-DECLARE_TRACE(sched_process_free,
- TPPROTO(struct task_struct *p),
- TPARGS(p));
-
-DECLARE_TRACE(sched_process_exit,
- TPPROTO(struct task_struct *p),
- TPARGS(p));
-
-DECLARE_TRACE(sched_process_wait,
- TPPROTO(struct pid *pid),
- TPARGS(pid));
-
-DECLARE_TRACE(sched_process_fork,
- TPPROTO(struct task_struct *parent, struct task_struct *child),
- TPARGS(parent, child));
-
-DECLARE_TRACE(sched_signal_send,
- TPPROTO(int sig, struct task_struct *p),
- TPARGS(sig, p));
+#include <trace/sched_event_types.h>
#endif
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
new file mode 100644
index 000000000000..a6de5c1601a0
--- /dev/null
+++ b/include/trace/sched_event_types.h
@@ -0,0 +1,151 @@
+
+/* use <trace/sched.h> instead */
+#ifndef TRACE_EVENT_FORMAT
+# error Do not include this file directly.
+# error Unless you know what you are doing.
+#endif
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM sched
+
+TRACE_EVENT_FORMAT(sched_kthread_stop,
+ TPPROTO(struct task_struct *t),
+ TPARGS(t),
+ TPFMT("task %s:%d", t->comm, t->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, t->pid)
+ ),
+ TPRAWFMT("task %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_kthread_stop_ret,
+ TPPROTO(int ret),
+ TPARGS(ret),
+ TPFMT("ret=%d", ret),
+ TRACE_STRUCT(
+ TRACE_FIELD(int, ret, ret)
+ ),
+ TPRAWFMT("ret=%d")
+ );
+
+TRACE_EVENT_FORMAT(sched_wait_task,
+ TPPROTO(struct rq *rq, struct task_struct *p),
+ TPARGS(rq, p),
+ TPFMT("task %s:%d", p->comm, p->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ ),
+ TPRAWFMT("task %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_wakeup,
+ TPPROTO(struct rq *rq, struct task_struct *p, int success),
+ TPARGS(rq, p, success),
+ TPFMT("task %s:%d %s",
+ p->comm, p->pid, success ? "succeeded" : "failed"),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ TRACE_FIELD(int, success, success)
+ ),
+ TPRAWFMT("task %d success=%d")
+ );
+
+TRACE_EVENT_FORMAT(sched_wakeup_new,
+ TPPROTO(struct rq *rq, struct task_struct *p, int success),
+ TPARGS(rq, p, success),
+ TPFMT("task %s:%d",
+ p->comm, p->pid, success ? "succeeded" : "failed"),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ TRACE_FIELD(int, success, success)
+ ),
+ TPRAWFMT("task %d success=%d")
+ );
+
+TRACE_EVENT_FORMAT(sched_switch,
+ TPPROTO(struct rq *rq, struct task_struct *prev,
+ struct task_struct *next),
+ TPARGS(rq, prev, next),
+ TPFMT("task %s:%d ==> %s:%d",
+ prev->comm, prev->pid, next->comm, next->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, prev_pid, prev->pid)
+ TRACE_FIELD(int, prev_prio, prev->prio)
+ TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN],
+ next_comm,
+ TPCMD(memcpy(TRACE_ENTRY->next_comm,
+ next->comm,
+ TASK_COMM_LEN)))
+ TRACE_FIELD(pid_t, next_pid, next->pid)
+ TRACE_FIELD(int, next_prio, next->prio)
+ ),
+ TPRAWFMT("prev %d:%d ==> next %s:%d:%d")
+ );
+
+TRACE_EVENT_FORMAT(sched_migrate_task,
+ TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
+ TPARGS(p, orig_cpu, dest_cpu),
+ TPFMT("task %s:%d from: %d to: %d",
+ p->comm, p->pid, orig_cpu, dest_cpu),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ TRACE_FIELD(int, orig_cpu, orig_cpu)
+ TRACE_FIELD(int, dest_cpu, dest_cpu)
+ ),
+ TPRAWFMT("task %d from: %d to: %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_process_free,
+ TPPROTO(struct task_struct *p),
+ TPARGS(p),
+ TPFMT("task %s:%d", p->comm, p->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ ),
+ TPRAWFMT("task %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_process_exit,
+ TPPROTO(struct task_struct *p),
+ TPARGS(p),
+ TPFMT("task %s:%d", p->comm, p->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, p->pid)
+ ),
+ TPRAWFMT("task %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_process_wait,
+ TPPROTO(struct pid *pid),
+ TPARGS(pid),
+ TPFMT("pid %d", pid_nr(pid)),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, pid, pid_nr(pid))
+ ),
+ TPRAWFMT("task %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_process_fork,
+ TPPROTO(struct task_struct *parent, struct task_struct *child),
+ TPARGS(parent, child),
+ TPFMT("parent %s:%d child %s:%d",
+ parent->comm, parent->pid, child->comm, child->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(pid_t, parent, parent->pid)
+ TRACE_FIELD(pid_t, child, child->pid)
+ ),
+ TPRAWFMT("parent %d child %d")
+ );
+
+TRACE_EVENT_FORMAT(sched_signal_send,
+ TPPROTO(int sig, struct task_struct *p),
+ TPARGS(sig, p),
+ TPFMT("sig: %d task %s:%d", sig, p->comm, p->pid),
+ TRACE_STRUCT(
+ TRACE_FIELD(int, sig, sig)
+ TRACE_FIELD(pid_t, pid, p->pid)
+ ),
+ TPRAWFMT("sig: %d task %d")
+ );
+
+#undef TRACE_SYSTEM
diff --git a/include/trace/trace_event_types.h b/include/trace/trace_event_types.h
new file mode 100644
index 000000000000..33c8ed5ccb6c
--- /dev/null
+++ b/include/trace/trace_event_types.h
@@ -0,0 +1,4 @@
+/* trace/<type>_event_types.h here */
+
+#include <trace/sched_event_types.h>
+#include <trace/irq_event_types.h>
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
new file mode 100644
index 000000000000..ea2ef2051762
--- /dev/null
+++ b/include/trace/trace_events.h
@@ -0,0 +1,4 @@
+/* trace/<type>.h here */
+
+#include <trace/sched.h>
+#include <trace/irq.h>
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h
new file mode 100644
index 000000000000..867829df4571
--- /dev/null
+++ b/include/trace/workqueue.h
@@ -0,0 +1,25 @@
+#ifndef __TRACE_WORKQUEUE_H
+#define __TRACE_WORKQUEUE_H
+
+#include <linux/tracepoint.h>
+#include <linux/workqueue.h>
+#include <linux/sched.h>
+
+DECLARE_TRACE(workqueue_insertion,
+ TPPROTO(struct task_struct *wq_thread, struct work_struct *work),
+ TPARGS(wq_thread, work));
+
+DECLARE_TRACE(workqueue_execution,
+ TPPROTO(struct task_struct *wq_thread, struct work_struct *work),
+ TPARGS(wq_thread, work));
+
+/* Trace the creation of one workqueue thread on a cpu */
+DECLARE_TRACE(workqueue_creation,
+ TPPROTO(struct task_struct *wq_thread, int cpu),
+ TPARGS(wq_thread, cpu));
+
+DECLARE_TRACE(workqueue_destruction,
+ TPPROTO(struct task_struct *wq_thread),
+ TPARGS(wq_thread));
+
+#endif /* __TRACE_WORKQUEUE_H */

Privacy Policy