⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtrace.h

📁 Sun Solaris 10 中的 DTrace 组件的源代码。请参看: http://www.sun.com/software/solaris/observability.jsp
💻 H
📖 第 1 页 / 共 5 页
字号:
#define	DOF_SECT_RELTAB		10	/* dof_relodesc_t array */#define	DOF_SECT_TYPTAB		11	/* dtrace_diftype_t array */#define	DOF_SECT_URELHDR	12	/* dof_relohdr_t (user relocations) */#define	DOF_SECT_KRELHDR	13	/* dof_relohdr_t (kernel relocations) */#define	DOF_SECT_OPTDESC	14	/* dof_optdesc_t array */#define	DOF_SECT_PROVIDER	15	/* dof_provider_t */#define	DOF_SECT_PROBES		16	/* dof_probe_t array */#define	DOF_SECT_PRARGS		17	/* uint8_t array (probe arg mappings) */#define	DOF_SECT_PROFFS		18	/* uint32_t array (probe arg offsets) */#define	DOF_SECT_INTTAB		19	/* uint64_t array */#define	DOF_SECF_LOAD		1	/* section should be loaded */typedef struct dof_ecbdesc {	dof_secidx_t dofe_probes;	/* link to DOF_SECT_PROBEDESC */	dof_secidx_t dofe_pred;		/* link to DOF_SECT_DIFOHDR */	dof_secidx_t dofe_actions;	/* link to DOF_SECT_ACTDESC */	uint32_t dofe_pad;		/* reserved for future use */	uint64_t dofe_uarg;		/* user-supplied library argument */} dof_ecbdesc_t;typedef struct dof_probedesc {	dof_secidx_t dofp_strtab;	/* link to DOF_SECT_STRTAB section */	dof_stridx_t dofp_provider;	/* provider string */	dof_stridx_t dofp_mod;		/* module string */	dof_stridx_t dofp_func;		/* function string */	dof_stridx_t dofp_name;		/* name string */	uint32_t dofp_id;		/* probe identifier (or zero) */} dof_probedesc_t;typedef struct dof_actdesc {	dof_secidx_t dofa_difo;		/* link to DOF_SECT_DIFOHDR */	dof_secidx_t dofa_strtab;	/* link to DOF_SECT_STRTAB section */	uint32_t dofa_kind;		/* action kind (DTRACEACT_* constant) */	uint32_t dofa_ntuple;		/* number of subsequent tuple actions */	uint64_t dofa_arg;		/* kind-specific argument */	uint64_t dofa_uarg;		/* user-supplied argument */} dof_actdesc_t;typedef struct dof_difohdr {	dtrace_diftype_t dofd_rtype;	/* return type for this fragment */	dof_secidx_t dofd_links[1];	/* variable length array of indices */} dof_difohdr_t;typedef struct dof_relohdr {	dof_secidx_t dofr_strtab;	/* link to DOF_SECT_STRTAB for names */	dof_secidx_t dofr_relsec;	/* link to DOF_SECT_RELTAB for relos */	dof_secidx_t dofr_tgtsec;	/* link to section we are relocating */} dof_relohdr_t;typedef struct dof_relodesc {	dof_stridx_t dofr_name;		/* string name of relocation symbol */	uint32_t dofr_type;		/* relo type (DOF_RELO_* constant) */	uint64_t dofr_offset;		/* byte offset for relocation */	uint64_t dofr_data;		/* additional type-specific data */} dof_relodesc_t;#define	DOF_RELO_NONE	0		/* empty relocation entry */#define	DOF_RELO_SETX	1		/* relocate setx value */typedef struct dof_optdesc {	uint32_t dofo_option;		/* option identifier */	dof_secidx_t dofo_strtab;	/* string table, if string option */	uint64_t dofo_value;		/* option value or string index */} dof_optdesc_t;typedef uint32_t dof_attr_t;		/* encoded stability attributes */#define	DOF_ATTR(n, d, c)	(((n) << 24) | ((d) << 16) | ((c) << 8))#define	DOF_ATTR_NAME(a)	(((a) >> 24) & 0xff)#define	DOF_ATTR_DATA(a)	(((a) >> 16) & 0xff)#define	DOF_ATTR_CLASS(a)	(((a) >>  8) & 0xff)typedef struct dof_provider {	dof_secidx_t dofpv_strtab;	/* link to DOF_SECT_STRTAB section */	dof_secidx_t dofpv_probes;	/* link to DOF_SECT_PROBES section */	dof_secidx_t dofpv_prargs;	/* link to DOF_SECT_PRARGS section */	dof_secidx_t dofpv_proffs;	/* link to DOF_SECT_PROFFS section */	dof_stridx_t dofpv_name;	/* provider name string */	dof_attr_t dofpv_provattr;	/* provider attributes */	dof_attr_t dofpv_modattr;	/* module attributes */	dof_attr_t dofpv_funcattr;	/* function attributes */	dof_attr_t dofpv_nameattr;	/* name attributes */	dof_attr_t dofpv_argsattr;	/* args attributes */} dof_provider_t;typedef struct dof_probe {	uint64_t dofpr_addr;		/* probe base address or offset */	dof_stridx_t dofpr_func;	/* probe function string */	dof_stridx_t dofpr_name;	/* probe name string */	dof_stridx_t dofpr_nargv;	/* native argument type strings */	dof_stridx_t dofpr_xargv;	/* translated argument type strings */	uint32_t dofpr_argidx;		/* index of first argument mapping */	uint32_t dofpr_offidx;		/* index of first offset entry */	uint8_t dofpr_nargc;		/* native argument count */	uint8_t dofpr_xargc;		/* translated argument count */	uint16_t dofpr_noffs;		/* number of offset entries for probe */	uint32_t dofpr_pad;		/* reserved for future use */} dof_probe_t;/* * DTrace Intermediate Format Object (DIFO) * * A DIFO is used to store the compiled DIF for a D expression, its return * type, and its string and variable tables.  The string table is a single * buffer of character data into which sets instructions and variable * references can reference strings using a byte offset.  The variable table * is an array of dtrace_difv_t structures that describe the name and type of * each variable and the id used in the DIF code.  This structure is described * above in the DIF section of this header file.  The DIFO is used at both * user-level (in the library) and in the kernel, but the structure is never * passed between the two: the DOF structures form the only interface.  As a * result, the definition can change depending on the presence of _KERNEL. */typedef struct dtrace_difo {	dif_instr_t *dtdo_buf;		/* instruction buffer */	uint64_t *dtdo_inttab;		/* integer table (optional) */	char *dtdo_strtab;		/* string table (optional) */	dtrace_difv_t *dtdo_vartab;	/* variable table (optional) */	uint_t dtdo_len;		/* length of instruction buffer */	uint_t dtdo_intlen;		/* length of integer table */	uint_t dtdo_strlen;		/* length of string table */	uint_t dtdo_varlen;		/* length of variable table */	dtrace_diftype_t dtdo_rtype;	/* return type */	uint_t dtdo_refcnt;		/* owner reference count */	uint_t dtdo_destructive;	/* invokes destructive subroutines */#ifndef _KERNEL	dof_relodesc_t *dtdo_kreltab;	/* kernel relocations */	dof_relodesc_t *dtdo_ureltab;	/* user relocations */	uint32_t dtdo_krelen;		/* length of krelo table */	uint32_t dtdo_urelen;		/* length of urelo table */#endif} dtrace_difo_t;/* * DTrace Enabling Description Structures * * When DTrace is tracking the description of a DTrace enabling entity (probe, * predicate, action, ECB, record, etc.), it does so in a description * structure.  These structures all end in "desc", and are used at both * user-level and in the kernel -- but (with the exception of * dtrace_probedesc_t) they are never passed between them.  Typically, * user-level will use the description structures when assembling an enabling. * It will then distill those description structures into a DOF object (see * above), and send it into the kernel.  The kernel will again use the * description structures to create a description of the enabling as it reads * the DOF.  When the description is complete, the enabling will be actually * created -- turning it into the structures that represent the enabling * instead of merely describing it.  Not surprisingly, the description * structures bear a strong resemblance to the DOF structures that act as their * conduit. */struct dtrace_predicate;typedef struct dtrace_probedesc {	dtrace_id_t dtpd_id;			/* probe identifier */	char dtpd_provider[DTRACE_PROVNAMELEN]; /* probe provider name */	char dtpd_mod[DTRACE_MODNAMELEN];	/* probe module name */	char dtpd_func[DTRACE_FUNCNAMELEN];	/* probe function name */	char dtpd_name[DTRACE_NAMELEN];		/* probe name */} dtrace_probedesc_t;typedef struct dtrace_preddesc {	dtrace_difo_t *dtpdd_difo;		/* pointer to DIF object */	struct dtrace_predicate *dtpdd_predicate; /* pointer to predicate */} dtrace_preddesc_t;typedef struct dtrace_actdesc {	dtrace_difo_t *dtad_difo;		/* pointer to DIF object */	struct dtrace_actdesc *dtad_next;	/* next action */	dtrace_actkind_t dtad_kind;		/* kind of action */	uint32_t dtad_ntuple;			/* number in tuple */	uint64_t dtad_arg;			/* action argument */	uint64_t dtad_uarg;			/* user argument */} dtrace_actdesc_t;typedef struct dtrace_ecbdesc {	dtrace_actdesc_t *dted_action;		/* action description(s) */	dtrace_preddesc_t dted_pred;		/* predicate description */	dtrace_probedesc_t dted_probe;		/* probe description */	uint64_t dted_uarg;			/* library argument */	int dted_refcnt;			/* reference count */} dtrace_ecbdesc_t;/* * DTrace Metadata Description Structures * * DTrace separates the trace data stream from the metadata stream.  The only * metadata tokens placed in the data stream are enabled probe identifiers * (EPIDs) or (in the case of aggregations) aggregation identifiers.  In order * to determine the structure of the data, DTrace consumers pass the token to * the kernel, and receive in return a corresponding description of the enabled * probe (via the dtrace_eprobedesc structure) or the aggregation (via the * dtrace_aggdesc structure).  Both of these structures are expressed in terms * of record descriptions (via the dtrace_recdesc structure) that describe the * exact structure of the data.  Some record descriptions may also contain a * format identifier; this additional bit of metadata can be retrieved from the * kernel, for which a format description is returned via the dtrace_fmtdesc * structure.  Note that all four of these structures must be bitness-neutral * to allow for a 32-bit DTrace consumer on a 64-bit kernel. */typedef struct dtrace_recdesc {	dtrace_actkind_t dtrd_action;		/* kind of action */	uint32_t dtrd_size;			/* size of record */	uint32_t dtrd_offset;			/* offset in ECB's data */	uint16_t dtrd_alignment;		/* required alignment */	uint16_t dtrd_format;			/* format, if any */	uint64_t dtrd_arg;			/* action argument */	uint64_t dtrd_uarg;			/* user argument */} dtrace_recdesc_t;typedef struct dtrace_eprobedesc {	dtrace_epid_t dtepd_epid;		/* enabled probe ID */	dtrace_id_t dtepd_probeid;		/* probe ID */	uint64_t dtepd_uarg;			/* library argument */	uint32_t dtepd_size;			/* total size */	int dtepd_nrecs;			/* number of records */	dtrace_recdesc_t dtepd_rec[1];		/* records themselves */} dtrace_eprobedesc_t;typedef struct dtrace_aggdesc {	DTRACE_PTR(char, dtagd_name);		/* not filled in by kernel */	int dtagd_flags;			/* not filled in by kernel */	dtrace_aggid_t dtagd_id;		/* aggregation ID */	dtrace_epid_t dtagd_epid;		/* enabled probe ID */	uint32_t dtagd_size;			/* size in bytes */	int dtagd_nrecs;			/* number of records */	uint32_t dtagd_pad;			/* explicit padding */	dtrace_recdesc_t dtagd_rec[1];		/* record descriptions */} dtrace_aggdesc_t;typedef struct dtrace_fmtdesc {	DTRACE_PTR(char, dtfd_string);		/* format string */	int dtfd_length;			/* length of format string */	uint16_t dtfd_format;			/* format identifier */} dtrace_fmtdesc_t;#define	DTRACE_SIZEOF_EPROBEDESC(desc)				\	(sizeof (dtrace_eprobedesc_t) + ((desc)->dtepd_nrecs ?	\	(((desc)->dtepd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))#define	DTRACE_SIZEOF_AGGDESC(desc)				\	(sizeof (dtrace_aggdesc_t) + ((desc)->dtagd_nrecs ?	\	(((desc)->dtagd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))/* * DTrace Option Interface * * Run-time DTrace options are set and retrieved via DOF_SECT_OPTDESC sections * in a DOF image.  The dof_optdesc structure contains an option identifier and * an option value.  The valid option identifiers are found below; the mapping * between option identifiers and option identifying strings is maintained at * user-level.  Note that the value of DTRACEOPT_UNSET is such that all of the * following are potentially valid option values:  all positive integers, zero * and negative one.  Some options (notably "bufpolicy" and "bufresize") take * predefined tokens as their values; these are defined with * DTRACEOPT_{option}_{token}. */#define	DTRACEOPT_BUFSIZE	0	/* buffer size */#define	DTRACEOPT_BUFPOLICY	1	/* buffer policy */#define	DTRACEOPT_DYNVARSIZE	2	/* dynamic variable size */#define	DTRACEOPT_AGGSIZE	3	/* aggregation size */#define	DTRACEOPT_SPECSIZE	4	/* speculation size */#define	DTRACEOPT_NSPEC		5	/* number of speculations */#define	DTRACEOPT_STRSIZE	6	/* string size */#define	DTRACEOPT_CLEANRATE	7	/* dynvar cleaning rate */#define	DTRACEOPT_CPU		8	/* CPU to trace */#define	DTRACEOPT_BUFRESIZE	9	/* buffer resizing policy */#define	DTRACEOPT_GRABANON	10	/* grab anonymous state, if any */#define	DTRACEOPT_FLOWINDENT	11	/* indent function entry/return */#define	DTRACEOPT_QUIET		12	/* only output explicitly traced data */#define	DTRACEOPT_STACKFRAMES	13	/* number of stack frames */#define	DTRACEOPT_USTACKFRAMES	14	/* number of user stack frames */#define	DTRACEOPT_AGGRATE	15	/* aggregation snapshot rate */#define	DTRACEOPT_SWITCHRATE	16	/* buffer switching rate */#define	DTRACEOPT_STATUSRATE	17	/* status rate */#define	DTRACEOPT_DESTRUCTIVE	18	/* destructive actions allowed */#define	DTRACEOPT_STACKINDENT	19	/* output indent for stack traces */#define	DTRACEOPT_RAWBYTES	20	/* always print bytes in raw form */#define	DTRACEOPT_JSTACKFRAMES	21	/* number of jstack() frames */#define	DTRACEOPT_JSTACKSTRSIZE	22	/* size of jstack() string table */#define	DTRACEOPT_MAX		23	/* number of options */#define	DTRACEOPT_UNSET		(dtrace_optval_t)-2	/* unset option */#define	DTRACEOPT_BUFPOLICY_RING	0	/* ring buffer */#define	DTRACEOPT_BUFPOLICY_FILL	1	/* fill buffer, then stop */#define	DTRACEOPT_BUFPOLICY_SWITCH	2	/* switch buffers */#define	DTRACEOPT_BUFRESIZE_AUTO	0	/* automatic resizing */#define	DTRACEOPT_BUFRESIZE_MANUAL	1	/* manual resizing *//* * DTrace Buffer Interface * * In order to get a snapshot of the principal or aggregation buffer, * user-level passes a buffer description to the kernel with the dtrace_bufdesc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -