FreeBSD kernel kern code
kern_tslog.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/linker.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/tslog.h>
#include <machine/atomic.h>
#include <machine/cpu.h>
Include dependency graph for kern_tslog.c:

Go to the source code of this file.

Data Structures

struct  timestamp
 
struct  procdata
 

Macros

#define TSLOGSIZE   262144
 

Functions

 __FBSDID ("$FreeBSD$")
 
void tslog (void *td, int type, const char *f, const char *s)
 
static int sysctl_debug_tslog (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_debug, OID_AUTO, tslog, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_debug_tslog, "", "Dump recorded event timestamps")
 
 MALLOC_DEFINE (M_TSLOGUSER, "tsloguser", "Strings used by userland tslog")
 
void tslog_user (pid_t pid, pid_t ppid, const char *execname, const char *namei)
 
static int sysctl_debug_tslog_user (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_debug, OID_AUTO, tslog_user, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_debug_tslog_user, "", "Dump recorded userland event timestamps")
 

Variables

static volatile long nrecs = 0
 
static struct timestamp timestamps [TSLOGSIZE]
 
static struct procdata procs [PID_MAX+1]
 

Macro Definition Documentation

◆ TSLOGSIZE

#define TSLOGSIZE   262144

Definition at line 44 of file kern_tslog.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

MALLOC_DEFINE ( M_TSLOGUSER  ,
"tsloguser"  ,
"Strings used by userland tslog  
)

◆ sysctl_debug_tslog()

static int sysctl_debug_tslog ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_debug_tslog_user()

static int sysctl_debug_tslog_user ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 190 of file kern_tslog.c.

References namei(), procs, sbuf_delete(), sbuf_finish(), sbuf_new_for_sysctl(), and sbuf_printf().

Here is the call graph for this function:

◆ SYSCTL_PROC() [1/2]

SYSCTL_PROC ( _debug  ,
OID_AUTO  ,
tslog  ,
CTLTYPE_STRING|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_debug_tslog  ,
""  ,
"Dump recorded event timestamps  
)

◆ SYSCTL_PROC() [2/2]

SYSCTL_PROC ( _debug  ,
OID_AUTO  ,
tslog_user  ,
CTLTYPE_STRING|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_debug_tslog_user  ,
""  ,
"Dump recorded userland event timestamps  
)

◆ tslog()

void tslog ( void *  td,
int  type,
const char *  f,
const char *  s 
)

◆ tslog_user()

void tslog_user ( pid_t  pid,
pid_t  ppid,
const char *  execname,
const char *  namei 
)

Definition at line 148 of file kern_tslog.c.

References procdata::execname, free(), procdata::namei, namei(), procdata::ppid, procs, procdata::reused, procdata::tsc_exited, and procdata::tsc_forked.

Here is the call graph for this function:

Variable Documentation

◆ nrecs

volatile long nrecs = 0
static

Definition at line 47 of file kern_tslog.c.

Referenced by sysctl_debug_tslog(), and tslog().

◆ procs

struct procdata procs[PID_MAX + 1]
static

◆ timestamps

struct timestamp timestamps[TSLOGSIZE]
static

Referenced by sysctl_debug_tslog(), and tslog().