FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_ktr.h"
#include "opt_alq.h"
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/alq.h>
#include <sys/cons.h>
#include <sys/cpuset.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/libkern.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <machine/cpu.h>
Go to the source code of this file.
Macros | |
#define | KTR_BOOT_ENTRIES 1024 |
#define | KTR_ENTRIES 1024 |
#define | KTR_ENTRIES_MAX (8 * 1024 * 1024) |
#define | KTR_MASK (0) |
#define | KTR_CPUMASK CPUSET_FSET |
#define | KTR_TIME get_cyclecount() |
#define | KTR_CPU PCPU_GET(cpuid) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | MALLOC_DEFINE (M_KTR, "KTR", "KTR") |
FEATURE (ktr, "Kernel support for KTR kernel tracing facility") | |
static | SYSCTL_NODE (_debug, OID_AUTO, ktr, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "KTR options") |
SYSCTL_INT (_debug_ktr, OID_AUTO, version, CTLFLAG_RD, &ktr_version, 0, "Version of the KTR interface") | |
SYSCTL_UQUAD (_debug_ktr, OID_AUTO, compile, CTLFLAG_RD, &ktr_compile, 0, "Bitmask of KTR event classes compiled into the kernel") | |
static int | sysctl_debug_ktr_cpumask (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_debug_ktr, OID_AUTO, cpumask, CTLFLAG_RWTUN|CTLFLAG_MPSAFE|CTLTYPE_STRING, NULL, 0, sysctl_debug_ktr_cpumask, "S", "Bitmask of CPUs on which KTR logging is enabled") | |
static int | sysctl_debug_ktr_clear (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_debug_ktr, OID_AUTO, clear, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, 0, 0, sysctl_debug_ktr_clear, "I", "Clear KTR Buffer") | |
static int | sysctl_debug_ktr_mask (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_debug_ktr, OID_AUTO, mask, CTLTYPE_U64|CTLFLAG_RWTUN|CTLFLAG_NEEDGIANT, 0, 0, sysctl_debug_ktr_mask, "QU", "Bitmask of KTR event classes for which logging is enabled") | |
static int | sysctl_debug_ktr_entries (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_debug_ktr, OID_AUTO, entries, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, 0, 0, sysctl_debug_ktr_entries, "I", "Number of entries in the KTR buffer") | |
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) |
Variables | |
volatile int | ktr_idx = 0 |
uint64_t | ktr_mask = KTR_MASK |
uint64_t | ktr_compile = KTR_COMPILE |
int | ktr_entries = KTR_BOOT_ENTRIES |
int | ktr_version = KTR_VERSION |
struct ktr_entry | ktr_buf_init [KTR_BOOT_ENTRIES] |
struct ktr_entry * | ktr_buf = ktr_buf_init |
cpuset_t | ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK) |
#define KTR_BOOT_ENTRIES 1024 |
Definition at line 66 of file kern_ktr.c.
#define KTR_CPU PCPU_GET(cpuid) |
Definition at line 89 of file kern_ktr.c.
#define KTR_CPUMASK CPUSET_FSET |
Definition at line 81 of file kern_ktr.c.
#define KTR_ENTRIES 1024 |
Definition at line 70 of file kern_ktr.c.
#define KTR_ENTRIES_MAX (8 * 1024 * 1024) |
Definition at line 74 of file kern_ktr.c.
#define KTR_MASK (0) |
Definition at line 77 of file kern_ktr.c.
#define KTR_TIME get_cyclecount() |
Definition at line 85 of file kern_ktr.c.
__FBSDID | ( | "$FreeBSD$" | ) |
FEATURE | ( | ktr | , |
"Kernel support for KTR kernel tracing facility" | |||
) |
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 | ||
) |
Definition at line 320 of file kern_ktr.c.
References alq_get(), kdb_active, ktr_buf, KTR_CPU, ktr_cpumask, ktr_entries, ktr_idx, ktr_mask, KTR_TIME, mask, and printf().
|
static |
|
static |
Definition at line 138 of file kern_ktr.c.
References ktr_buf, ktr_entries, ktr_idx, and sysctl_handle_int().
|
static |
Definition at line 115 of file kern_ktr.c.
References cpusetobj_strprint(), cpusetobj_strscan(), ktr_cpumask, and sysctl_handle_string().
|
static |
Definition at line 212 of file kern_ktr.c.
References buf, free(), ktr_buf, ktr_buf_init, ktr_entries, KTR_ENTRIES_MAX, ktr_idx, ktr_mask, malloc(), mask, quiesce_all_cpus(), and sysctl_handle_int().
|
static |
Definition at line 164 of file kern_ktr.c.
References ktr_mask, mask, and sysctl_handle_64().
SYSCTL_INT | ( | _debug_ktr | , |
OID_AUTO | , | ||
version | , | ||
CTLFLAG_RD | , | ||
& | ktr_version, | ||
0 | , | ||
"Version of the KTR interface" | |||
) |
|
static |
SYSCTL_PROC | ( | _debug_ktr | , |
OID_AUTO | , | ||
clear | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
0 | , | ||
0 | , | ||
sysctl_debug_ktr_clear | , | ||
"I" | , | ||
"Clear KTR Buffer" | |||
) |
SYSCTL_PROC | ( | _debug_ktr | , |
OID_AUTO | , | ||
cpumask | , | ||
CTLFLAG_RWTUN|CTLFLAG_MPSAFE| | CTLTYPE_STRING, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_ktr_cpumask | , | ||
"S" | , | ||
"Bitmask of CPUs on which KTR logging is enabled" | |||
) |
SYSCTL_PROC | ( | _debug_ktr | , |
OID_AUTO | , | ||
entries | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
0 | , | ||
0 | , | ||
sysctl_debug_ktr_entries | , | ||
"I" | , | ||
"Number of entries in the KTR buffer" | |||
) |
SYSCTL_PROC | ( | _debug_ktr | , |
OID_AUTO | , | ||
mask | , | ||
CTLTYPE_U64|CTLFLAG_RWTUN| | CTLFLAG_NEEDGIANT, | ||
0 | , | ||
0 | , | ||
sysctl_debug_ktr_mask | , | ||
"QU" | , | ||
"Bitmask of KTR event classes for which logging is enabled" | |||
) |
SYSCTL_UQUAD | ( | _debug_ktr | , |
OID_AUTO | , | ||
compile | , | ||
CTLFLAG_RD | , | ||
& | ktr_compile, | ||
0 | , | ||
"Bitmask of KTR event classes compiled into the kernel" | |||
) |
struct ktr_entry* ktr_buf = ktr_buf_init |
Definition at line 102 of file kern_ktr.c.
Referenced by ktr_tracepoint(), sysctl_debug_ktr_clear(), and sysctl_debug_ktr_entries().
struct ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES] |
Definition at line 101 of file kern_ktr.c.
Referenced by sysctl_debug_ktr_entries().
uint64_t ktr_compile = KTR_COMPILE |
Definition at line 98 of file kern_ktr.c.
cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK) |
Definition at line 103 of file kern_ktr.c.
Referenced by ktr_tracepoint(), and sysctl_debug_ktr_cpumask().
int ktr_entries = KTR_BOOT_ENTRIES |
Definition at line 99 of file kern_ktr.c.
Referenced by ktr_tracepoint(), sysctl_debug_ktr_clear(), and sysctl_debug_ktr_entries().
volatile int ktr_idx = 0 |
Definition at line 96 of file kern_ktr.c.
Referenced by ktr_tracepoint(), sysctl_debug_ktr_clear(), and sysctl_debug_ktr_entries().
uint64_t ktr_mask = KTR_MASK |
Definition at line 97 of file kern_ktr.c.
Referenced by ktr_tracepoint(), sysctl_debug_ktr_entries(), and sysctl_debug_ktr_mask().
int ktr_version = KTR_VERSION |
Definition at line 100 of file kern_ktr.c.