FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/disk.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/devicestat.h>
#include <sys/sdt.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/conf.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/atomic.h>
Go to the source code of this file.
Data Structures | |
struct | statspage |
Macros | |
#define | DTRACE_DEVSTAT_START() SDT_PROBE2(io, , , start, NULL, ds) |
#define | DTRACE_DEVSTAT_BIO_START() SDT_PROBE2(io, , , start, bp, ds) |
#define | DTRACE_DEVSTAT_DONE() SDT_PROBE2(io, , , done, NULL, ds) |
#define | DTRACE_DEVSTAT_BIO_DONE() SDT_PROBE2(io, , , done, bp, ds) |
#define | DTRACE_DEVSTAT_WAIT_START() SDT_PROBE2(io, , , wait__start, NULL, ds) |
#define | DTRACE_DEVSTAT_WAIT_DONE() SDT_PROBE2(io, , , wait__done, NULL, ds) |
#define | statsperpage (PAGE_SIZE / sizeof(struct devstat)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
SDT_PROVIDER_DEFINE (io) | |
SDT_PROBE_DEFINE2 (io,,, start, "struct bio *", "struct devstat *") | |
SDT_PROBE_DEFINE2 (io,,, done, "struct bio *", "struct devstat *") | |
SDT_PROBE_DEFINE2 (io,,, wait__start, "struct bio *", "struct devstat *") | |
SDT_PROBE_DEFINE2 (io,,, wait__done, "struct bio *", "struct devstat *") | |
MTX_SYSINIT (devstat_mutex, &devstat_mutex, "devstat", MTX_DEF) | |
static struct devstat * | devstat_alloc (void) |
static void | devstat_free (struct devstat *) |
static void | devstat_add_entry (struct devstat *ds, const void *dev_name, int unit_number, uint32_t block_size, devstat_support_flags flags, devstat_type_flags device_type, devstat_priority priority) |
struct devstat * | devstat_new_entry (const void *dev_name, int unit_number, uint32_t block_size, devstat_support_flags flags, devstat_type_flags device_type, devstat_priority priority) |
void | devstat_remove_entry (struct devstat *ds) |
void | devstat_start_transaction (struct devstat *ds, const struct bintime *now) |
void | devstat_start_transaction_bio (struct devstat *ds, struct bio *bp) |
void | devstat_start_transaction_bio_t0 (struct devstat *ds, struct bio *bp) |
void | devstat_end_transaction (struct devstat *ds, uint32_t bytes, devstat_tag_type tag_type, devstat_trans_flags flags, const struct bintime *now, const struct bintime *then) |
void | devstat_end_transaction_bio (struct devstat *ds, const struct bio *bp) |
void | devstat_end_transaction_bio_bt (struct devstat *ds, const struct bio *bp, const struct bintime *now) |
static int | sysctl_devstat (SYSCTL_HANDLER_ARGS) |
static | SYSCTL_NODE (_kern, OID_AUTO, devstat, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "Device Statistics") |
SYSCTL_PROC (_kern_devstat, OID_AUTO, all, CTLFLAG_RD|CTLTYPE_OPAQUE|CTLFLAG_MPSAFE, NULL, 0, sysctl_devstat, "S,devstat", "All devices in the devstat list") | |
SYSCTL_INT (_kern_devstat, OID_AUTO, numdevs, CTLFLAG_RD, &devstat_num_devs, 0, "Number of devices in the devstat list") | |
SYSCTL_LONG (_kern_devstat, OID_AUTO, generation, CTLFLAG_RD, &devstat_generation, 0, "Devstat list generation") | |
SYSCTL_INT (_kern_devstat, OID_AUTO, version, CTLFLAG_RD, &devstat_version, 0, "Devstat list version number") | |
static | TAILQ_HEAD (statspage) |
static int | devstat_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) |
SYSCTL_INT (_debug_sizeof, OID_AUTO, devstat, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct devstat), "sizeof(struct devstat)") | |
Variables | |
static int | devstat_num_devs |
static long | devstat_generation = 1 |
static int | devstat_version = DEVSTAT_VERSION |
static int | devstat_current_devnumber |
static struct mtx | devstat_mutex |
static struct devstatlist | device_statq = STAILQ_HEAD_INITIALIZER(device_statq) |
static d_ioctl_t | devstat_ioctl |
static d_mmap_t | devstat_mmap |
static struct cdevsw | devstat_cdevsw |
static size_t | pagelist_pages = 0 |
#define DTRACE_DEVSTAT_BIO_DONE | ( | ) | SDT_PROBE2(io, , , done, bp, ds) |
Definition at line 63 of file subr_devstat.c.
#define DTRACE_DEVSTAT_BIO_START | ( | ) | SDT_PROBE2(io, , , start, bp, ds) |
Definition at line 61 of file subr_devstat.c.
#define DTRACE_DEVSTAT_DONE | ( | ) | SDT_PROBE2(io, , , done, NULL, ds) |
Definition at line 62 of file subr_devstat.c.
#define DTRACE_DEVSTAT_START | ( | ) | SDT_PROBE2(io, , , start, NULL, ds) |
Definition at line 60 of file subr_devstat.c.
#define DTRACE_DEVSTAT_WAIT_DONE | ( | ) | SDT_PROBE2(io, , , wait__done, NULL, ds) |
Definition at line 65 of file subr_devstat.c.
#define DTRACE_DEVSTAT_WAIT_START | ( | ) | SDT_PROBE2(io, , , wait__start, NULL, ds) |
Definition at line 64 of file subr_devstat.c.
#define statsperpage (PAGE_SIZE / sizeof(struct devstat)) |
Definition at line 475 of file subr_devstat.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 117 of file subr_devstat.c.
References binuptime(), device_statq, devstat_current_devnumber, devstat_generation, devstat_mutex, devstat_num_devs, flags, printf(), and priority.
Referenced by devstat_new_entry().
|
static |
Definition at line 535 of file subr_devstat.c.
References devstat_cdevsw, devstat_mutex, free(), make_dev_credf(), malloc(), pagelist_pages, and statsperpage.
Referenced by devstat_new_entry().
void devstat_end_transaction | ( | struct devstat * | ds, |
uint32_t | bytes, | ||
devstat_tag_type | tag_type, | ||
devstat_trans_flags | flags, | ||
const struct bintime * | now, | ||
const struct bintime * | then | ||
) |
Definition at line 302 of file subr_devstat.c.
References bintime(), binuptime(), DTRACE_DEVSTAT_DONE, and flags.
Referenced by devstat_end_transaction_bio_bt().
void devstat_end_transaction_bio | ( | struct devstat * | ds, |
const struct bio * | bp | ||
) |
Definition at line 348 of file subr_devstat.c.
References devstat_end_transaction_bio_bt().
Referenced by biofinish().
void devstat_end_transaction_bio_bt | ( | struct devstat * | ds, |
const struct bio * | bp, | ||
const struct bintime * | now | ||
) |
Definition at line 355 of file subr_devstat.c.
References devstat_end_transaction(), and DTRACE_DEVSTAT_BIO_DONE.
Referenced by devstat_end_transaction_bio().
|
static |
Definition at line 601 of file subr_devstat.c.
References devstat_mutex, and statsperpage.
Referenced by devstat_remove_entry().
|
static |
Definition at line 514 of file subr_devstat.c.
References devstat_mutex.
struct devstat * devstat_new_entry | ( | const void * | dev_name, |
int | unit_number, | ||
uint32_t | block_size, | ||
devstat_support_flags | flags, | ||
devstat_type_flags | device_type, | ||
devstat_priority | priority | ||
) |
Definition at line 87 of file subr_devstat.c.
References binuptime(), devstat_add_entry(), devstat_alloc(), devstat_generation, devstat_mutex, flags, and priority.
void devstat_remove_entry | ( | struct devstat * | ds | ) |
Definition at line 198 of file subr_devstat.c.
References device_statq, devstat_free(), devstat_generation, devstat_mutex, and devstat_num_devs.
void devstat_start_transaction | ( | struct devstat * | ds, |
const struct bintime * | now | ||
) |
Definition at line 228 of file subr_devstat.c.
References binuptime(), and DTRACE_DEVSTAT_START.
Referenced by devstat_start_transaction_bio_t0().
void devstat_start_transaction_bio | ( | struct devstat * | ds, |
struct bio * | bp | ||
) |
Definition at line 252 of file subr_devstat.c.
References binuptime(), and devstat_start_transaction_bio_t0().
void devstat_start_transaction_bio_t0 | ( | struct devstat * | ds, |
struct bio * | bp | ||
) |
Definition at line 264 of file subr_devstat.c.
References devstat_start_transaction(), and DTRACE_DEVSTAT_BIO_START.
Referenced by devstat_start_transaction_bio().
MTX_SYSINIT | ( | devstat_mutex | , |
& | devstat_mutex, | ||
"devstat" | , | ||
MTX_DEF | |||
) |
SDT_PROBE_DEFINE2 | ( | io | , |
done | , | ||
"struct bio *" | , | ||
"struct devstat *" | |||
) |
SDT_PROBE_DEFINE2 | ( | io | , |
start | , | ||
"struct bio *" | , | ||
"struct devstat *" | |||
) |
SDT_PROBE_DEFINE2 | ( | io | , |
wait__done | , | ||
"struct bio *" | , | ||
"struct devstat *" | |||
) |
SDT_PROBE_DEFINE2 | ( | io | , |
wait__start | , | ||
"struct bio *" | , | ||
"struct devstat *" | |||
) |
SDT_PROVIDER_DEFINE | ( | io | ) |
|
static |
Definition at line 396 of file subr_devstat.c.
References device_statq, devstat_generation, devstat_mutex, and devstat_num_devs.
SYSCTL_INT | ( | _debug_sizeof | , |
OID_AUTO | , | ||
devstat | , | ||
CTLFLAG_RD | , | ||
SYSCTL_NULL_INT_PTR | , | ||
sizeof(struct devstat) | , | ||
"sizeof(struct devstat)" | |||
) |
SYSCTL_INT | ( | _kern_devstat | , |
OID_AUTO | , | ||
numdevs | , | ||
CTLFLAG_RD | , | ||
& | devstat_num_devs, | ||
0 | , | ||
"Number of devices in the devstat list" | |||
) |
SYSCTL_INT | ( | _kern_devstat | , |
OID_AUTO | , | ||
version | , | ||
CTLFLAG_RD | , | ||
& | devstat_version, | ||
0 | , | ||
"Devstat list version number" | |||
) |
SYSCTL_LONG | ( | _kern_devstat | , |
OID_AUTO | , | ||
generation | , | ||
CTLFLAG_RD | , | ||
& | devstat_generation, | ||
0 | , | ||
"Devstat list generation" | |||
) |
|
static |
SYSCTL_PROC | ( | _kern_devstat | , |
OID_AUTO | , | ||
all | , | ||
CTLFLAG_RD|CTLTYPE_OPAQUE| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_devstat | , | ||
" | S, | ||
devstat" | , | ||
"All devices in the devstat list" | |||
) |
|
static |
Definition at line 494 of file subr_devstat.c.
|
static |
Definition at line 74 of file subr_devstat.c.
Referenced by devstat_add_entry(), devstat_remove_entry(), and sysctl_devstat().
|
static |
Definition at line 480 of file subr_devstat.c.
Referenced by devstat_alloc().
|
static |
Definition at line 70 of file subr_devstat.c.
Referenced by devstat_add_entry().
|
static |
Definition at line 68 of file subr_devstat.c.
Referenced by devstat_add_entry(), devstat_new_entry(), devstat_remove_entry(), and sysctl_devstat().
|
static |
Definition at line 477 of file subr_devstat.c.
|
static |
Definition at line 478 of file subr_devstat.c.
|
static |
Definition at line 71 of file subr_devstat.c.
Referenced by devstat_add_entry(), devstat_alloc(), devstat_free(), devstat_mmap(), devstat_new_entry(), devstat_remove_entry(), and sysctl_devstat().
|
static |
Definition at line 67 of file subr_devstat.c.
Referenced by devstat_add_entry(), devstat_remove_entry(), and sysctl_devstat().
|
static |
Definition at line 69 of file subr_devstat.c.
|
static |
Definition at line 493 of file subr_devstat.c.
Referenced by devstat_alloc().