summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/sys/ktr.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/sys/ktr.h')
-rw-r--r--freebsd/sys/sys/ktr.h101
1 files changed, 48 insertions, 53 deletions
diff --git a/freebsd/sys/sys/ktr.h b/freebsd/sys/sys/ktr.h
index de8ebe54..e25cfe03 100644
--- a/freebsd/sys/sys/ktr.h
+++ b/freebsd/sys/sys/ktr.h
@@ -36,56 +36,7 @@
#ifndef _SYS_KTR_H_
#define _SYS_KTR_H_
-/*
- * Trace classes
- *
- * Two of the trace classes (KTR_DEV and KTR_SUBSYS) are special in that
- * they are really placeholders so that indvidual drivers and subsystems
- * can map their internal tracing to the general class when they wish to
- * have tracing enabled and map it to 0 when they don't.
- */
-#define KTR_GEN 0x00000001 /* General (TR) */
-#define KTR_NET 0x00000002 /* Network */
-#define KTR_DEV 0x00000004 /* Device driver */
-#define KTR_LOCK 0x00000008 /* MP locking */
-#define KTR_SMP 0x00000010 /* MP general */
-#define KTR_SUBSYS 0x00000020 /* Subsystem. */
-#define KTR_PMAP 0x00000040 /* Pmap tracing */
-#define KTR_MALLOC 0x00000080 /* Malloc tracing */
-#define KTR_TRAP 0x00000100 /* Trap processing */
-#define KTR_INTR 0x00000200 /* Interrupt tracing */
-#define KTR_SIG 0x00000400 /* Signal processing */
-#define KTR_SPARE2 0x00000800 /* XXX Used by cxgb */
-#define KTR_PROC 0x00001000 /* Process scheduling */
-#define KTR_SYSC 0x00002000 /* System call */
-#define KTR_INIT 0x00004000 /* System initialization */
-#define KTR_SPARE3 0x00008000 /* XXX Used by cxgb */
-#define KTR_SPARE4 0x00010000 /* XXX Used by cxgb */
-#define KTR_EVH 0x00020000 /* Eventhandler */
-#define KTR_VFS 0x00040000 /* VFS events */
-#define KTR_VOP 0x00080000 /* Auto-generated vop events */
-#define KTR_VM 0x00100000 /* The virtual memory system */
-#define KTR_INET 0x00200000 /* IPv4 stack */
-#define KTR_RUNQ 0x00400000 /* Run queue */
-#define KTR_CONTENTION 0x00800000 /* Lock contention */
-#define KTR_UMA 0x01000000 /* UMA slab allocator */
-#define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */
-#define KTR_GEOM 0x04000000 /* GEOM I/O events */
-#define KTR_BUSDMA 0x08000000 /* busdma(9) events */
-#define KTR_INET6 0x10000000 /* IPv6 stack */
-#define KTR_SCHED 0x20000000 /* Machine parsed sched info. */
-#define KTR_BUF 0x40000000 /* Buffer cache */
-#define KTR_ALL 0x7fffffff
-
-/* Trace classes to compile in */
-#ifdef KTR
-#ifndef KTR_COMPILE
-#define KTR_COMPILE (KTR_ALL)
-#endif
-#else /* !KTR */
-#undef KTR_COMPILE
-#define KTR_COMPILE 0
-#endif /* KTR */
+#include <sys/ktr_class.h>
/*
* Version number for ktr_entry struct. Increment this when you break binary
@@ -111,16 +62,16 @@ struct ktr_entry {
};
extern cpuset_t ktr_cpumask;
-extern int ktr_mask;
+extern uint64_t ktr_mask;
extern int ktr_entries;
extern int ktr_verbose;
extern volatile int ktr_idx;
-extern struct ktr_entry ktr_buf[];
+extern struct ktr_entry *ktr_buf;
#ifdef KTR
-void ktr_tracepoint(u_int mask, const char *file, int line,
+void ktr_tracepoint(uint64_t mask, const char *file, int line,
const char *format, u_long arg1, u_long arg2, u_long arg3,
u_long arg4, u_long arg5, u_long arg6);
@@ -244,6 +195,50 @@ void ktr_tracepoint(u_int mask, const char *file, int line,
point, a0, (v0), a1, (v1), a2, (v2), a3, (v3))
/*
+ * Start functions denote the start of a region of code or operation
+ * and should be paired with stop functions for timing of nested
+ * sequences.
+ *
+ * Specifying extra attributes with the name "key" will result in
+ * multi-part keys. For example a block device and offset pair
+ * might be used to describe a buf undergoing I/O.
+ */
+#define KTR_START0(m, egroup, ident, key) \
+ KTR_EVENT0(m, egroup, ident, "start:0x%jX", (uintmax_t)key)
+#define KTR_START1(m, egroup, ident, key, a0, v0) \
+ KTR_EVENT1(m, egroup, ident, "start:0x%jX", (uintmax_t)key, a0, (v0))
+#define KTR_START2(m, egroup, ident, key, a0, v0, a1, v1) \
+ KTR_EVENT2(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1))
+#define KTR_START3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+ KTR_EVENT3(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2))
+#define KTR_START4(m, egroup, ident, key, \
+ a0, v0, a1, v1, a2, v2, a3, v3) \
+ KTR_EVENT4(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2), a3, (v3))
+
+/*
+ * Stop functions denote the end of a region of code or operation
+ * and should be paired with start functions for timing of nested
+ * sequences.
+ */
+#define KTR_STOP0(m, egroup, ident, key) \
+ KTR_EVENT0(m, egroup, ident, "stop:0x%jX", (uintmax_t)key)
+#define KTR_STOP1(m, egroup, ident, key, a0, v0) \
+ KTR_EVENT1(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, a0, (v0))
+#define KTR_STOP2(m, egroup, ident, key, a0, v0, a1, v1) \
+ KTR_EVENT2(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1))
+#define KTR_STOP3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+ KTR_EVENT3(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2))
+#define KTR_STOP4(m, egroup, ident, \
+ key, a0, v0, a1, v1, a2, v2, a3, v3) \
+ KTR_EVENT4(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2), a3, (v3))
+
+/*
* Trace initialization events, similar to CTR with KTR_INIT, but
* completely ifdef'ed out if KTR_INIT isn't in KTR_COMPILE (to
* save string space, the compiler doesn't optimize out strings