Index: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 =================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 (revision 281704) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 (revision 281705) @@ -1,676 +1,677 @@ '\" te .\" CDDL HEADER START .\" .\" The contents of this file are subject to the terms of the .\" Common Development and Distribution License (the "License"). .\" You may not use this file except in compliance with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE .\" or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions .\" and limitations under the License. .\" .\" When distributing Covered Code, include this CDDL HEADER in each .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" CDDL HEADER END .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd October 5, 2013 +.Dd April 18, 2015 .Dt DTRACE 1 .Os .Sh NAME .Nm dtrace .Nd dynamic tracing compiler and tracing utility .Sh SYNOPSIS .Nm .Op Fl 32 | Fl 64 .Op Fl aACeFGhHlqSvVwZ .Op Fl b Ar bufsz .Op Fl c Ar cmd .Op Fl D Ar name Op Ns = Ns value .Op Fl I Ar path .Op Fl L Ar path .Op Fl o Ar output .Op Fl s Ar script .Op Fl U Ar name .Op Fl x Ar arg Op Ns = Ns value .Op Fl X Cm a | c | s | t .Op Fl p Ar pid .Op Fl P Ar provider Oo Oo Ar predicate Oc Ar action Oc .Op Fl m Oo Ar provider : Oc Ar module Oo Oo Ar predicate Oc Ar action Oc .Op Fl f Oo Oo Ar provider : Oc Ar module : Oc Ar function Oo Oo Ar predicate \ Oc Ar action Oc .Op Fl n Oo Oo Oo Ar provider : Oc Ar module : Oc Ar function : Oc Ar name \ Oo Oo Ar predicate Oc Ar action Oc .Op Fl i Ar probe-id Oo Oo Ar predicate Oc Ar action Oc .Sh DESCRIPTION DTrace is a comprehensive dynamic tracing framework ported from Solaris. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs. .Pp The .Nm command provides a generic interface to the essential services provided by the DTrace facility, including: .Bl -bullet -offset indent .It Options that list the set of probes and providers currently published by DTrace .It Options that enable probes directly using any of the probe description specifiers (provider, module, function, name) .It Options that run the D compiler and compile one or more D program files or programs written directly on the command line .It Options that generate anonymous tracing programs .It Options that generate program stability reports .It Options that modify DTrace tracing and buffering behavior and enable additional D compiler features .El .Pp You can use .Nm to create D scripts by using it in a shebang declaration to create an interpreter file. You can also use .Nm to attempt to compile D programs and determine their properties without actually enabling traces using the .Fl e option. .Sh OPTIONS The arguments accepted by the .Fl P , .Fl m , .Fl f , .Fl n , and .Fl i options can include an optional D language .Ar predicate enclosed in slashes and an optional D language .Ar action statement list enclosed in braces. D program code specified on the command line must be appropriately quoted to avoid interpretation of meta-characters by the shell. .Pp The following options are supported: .Bl -tag -width indent .It Fl 32 | Fl 64 The D compiler produces programs using the native data model of the operating system kernel. If the .Fl 32 option is specified, .Nm forces the D compiler to compile a D program using the 32-bit data model. If the .Fl 64 option is specified, .Nm forces the D compiler to compile a D program using the 64-bit data model. These options are typically not required as .Nm selects the native data model as the default. The data model affects the sizes of integer types and other language properties. D programs compiled for either data model can be executed on both 32-bit and 64-bit kernels. The .Fl 32 and .Fl 64 options also determine the .Xr elf 5 file format (ELF32 or ELF64) produced by the .Fl G option. .It Fl a Claim anonymous tracing state and display the traced data. You can combine the .Fl a option with the .Fl e option to force .Nm to exit immediately after consuming the anonymous tracing state rather than continuing to wait for new data. .It Fl A Generate directives for anonymous tracing and write them to .Pa /boot/dtrace.dof . This option constructs a set of dtrace configuration file directives to enable the specified probes for anonymous tracing and then exits. By default, .Nm attempts to store the directives to the file .Pa /boot/dtrace.dof . This behavior can be modified using the .Fl o option to specify an alternate output file. .It Fl b Ar bufsz Set the principal trace buffer size to .Ar bufsz . The trace buffer size can include any of the size suffixes k, m, g, or t. If the buffer space cannot be allocated, .Nm dtrace attempts to reduce the buffer size or exit depending on the setting of the bufresize property. .It Fl c Ar cmd Run the specified command .Ar cmd and exit upon its completion. If more than one .Fl c option is present on the command line, .Nm dtrace exits when all commands have exited, reporting the exit status for each child process as it terminates. The process ID of the first command is made available to any D programs specified on the command line or using the .Fl s option through the .Li $target macro variable. .It Fl C Run the C preprocessor .Xr cpp 1 over D programs before compiling them. You can pass options to the C preprocessor using the .Fl D , .Fl U , .Fl I , and .Fl H options. You can select the degree of C standard conformance if you use the .Fl X option. For a description of the set of tokens defined by the D compiler when invoking the C preprocessor, see .Fl X . .It Fl D Ar name Op Ns = Ns value Define .Ar name when invoking .Xr cpp 1 (enabled using the .Fl C option). If you specify an additional .Ar value , the name is assigned the corresponding value. This option passes the .Fl D option to each .Xr cpp 1 invocation. .It Fl e Exit after compiling any requests and consuming anonymous tracing state .Fl ( a option) but prior to enabling any probes. You can combine this option with the .Fl a option to print anonymous tracing data and exit. You can also combine this option with D compiler options. This combination verifies that the programs compile without actually executing them and enabling the corresponding instrumentation. .It Fl f Oo Oo Ar provider : Oc Ar module : Oc Ar function Oo Oo Ar predicate \ Oc Ar action Oc Specify function name to trace or list .Fl ( l option). The corresponding argument can include any of the probe description forms .Ar provider:module:function , .Ar module:function , or .Ar function . Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than .Ar function are specified in the description, all probes with the corresponding .Ar function are matched. The .Fl f argument can be suffixed with an optional D probe clause. You can specify more than one .Fl f option on the command line at a time. .It Fl F Coalesce trace output by identifying function entry and return. Function entry probe reports are indented and their output is prefixed with .Ql -> . Function return probe reports are unindented and their output is prefixed with .Ql <- . System call entry probe reports are indented and their output is prefixed with .Ql => . System call return probe reports are unindented and their output is prefixed with .Ql <= . .It Fl G Generate an ELF file containing an embedded DTrace program. The DTrace probes specified in the program are saved inside of a relocatable ELF object which can be linked into another program. If the .Fl o option is present, the ELF file is saved using the pathname specified as the argument for this operand. If the .Fl o option is not present and the DTrace program is contained with a file whose name is .Ar filename.d , then the ELF file is saved using the name .Ar filename.o . Otherwise the ELF file is saved using the name d.out. .It Fl h Generate a header file containing macros that correspond to probes in the specified provider definitions. This option should be used to generate a header file that is included by other source files for later use with the .Fl G option. If the .Fl o option is present, the header file is saved using the pathname specified as the argument for that option. If the .Fl o option is not present and the DTrace program is contained within a file whose name is .Ar filename.d , then the header file is saved using the name .Ar filename.h . .It Fl H Print the pathnames of included files when invoking .Xr cpp 1 (enabled using the .Fl C option). This option passes the .Fl H option to each .Xr cpp 1 invocation, causing it to display the list of pathnames, one for each line, to standard error. .It Fl i Ar probe-id Op Oo Ar predicate Oc Ar action Specify probe identifier .Ar ( probe-id ) to trace or list .Ar ( l option). You can specify probe IDs using decimal integers as shown by `dtrace -l`. The .Fl i argument can be suffixed with an optional D probe clause. You can specify more than one .Fl i option at a time. .It Fl I Ar path Add the specified directory .Ar path to the search path for #include files when invoking .Xr cpp 1 (enabled using the .Fl C option). This option passes the .Fl I option to each .Xr cpp 1 invocation. The specified .Ar path is inserted into the search path ahead of the default directory list. .It Fl l List probes instead of enabling them. If the .Fl l option is specified, .Nm produces a report of the probes matching the descriptions given using the .Fl P , m , f , n , i , and .Fl s options. If none of these options are specified, this option lists all probes. .It Fl L Ar path Add the specified directory .Ar path to the search path for DTrace libraries. DTrace libraries are used to contain common definitions that can be used when writing D programs. The specified .Ar path is added after the default library search path. .It Fl m Oo Ar provider : Oc Ar module Oo Oo Ar predicate Oc Ar action Oc Specify module name to trace or list .Fl ( l option). The corresponding argument can include any of the probe description forms .Ar provider:module or .Ar module . Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than .Ar module are specified in the description, all probes with a corresponding .Ar module are matched. The .Fl m argument can be suffixed with an optional D probe clause. More than one .Fl m option can be specified on the command line at a time. .It Fl n Oo Oo Oo Ar provider : Oc Ar module : Oc Ar function : Oc Ar name \ Oo Oo Ar predicate Oc Ar action Oc Specify probe name to trace or list .Fl ( l option). The corresponding argument can include any of the probe description forms .Ar provider:module:function:name , module:function:name , function:name , or .Ar name . Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than .Ar name are specified in the description, all probes with a corresponding .Ar name are matched. The .Fl n argument can be suffixed with an optional D probe clause. More than one .Fl n option can be specified on the command line at a time. .It Fl o Ar output Specify the .Ar output file for the .Fl A , G , and .Fl l options, or for the traced data itself. If the .Fl A option is present and .Fl o is not present, the default output file is .Pa /boot/dtrace.dof . If the .Fl G option is present and the .Fl s option's argument is of the form .Ar filename.d and .Fl o is not present, the default output file is .Ar filename.o . Otherwise the default output file is .Ar d.out . .It Fl p Ar pid Grab the specified process-ID .Ar pid , cache its symbol tables, and exit upon its completion. If more than one .Fl p option is present on the command line, .Nm exits when all commands have exited, reporting the exit status for each process as it terminates. The first process-ID is made available to any D programs specified on the command line or using the .Fl s option through the .Li $target macro variable. .It Fl P Ar provider Oo Oo Ar predicate Oc Ar action Oc Specify provider name to trace or list .Fl ( l option). The remaining probe description fields module, function, and name are left blank and match any probes regardless of the values in those fields. The .Fl P argument can be suffixed with an optional D probe clause. You can specify more than one .Fl P option on the command line at a time. .It Fl q Set quiet mode. .Nm suppresses messages such as the number of probes matched by the specified options and D programs and does not print column headers, the CPU ID, the probe ID, or insert newlines into the output. Only data traced and formatted by D program statements such as .Ql dtrace() and .Ql printf() is displayed to standard output. .It Fl s Ar script Compile the specified D program source file. If the .Fl e option is present, the program is compiled but instrumentation is not enabled. If the .Fl l option is present, the program is compiled and the set of probes matched by it is listed, but instrumentation is not enabled. If none of .Fl e , l , G , or .Fl A are present, the instrumentation specified by the D program is enabled and tracing begins. .It Fl S Show D compiler intermediate code. The D compiler produces a report of the intermediate code generated for each D program to standard error. .It Fl U Ar name Undefine the specified .Ar name when invoking .Xr cpp 1 (enabled using the .Fl C option). This option passes the .Fl U option to each .Xr cpp 1 invocation. .It Fl v Set verbose mode. If the .Fl v option is specified, .Nm produces a program stability report showing the minimum interface stability and dependency level for the specified D programs. .It Fl V Report the highest D programming interface version supported by .Nm . The version information is printed to standard output and the .Nm command exits. .It Fl w Permit destructive actions in D programs specified using the .Fl s , P , m , f , n , or .Fl i options. If the .Fl w option is not specified, .Nm does not permit the compilation or enabling of a D program that contains destructive actions. .It Fl x Ar arg Op Ns = Ns value Enable or modify a DTrace runtime option or D compiler option. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and value with an equals sign (=). .It Fl X Cm a | c | s | t Specify the degree of conformance to the ISO C standard that should be selected when invoking .Xr cpp 1 (enabled using the .Fl C option). The .Fl X option argument affects the value and presence of the __STDC__ macro depending upon the value of the argument letter. .sp The .Fl X option supports the following arguments: .Bl -tag -width indent .It a Default. ISO C plus K&R compatibility extensions, with semantic changes required by ISO C. This is the default mode if .Fl X is not specified. The predefined macro __STDC__ has a value of 0 when .Xr cpp 1 is invoked in conjunction with the .Fl Xa option. .It c Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. The predefined macro __STDC__ has a value of 1 when .Xr cpp 1 is invoked in conjunction with the .Fl \&Xc option. .It s K&R C only. The macro __STDC__ is not defined when .Xr cpp 1 is invoked in conjunction with the .Fl Xs option. .It t Transition. ISO C plus K&R C compatibility extensions, without semantic changes required by ISO C. The predefined macro __STDC__ has a value of 0 when .Xr cpp 1 is invoked in conjunction with the .Fl Xt option. .El .Pp As the .Fl X option only affects how the D compiler invokes the C preprocessor, the .Fl Xa and .Fl Xt options are equivalent from the perspective of D and both are provided only to ease re-use of settings from a C build environment. .Pp Regardless of the .Fl X mode, the following additional C preprocessor definitions are always specified and valid in all modes: .Bl -bullet -offset indent .It __sun .It __unix .It __SVR4 .It __sparc (on SPARC systems only) .It __sparcv9 (on SPARC systems only when 64-bit programs are compiled) .It __i386 (on x86 systems only when 32-bit programs are compiled) .It __amd64 (on x86 systems only when 64-bit programs are compiled) .It __`uname -s`_`uname -r` (for example, .Ql FreeBSD_9.2-RELEASE . .It __SUNW_D=1 .It .No __SUNW_D_VERSION=0x Ns Ar MMmmmuuu .Pp Where .Ar MM is the major release value in hexadecimal, .Ar mmm is the minor release value in hexadecimal, and .Ar uuu is the micro release value in hexadecimal. .El .It Fl Z Permit probe descriptions that match zero probes. If the .Fl Z option is not specified, .Nm reports an error and exits if any probe descriptions specified in D program files .Fl ( s option) or on the command line .Fl ( P , m , f , n , or .Fl i options) contain descriptions that do not match any known probes. .El .Sh OPERANDS You can specify zero or more additional arguments on the .Nm command line to define a set of macro variables and so forth). The additional arguments can be used in D programs specified using the .Fl s option or on the command line. .Sh FILES .Bl -tag -width /boot/dtrace.dof -compact .It Pa /boot/dtrace.dof File for anonymous tracing directives. .El .Sh EXIT STATUS The following exit statuses are returned: .Bl -tag -width indent .It 0 Successful completion. .Pp For D program requests, an exit status of 0 indicates that programs were successfully compiled, probes were successfully enabled, or anonymous state was successfully retrieved. .Nm returns 0 even if the specified tracing requests encountered errors or drops. .It 1 An error occurred. .Pp For D program requests, an exit status of 1 indicates that program compilation failed or that the specified request could not be satisfied. .It 2 Invalid command line options or arguments were specified. .El .Sh SEE ALSO .Xr cpp 1 , .Xr dtruss 1 , -.Xr elf 5 +.Xr elf 5 , +.Xr SDT 9 .Rs .%T Solaris Dynamic Tracing Guide .Re Index: head/share/man/man4/Makefile =================================================================== --- head/share/man/man4/Makefile (revision 281704) +++ head/share/man/man4/Makefile (revision 281705) @@ -1,896 +1,911 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 # $FreeBSD$ .include MAN= aac.4 \ aacraid.4 \ acpi.4 \ ${_acpi_asus.4} \ ${_acpi_asus_wmi.4} \ ${_acpi_dock.4} \ ${_acpi_fujitsu.4} \ ${_acpi_hp.4} \ ${_acpi_ibm.4} \ ${_acpi_panasonic.4} \ ${_acpi_rapidstart.4} \ ${_acpi_sony.4} \ acpi_thermal.4 \ ${_acpi_toshiba.4} \ acpi_video.4 \ ${_acpi_wmi.4} \ ada.4 \ adv.4 \ adw.4 \ ae.4 \ ${_aesni.4} \ age.4 \ agp.4 \ aha.4 \ ahb.4 \ ahc.4 \ ahci.4 \ ahd.4 \ ${_aibs.4} \ aio.4 \ alc.4 \ ale.4 \ alpm.4 \ altera_atse.4 \ altera_avgen.4 \ altera_jtag_uart.4 \ altera_sdcard.4 \ altq.4 \ amdpm.4 \ ${_amdsbwd.4} \ ${_amdsmb.4} \ ${_amdtemp.4} \ ${_bxe.4} \ amr.4 \ an.4 \ ${_aout.4} \ ${_apic.4} \ arcmsr.4 \ ${_asmc.4} \ ata.4 \ ath.4 \ ath_ahb.4 \ ath_hal.4 \ ath_pci.4 \ atkbd.4 \ atkbdc.4 \ atp.4 \ ${_atf_test_case.4} \ ${_atrtc.4} \ ${_attimer.4} \ audit.4 \ auditpipe.4 \ aue.4 \ axe.4 \ axge.4 \ bce.4 \ bfe.4 \ bge.4 \ ${_bhyve.4} \ bktr.4 \ blackhole.4 \ bpf.4 \ bridge.4 \ bt.4 \ bwi.4 \ bwn.4 \ capsicum.4 \ cardbus.4 \ carp.4 \ cas.4 \ cc_cdg.4 \ cc_chd.4 \ cc_cubic.4 \ cc_dctcp.4 \ cc_hd.4 \ cc_htcp.4 \ cc_newreno.4 \ cc_vegas.4 \ ${_ccd.4} \ cd.4 \ cdce.4 \ ch.4 \ ciss.4 \ cm.4 \ cmx.4 \ ${_coretemp.4} \ ${_cpuctl.4} \ cpufreq.4 \ crypto.4 \ ctl.4 \ cue.4 \ cxgb.4 \ cxgbe.4 \ cy.4 \ da.4 \ dc.4 \ dcons.4 \ dcons_crom.4 \ ddb.4 \ de.4 \ devctl.4 \ digi.4 \ disc.4 \ divert.4 \ ${_dpms.4} \ dpt.4 \ ds1307.4 \ ds3231.4 \ + ${_dtrace_io.4} \ + ${_dtrace_ip.4} \ + ${_dtrace_proc.4} \ + ${_dtrace_sched.4} \ + ${_dtrace_tcp.4} \ + ${_dtrace_udp.4} \ dummynet.4 \ ed.4 \ edsc.4 \ ehci.4 \ em.4 \ en.4 \ enc.4 \ epair.4 \ esp.4 \ est.4 \ et.4 \ etherswitch.4 \ eventtimers.4 \ exca.4 \ fatm.4 \ fd.4 \ fdc.4 \ fdt.4 \ fdtbus.4 \ ffclock.4 \ filemon.4 \ firewire.4 \ fpa.4 \ full.4 \ fwe.4 \ fwip.4 \ fwohci.4 \ fxp.4 \ gbde.4 \ gdb.4 \ gem.4 \ geom.4 \ geom_fox.4 \ geom_linux_lvm.4 \ geom_map.4 \ geom_uncompress.4 \ geom_uzip.4 \ gif.4 \ gpio.4 \ gpioiic.4 \ gpioled.4 \ gre.4 \ h_ertt.4 \ hatm.4 \ hifn.4 \ hme.4 \ hpet.4 \ ${_hpt27xx.4} \ ${_hptiop.4} \ ${_hptmv.4} \ ${_hptnr.4} \ ${_hptrr.4} \ hv_ata_pci_disengage.4 \ hv_kvp.4 \ hv_netvsc.4 \ hv_storvsc.4 \ hv_utils.4 \ hv_vmbus.4 \ hwpmc.4 \ ichsmb.4 \ ${_ichwd.4} \ icmp.4 \ icmp6.4 \ ida.4 \ ifmib.4 \ igb.4 \ igmp.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ iicsmb.4 \ iir.4 \ inet.4 \ inet6.4 \ intpm.4 \ intro.4 \ ${_io.4} \ ip.4 \ ip6.4 \ ipfirewall.4 \ ipheth.4 \ ${_ipmi.4} \ ips.4 \ ipsec.4 \ ipw.4 \ ipwfw.4 \ isci.4 \ ismt.4 \ isp.4 \ ispfw.4 \ iwi.4 \ iwifw.4 \ iwn.4 \ iwnfw.4 \ ixgb.4 \ ixgbe.4 \ ixl.4 \ ixlv.4 \ jme.4 \ joy.4 \ kbdmux.4 \ keyboard.4 \ kld.4 \ ksyms.4 \ ktr.4 \ kue.4 \ lagg.4 \ le.4 \ led.4 \ lge.4 \ ${_linux.4} \ lm75.4 \ lmc.4 \ lo.4 \ lp.4 \ lpbb.4 \ lpt.4 \ mac.4 \ mac_biba.4 \ mac_bsdextended.4 \ mac_ifoff.4 \ mac_lomac.4 \ mac_mls.4 \ mac_none.4 \ mac_partition.4 \ mac_portacl.4 \ mac_seeotheruids.4 \ mac_stub.4 \ mac_test.4 \ malo.4 \ mcd.4 \ md.4 \ me.4 \ mem.4 \ meteor.4 \ mfi.4 \ miibus.4 \ mk48txx.4 \ mld.4 \ mlx.4 \ mly.4 \ mmc.4 \ mmcsd.4 \ mn.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ mpr.4 \ mps.4 \ mpt.4 \ mrsas.4 \ msk.4 \ mtio.4 \ multicast.4 \ mvs.4 \ mwl.4 \ mwlfw.4 \ mxge.4 \ my.4 \ nand.4 \ nandsim.4 \ natm.4 \ natmip.4 \ ncr.4 \ ncv.4 \ ${_ndis.4} \ net80211.4 \ netfpga10g_nf10bmac.4 \ netgraph.4 \ netintro.4 \ netmap.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ ng_atm.4 \ ngatmbase.4 \ ng_atmllc.4 \ ng_bluetooth.4 \ ng_bpf.4 \ ng_bridge.4 \ ng_bt3c.4 \ ng_btsocket.4 \ ng_car.4 \ ng_ccatm.4 \ ng_cisco.4 \ ng_deflate.4 \ ng_device.4 \ nge.4 \ ng_echo.4 \ ng_eiface.4 \ ng_etf.4 \ ng_ether.4 \ ng_ether_echo.4 \ ng_frame_relay.4 \ ng_gif.4 \ ng_gif_demux.4 \ ng_h4.4 \ ng_hci.4 \ ng_hole.4 \ ng_hub.4 \ ng_iface.4 \ ng_ipfw.4 \ ng_ip_input.4 \ ng_ksocket.4 \ ng_l2cap.4 \ ng_l2tp.4 \ ng_lmi.4 \ ng_mppc.4 \ ng_nat.4 \ ng_netflow.4 \ ng_one2many.4 \ ng_patch.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ ng_pred1.4 \ ng_rfc1490.4 \ ng_socket.4 \ ng_source.4 \ ng_split.4 \ ng_sppp.4 \ ng_sscfu.4 \ ng_sscop.4 \ ng_tag.4 \ ng_tcpmss.4 \ ng_tee.4 \ ng_tty.4 \ ng_ubt.4 \ ng_UI.4 \ ng_uni.4 \ ng_vjc.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ ${_ntb.4} \ null.4 \ ${_nvd.4} \ ${_nvme.4} \ ${_nvram.4} \ ${_nvram2env.4} \ ${_nxge.4} \ oce.4 \ ohci.4 \ orm.4 \ ${_padlock.4} \ pass.4 \ patm.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ pci.4 \ pcib.4 \ pcic.4 \ pcm.4 \ pcn.4 \ ${_pf.4} \ ${_pflog.4} \ ${_pfsync.4} \ pim.4 \ polling.4 \ ppbus.4 \ ppc.4 \ ppi.4 \ procdesc.4 \ proto.4 \ psm.4 \ pst.4 \ pt.4 \ pts.4 \ pty.4 \ puc.4 \ ${_qlxge.4} \ ${_qlxgb.4} \ ${_qlxgbe.4} \ ral.4 \ random.4 \ rc.4 \ re.4 \ rgephy.4 \ rights.4 \ rl.4 \ rndtest.4 \ route.4 \ rp.4 \ rsu.4 \ rsufw.4 \ rue.4 \ rum.4 \ run.4 \ runfw.4 \ sa.4 \ safe.4 \ sbp.4 \ sbp_targ.4 \ scc.4 \ scd.4 \ sched_4bsd.4 \ sched_ule.4 \ screen.4 \ scsi.4 \ sctp.4 \ sdhci.4 \ sem.4 \ send.4 \ ses.4 \ sf.4 \ ${_sfxge.4} \ sge.4 \ si.4 \ siba.4 \ siftr.4 \ siis.4 \ simplebus.4 \ sio.4 \ sis.4 \ sk.4 \ smb.4 \ smbus.4 \ smp.4 \ smsc.4 \ sn.4 \ snd_ad1816.4 \ snd_als4000.4 \ snd_atiixp.4 \ snd_cmi.4 \ snd_cs4281.4 \ snd_csa.4 \ snd_ds1.4 \ snd_emu10k1.4 \ snd_emu10kx.4 \ snd_envy24.4 \ snd_envy24ht.4 \ snd_es137x.4 \ snd_ess.4 \ snd_fm801.4 \ snd_gusc.4 \ snd_hda.4 \ snd_hdspe.4 \ snd_ich.4 \ snd_maestro3.4 \ snd_maestro.4 \ snd_mss.4 \ snd_neomagic.4 \ snd_sbc.4 \ snd_solo.4 \ snd_spicds.4 \ snd_t4dwave.4 \ snd_uaudio.4 \ snd_via8233.4 \ snd_via82c686.4 \ snd_vibes.4 \ snp.4 \ spic.4 \ ${_spkr.4} \ splash.4 \ sppp.4 \ ste.4 \ stf.4 \ stg.4 \ stge.4 \ sym.4 \ syncache.4 \ syncer.4 \ syscons.4 \ sysmouse.4 \ tap.4 \ targ.4 \ tcp.4 \ tdfx.4 \ terasic_mtl.4 \ termios.4 \ textdump.4 \ ti.4 \ timecounters.4 \ tl.4 \ ${_tpm.4} \ trm.4 \ tty.4 \ tun.4 \ twa.4 \ twe.4 \ tws.4 \ tx.4 \ txp.4 \ vale.4 \ vga.4 \ vge.4 \ viapm.4 \ ${_viawd.4} \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ vxlan.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ vt.4 \ vte.4 \ ${_vtnet.4} \ ${_vxge.4} \ watchdog.4 \ wb.4 \ ${_wbwd.4} \ wi.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ wlan_amrr.4 \ wlan_ccmp.4 \ wlan_tkip.4 \ wlan_wep.4 \ wlan_xauth.4 \ ${_wpi.4} \ wsp.4 \ xe.4 \ ${_xen.4} \ xhci.4 \ xl.4 \ ${_xnb.4} \ xpt.4 \ zero.4 \ zyd.4 MLINKS= ae.4 if_ae.4 MLINKS+=age.4 if_age.4 MLINKS+=agp.4 agpgart.4 MLINKS+=alc.4 if_alc.4 MLINKS+=ale.4 if_ale.4 MLINKS+=altera_atse.4 atse.4 MLINKS+=altera_sdcard.4 altera_sdcardc.4 MLINKS+=altq.4 ALTQ.4 MLINKS+=ath.4 if_ath.4 MLINKS+=ath_pci.4 if_ath_pci.4 MLINKS+=an.4 if_an.4 MLINKS+=aue.4 if_aue.4 MLINKS+=axe.4 if_axe.4 MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwi.4 if_bwi.4 MLINKS+=bwn.4 if_bwn.4 MLINKS+=${_bxe.4} ${_if_bxe.4} MLINKS+=cas.4 if_cas.4 MLINKS+=cdce.4 if_cdce.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=cxgb.4 if_cxgb.4 MLINKS+=cxgbe.4 if_cxgbe.4 \ cxgbe.4 cxl.4 \ cxgbe.4 if_cxl.4 MLINKS+=dc.4 if_dc.4 MLINKS+=de.4 if_de.4 MLINKS+=disc.4 if_disc.4 MLINKS+=ed.4 if_ed.4 MLINKS+=edsc.4 if_edsc.4 MLINKS+=em.4 if_em.4 MLINKS+=en.4 if_en.4 MLINKS+=enc.4 if_enc.4 MLINKS+=epair.4 if_epair.4 MLINKS+=et.4 if_et.4 MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ fd.4 stdin.4 \ fd.4 stdout.4 MLINKS+=fdt.4 FDT.4 MLINKS+=firewire.4 ieee1394.4 MLINKS+=fpa.4 fea.4 MLINKS+=fwe.4 if_fwe.4 MLINKS+=fwip.4 if_fwip.4 MLINKS+=fxp.4 if_fxp.4 MLINKS+=gem.4 if_gem.4 MLINKS+=geom.4 GEOM.4 MLINKS+=gif.4 if_gif.4 MLINKS+=gpio.4 gpiobus.4 MLINKS+=gre.4 if_gre.4 MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=hpet.4 acpi_hpet.4 MLINKS+=${_hptrr.4} ${_rr232x.4} MLINKS+=${_attimer.4} ${_i8254.4} MLINKS+=igb.4 if_igb.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ ipfirewall.4 ipacct.4 \ ipfirewall.4 ipfw.4 MLINKS+=ipheth.4 if_ipheth.4 MLINKS+=ipw.4 if_ipw.4 MLINKS+=iwi.4 if_iwi.4 MLINKS+=iwn.4 if_iwn.4 MLINKS+=ixgb.4 if_ixgb.4 MLINKS+=ixgbe.4 ix.4 MLINKS+=ixgbe.4 if_ix.4 MLINKS+=ixgbe.4 if_ixgbe.4 MLINKS+=ixl.4 if_ixl.4 MLINKS+=ixlv.4 if_ixlv.4 MLINKS+=jme.4 if_jme.4 MLINKS+=kue.4 if_kue.4 MLINKS+=lagg.4 trunk.4 MLINKS+=lagg.4 if_lagg.4 MLINKS+=le.4 if_le.4 MLINKS+=lge.4 if_lge.4 MLINKS+=lmc.4 if_lmc.4 MLINKS+=lo.4 loop.4 MLINKS+=lp.4 plip.4 MLINKS+=malo.4 if_malo.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 MLINKS+=mn.4 if_mn.4 MLINKS+=mos.4 if_mos.4 MLINKS+=msk.4 if_msk.4 MLINKS+=mwl.4 if_mwl.4 MLINKS+=mxge.4 if_mxge.4 MLINKS+=my.4 if_my.4 MLINKS+=${_ndis.4} ${_if_ndis.4} MLINKS+=netfpga10g_nf10bmac.4 if_nf10bmac.4 MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 MLINKS+=${_ntb.4} ${_if_ntb.4} \ ${_ntb.4} ${_ntb_hw.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=patm.4 if_patm.4 MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 MLINKS+=rue.4 if_rue.4 MLINKS+=rum.4 if_rum.4 MLINKS+=run.4 if_run.4 MLINKS+=scsi.4 CAM.4 \ scsi.4 cam.4 \ scsi.4 scbus.4 \ scsi.4 SCSI.4 MLINKS+=sf.4 if_sf.4 MLINKS+=sge.4 if_sge.4 MLINKS+=sis.4 if_sis.4 MLINKS+=sk.4 if_sk.4 MLINKS+=smp.4 SMP.4 MLINKS+=smsc.4 if_smsc.4 MLINKS+=sn.4 if_sn.4 MLINKS+=snd_envy24.4 snd_ak452x.4 MLINKS+=snd_sbc.4 snd_sb16.4 \ snd_sbc.4 snd_sb8.4 MLINKS+=${_spkr.4} ${_speaker.4} MLINKS+=splash.4 screensaver.4 MLINKS+=ste.4 if_ste.4 MLINKS+=stf.4 if_stf.4 MLINKS+=stge.4 if_stge.4 MLINKS+=syncache.4 syncookies.4 MLINKS+=syscons.4 sc.4 MLINKS+=tap.4 if_tap.4 MLINKS+=tdfx.4 tdfx_linux.4 MLINKS+=ti.4 if_ti.4 MLINKS+=tl.4 if_tl.4 MLINKS+=tun.4 if_tun.4 MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 MLINKS+=vxlan.4 if_vxlan.4 MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 MLINKS+=${_vtnet.4} ${_if_vtnet.4} MLINKS+=${_vxge.4} ${_if_vxge.4} MLINKS+=watchdog.4 SW_WATCHDOG.4 MLINKS+=wb.4 if_wb.4 MLINKS+=wi.4 if_wi.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xe.4 if_xe.4 MLINKS+=xl.4 if_xl.4 MLINKS+=zyd.4 if_zyd.4 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" _acpi_asus.4= acpi_asus.4 _acpi_asus_wmi.4= acpi_asus_wmi.4 _acpi_dock.4= acpi_dock.4 _acpi_fujitsu.4=acpi_fujitsu.4 _acpi_hp.4= acpi_hp.4 _acpi_ibm.4= acpi_ibm.4 _acpi_panasonic.4=acpi_panasonic.4 _acpi_rapidstart.4=acpi_rapidstart.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 _aesni.4= aesni.4 _aout.4= aout.4 _apic.4= apic.4 _atrtc.4= atrtc.4 _attimer.4= attimer.4 _aibs.4= aibs.4 _amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _bxe.4= bxe.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 _hpt27xx.4= hpt27xx.4 _hptiop.4= hptiop.4 _hptmv.4= hptmv.4 _hptnr.4= hptnr.4 _hptrr.4= hptrr.4 _i8254.4= i8254.4 _ichwd.4= ichwd.4 _if_bxe.4= if_bxe.4 _if_ndis.4= if_ndis.4 _if_nfe.4= if_nfe.4 _if_nxge.4= if_nxge.4 _if_urtw.4= if_urtw.4 _if_vmx.4= if_vmx.4 _if_vtnet.4= if_vtnet.4 _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 _io.4= io.4 _linux.4= linux.4 _ndis.4= ndis.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 _virtio_console.4=virtio_console.4 _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 _vtnet.4= vtnet.4 _vxge.4= vxge.4 _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 _xnb.4= xnb.4 .endif .if ${MACHINE_CPUARCH} == "amd64" _if_ntb.4= if_ntb.4 _ntb.4= ntb.4 _ntb_hw.4= ntb_hw.4 _qlxge.4= qlxge.4 _qlxgb.4= qlxgb.4 _qlxgbe.4= qlxgbe.4 _sfxge.4= sfxge.4 MLINKS+=qlxge.4 if_qlxge.4 MLINKS+=qlxgb.4 if_qlxgb.4 MLINKS+=qlxgbe.4 if_qlxgbe.4 MLINKS+=sfxge.4 if_sfxge.4 .if ${MK_BHYVE} != "no" _bhyve.4= bhyve.4 .endif .endif .if ${MACHINE_CPUARCH} == "mips" _nvram2env.4= nvram2env.4 .endif .if exists(${.CURDIR}/man4.${MACHINE_CPUARCH}) SUBDIR= man4.${MACHINE_CPUARCH} .endif .if ${MK_CCD} != "no" _ccd.4= ccd.4 +.endif + +.if ${MK_CDDL} != "no" +_dtrace_io.4= dtrace-io.4 +_dtrace_ip.4= dtrace-ip.4 +_dtrace_proc.4= dtrace-proc.4 +_dtrace_sched.4= dtrace-sched.4 +_dtrace_tcp.4= dtrace-tcp.4 +_dtrace_udp.4= dtrace-udp.4 .endif .if ${MK_ISCSI} != "no" MAN+= iscsi.4 MAN+= iscsi_initiator.4 .endif .if ${MK_TESTS} != "no" ATF= ${.CURDIR}/../../../contrib/atf .PATH: ${ATF}/doc _atf_test_case.4= atf-test-case.4 .endif .if ${MK_PF} != "no" _pf.4= pf.4 _pflog.4= pflog.4 _pfsync.4= pfsync.4 .endif .if ${MK_USB} != "no" MAN+= \ u3g.4 \ uark.4 \ uart.4 \ uath.4 \ ubsa.4 \ ubsec.4 \ ubser.4 \ ubtbcmfw.4 \ uchcom.4 \ ucom.4 \ ucycom.4 \ udav.4 \ udbp.4 \ udp.4 \ udplite.4 \ udl.4 \ uep.4 \ ufm.4 \ ufoma.4 \ uftdi.4 \ ugen.4 \ uhci.4 \ uhid.4 \ uhso.4 \ uipaq.4 \ ukbd.4 \ uled.4 \ ulpt.4 \ umass.4 \ umcs.4 \ umct.4 \ umodem.4 \ umoscom.4 \ ums.4 \ unix.4 \ upgt.4 \ uplcom.4 \ ural.4 \ urio.4 \ urndis.4 \ ${_urtw.4} \ urtwn.4 \ urtwnfw.4 \ usb.4 \ usb_quirk.4 \ usb_template.4 \ usfs.4 \ uslcom.4 \ utopia.4 \ uvisor.4 \ uvscom.4 \ MLINKS+=u3g.4 u3gstub.4 MLINKS+=uath.4 if_uath.4 MLINKS+=udav.4 if_udav.4 MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 MLINKS+=urndis.4 if_urndis.4 MLINKS+=${_urtw.4} ${_if_urtw.4} .endif .include Index: head/share/man/man4/dtrace-io.4 =================================================================== --- head/share/man/man4/dtrace-io.4 (nonexistent) +++ head/share/man/man4/dtrace-io.4 (revision 281705) @@ -0,0 +1,123 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-IO 4 +.Os +.Sh NAME +.Nm dtrace-io +.Nd a DTrace provider for tracing events related to disk I/O +.Sh SYNOPSIS +.Fn io:::start "struct bio *" "struct devstat *" +.Fn io:::done "struct bio *" "struct devstat *" +.Sh DESCRIPTION +The +.Nm io +provider allows the tracing of disk I/O events. +The +.Fn io:::start +probe fires when a I/O request is about to be sent to the backing driver of a +.Xr disk 9 +object. +This occurs after all +.Xr GEOM 4 +transformations have been performed on the request. +The +.Fn io:::done +probe fires when a I/O request is completed. +Both probes take a +.Vt "struct bio *" +representing the I/O request as their first argument. +The second argument is a +.Vt "struct devstat *" +for the underlying +.Xr disk 9 +object. +.Sh ARGUMENTS +The fields of +.Vt "struct bio" +are described in the +.Xr g_bio 9 +manual page, and the fields of +.Vt "struct devstat" +are described in the +.Xr devstat 9 +manual page. +Translators for the +.Vt bufinfo_t +and +.Vt devinfo_t +D types are defined in +.Pa /usr/lib/dtrace/io.d . +.Sh FILES +.Bl -tag -width "/usr/lib/dtrace/io.d" -compact +.It Pa /usr/lib/dtrace/io.d +DTrace type and translator definitions for the +.Nm io +provider. +.El +.Sh EXAMPLES +The following script shows a per-process breakdown of total I/O by disk device: +.Bd -literal -offset indent +#pragma D option quiet + +io:::start +{ + @[args[1]->device_name, execname, pid] = sum(args[0]->bio_bcount); +} + +END +{ + printf("%10s %20s %10s %15s\n", "DEVICE", "APP", "PID", "BYTES"); + printa("%10s %20s %10d %15@d\n", @); +} +.Ed +.Sh COMPATIBILITY +This provider is not compatible with the +.Nm io +provider found in Solaris, as its probes use native +.Fx +argument types. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr devstat 9 , +.Xr SDT 9 +.Sh HISTORY +The +.Nm io +provider first appeared in +.Fx +9.2 and 10.0. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . +.Sh BUGS +The +.Fn io:::wait-start +and +.Fn io:::wait-done +probes are not currently implemented on +.Fx . Property changes on: head/share/man/man4/dtrace-io.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man4/dtrace-ip.4 =================================================================== --- head/share/man/man4/dtrace-ip.4 (nonexistent) +++ head/share/man/man4/dtrace-ip.4 (revision 281705) @@ -0,0 +1,285 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-IP 4 +.Os +.Sh NAME +.Nm dtrace-ip +.Nd a DTrace provider for tracing events related to the IPv4 and IPv6 protocols +.Sh SYNOPSIS +.Fn ip:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "ifinfo_t *" \ + "ipv4info_t *" "ipv6info_t *" +.Fn ip:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "ifinfo_t *" \ + "ipv4info_t *" "ipv6info_t *" +.Sh DESCRIPTION +The DTrace +.Nm ip +provider allows users to trace events in the +.Xr ip 4 +and +.Xr ip6 4 +protocol implementations. +The +.Fn ip:::send +probe fires whenever the kernel prepares to transmit an IP packet, and the +.Fn ip:::receive +probe fires whenever the kernel receives an IP packet. +The arguments to these probes can be used to obtain detailed information about +the IP headers of the corresponding packet, as well as the network interface on +which the packet was sent or received. +Unlike the +.Xr dtrace-tcp 4 +and +.Xr dtrace-udp 4 +providers, +.Nm ip +provider probes are triggered by forwarded packets. +That is, the probes will fire on packets that are not destined to the local +host. +.Sh ARGUMENTS +The +.Vt pktinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uintptr_t pkt_addr" -offset indent +.It Vt uintptr_t pkt_addr +Always set to 0. +.El +.Pp +The +.Vt csinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uintptr_t cs_addr" -offset indent +.It Vt uintptr_t cs_addr +Always set to 0. +.It Vt uint64_t cs_cid +A pointer to the +.Vt struct inpcb +for this packet, or +.Dv NULL . +.It Vt pid_t cs_pid +Always set to 0. +.El +.Pp +The +.Vt ipinfo_t +argument contains IP fields common to both IPv4 and IPv6 packets. +Its fields are: +.Bl -tag -width "uint32_t ip_plength" -offset indent +.It Vt uint8_t ip_ver +IP version of the packet, 4 for IPv4 packets and 6 for IPv6 packets. +.It Vt uint32_t ip_plength +IP payload size. +This does not include the size of the IP header or IPv6 option headers. +.It Vt string ip_saddr +IP source address. +.It Vt string ip_daddr +IP destination address. +.El +.Pp +The +.Vt ifinfo_t +argument describes the outgoing and incoming interfaces for the packet in the +.Fn ip:::send +and +.Fn ip:::receive +probes respectively. +Its fields are: +.Bl -tag -width "uintptr_t if_addr" -offset indent +.It Vt string if_name +The interface name. +.It Vt int8_t if_local +A boolean value indicating whether or not the interface is a loopback interface. +.It Vt uintptr_t if_addr +A pointer to the +.Vt struct ifnet +which describes the interface. +See the +.Xr ifnet 9 +manual page. +.El +.Pp +The +.Vt ipv4info_t +argument contains the fields of the IP header for IPv4 packets. +This argument is +.Dv NULL +for IPv6 packets. +DTrace scripts should use the +.Fn ip_ver +field in the +.Vt ipinfo_t +argument to determine whether to use this argument. +Its fields are: +.Bl -tag -width "uint16_t ipv4_checksum" -offset indent +.It Vt uint8_t ipv4_ver +IP version. +This will always be 4 for IPv4 packets. +.It Vt uint8_t ipv4_ihl +The IP header length, including options, in 32-bit words. +.It Vt uint8_t ipv4_tos +IP type of service field. +.It Vt uint16_t ipv4_length +The total packet length, including the header, in bytes. +.It Vt uint16_t ipv4_ident +Identification field. +.It Vt uint8_t ipv4_flags +The IP flags. +.It Vt uint16_t ipv4_offset +The fragment offset of the packet. +.It Vt uint8_t ipv4_ttl +Time to live field. +.It Vt uint8_t ipv4_protocol +Next-level protocol ID. +.It Vt string ipv4_protostr +A string containing the name of the encapsulated protocol. +The protocol strings are defined in the +.Va protocol +array in +.Pa /usr/lib/dtrace/ip.d +.It Vt uint16_t ipv4_checksum +The IP checksum. +.It Vt ipaddr_t ipv4_src +IPv4 source address. +.It Vt ipaddr_t ipv4_dst +IPv4 destination address. +.It Vt string ipv4_saddr +A string representation of the source address. +.It Vt string ipv4_daddr +A string representation of the destination address. +.It Vt ipha_t *ipv4_hdr +A pointer to the raw IPv4 header. +.El +.Pp +The +.Vt ipv6info_t +argument contains the fields of the IP header for IPv6 packets. +Its fields are not set for IPv4 packets; as with the +.Vt ipv4info_t +argument, the +.Fn ip_ver +field should be used to determine whether this argument is valid. +Its fields are: +.Bl -tag -width "uint16_t ipv4_checksum" -offset indent +.It Vt uint8_t ipv6_ver +IP version. +This will always be 6 for IPv6 packets. +.It Vt uint8_t ipv6_tclass +The traffic class, used to set the differentiated services codepoint and +extended congestion notification flags. +.It Vt uint32_t ipv6_flow +The flow label of the packet. +.It Vt uint16_t ipv6_plen +The IP payload size, including extension headers, in bytes. +.It Vt uint8_t ipv6_nexthdr +An identifier for the type of the next header. +.It Vt string ipv6_nextstr +A string representation of the type of the next header. +.It Vt uint8_t ipv6_hlim +The hop limit. +.It Vt ip6_addr_t *ipv6_src +IPv6 source address. +.It Vt ip6_addr_t *ipv6_dst +IPv6 destination address. +.It Vt string ipv6_saddr +A string representation of the source address. +.It Vt string ipv6_daddr +A string representation of the destination address. +.It Vt ip6_t *ipv6_hdr +A pointer to the raw IPv6 header. +.El +.Sh FILES +.Bl -tag -width "/usr/lib/dtrace/ip.d" -compact +.It Pa /usr/lib/dtrace/ip.d +DTrace type and translator definitions for the +.Nm ip +provider. +.El +.Sh EXAMPLES +The following script counts received packets by remote host address. +.Bd -literal -offset indent +ip:::receive +{ + @num[args[2]->ip_saddr] = count(); +} +.Ed +.Pp +This script will print some details of each IP packet as it is sent or received +by the kernel: +.Bd -literal -offset indent +#pragma D option quiet +#pramga D option switchrate=10Hz + +dtrace:::BEGIN +{ + printf(" %10s %30s %-30s %8s %6s\n", "DELTA(us)", "SOURCE", + "DEST", "INT", "BYTES"); + last = timestamp; +} + +ip:::send +{ + this->elapsed = (timestamp - last) / 1000; + printf(" %10d %30s -> %-30s %8s %6d\n", this->elapsed, + args[2]->ip_saddr, args[2]->ip_daddr, args[3]->if_name, + args[2]->ip_plength); + last = timestamp; +} + +ip:::receive +{ + this->elapsed = (timestamp - last) / 1000; + printf(" %10d %30s <- %-30s %8s %6d\n", this->elapsed, + args[2]->ip_daddr, args[2]->ip_saddr, args[3]->if_name, + args[2]->ip_plength); + last = timestamp; +} +.Ed +.Sh COMPATIBILITY +This provider is compatible with the +.Nm ip +providers found in Solaris and Darwin. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace-tcp 4 , +.Xr dtrace-udp 4 , +.Xr ip 4 , +.Xr ip6 4 , +.Xr ifnet 9 , +.Xr SDT 9 +.Sh HISTORY +The +.Nm ip +provider first appeared in +.Fx +10.0. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . Property changes on: head/share/man/man4/dtrace-ip.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man4/dtrace-proc.4 =================================================================== --- head/share/man/man4/dtrace-proc.4 (nonexistent) +++ head/share/man/man4/dtrace-proc.4 (revision 281705) @@ -0,0 +1,264 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-PROC 4 +.Os +.Sh NAME +.Nm dtrace-proc +.Nd a DTrace provider for tracing events related to user processes +.Sh SYNOPSIS +.Fn proc:::create "struct proc *" "struct proc *" "int" +.Fn proc:::exec "char *" +.Fn proc:::exec-failure "int" +.Fn proc:::exec-success "char *" +.Fn proc:::exit "int" +.Fn proc:::signal-clear "int" "ksiginfo_t *" +.Fn proc:::signal-discard "struct thread *" "struct proc *" "int" +.Fn proc:::signal-send "struct thread *" "struct proc *" "int" +.Sh DESCRIPTION +The DTrace +.Nm proc +provider provides insight into events related to user processes: process and +thread creation and termination events, and process signalling. +.Pp +The +.Fn proc:::create +probe fires when a user process is created via the +.Xr fork 2 , +.Xr vfork 2 , +.Xr pdfork 2 , +or +.Xr rfork 2 +system calls. +In particular, kernel processes created with the +.Xr kproc 9 +KPI will not trigger this probe. +The +.Fn proc:::create +probe's first two arguments are the parent process and new child process, +respectively. +The third argument is a mask of +.Xr rfork 2 +flags indicating which process resources are to be shared between the parent and +child processes. +.Pp +The +.Fn proc:::exec +probe fires when a process attempts to execute a file. +Its argument is the specified filename for the file. +If the attempt fails because of an error, the +.Fn proc:::exec-failure +probe will subsequently fire, providing the corresponding +.Xr errno 2 +value in its first argument. +Otherwise, the +.Fn proc:::exec-success +probe will fire. +.Pp +The +.Fn proc:::exit +probe fires when a process exits or is terminated. +Its argument is the corresponding +.Dv SIGCHLD +signal code; valid values are documented in the +.Xr siginfo 3 +manual page and defined in +.Pa signal.h . +For example, when a process exits normally, the value of +.Dv args[0] +will be +.Dv CLD_EXITED . +.Pp +The +.Fn proc:::signal-send +probe fires when a signal is about to be sent to a process. +The +.Fn proc:::signal-discard +probe fires when a signal is sent to a process that ignores it. +This probe will fire after the +.Fn proc:::signal-send +probe for the signal in question. +The arguments to these probes are the thread and process to which the signal +will be sent, and the signal number of the signal. +Valid signal numbers are defined in the +.Xr signal 3 +manual page. +The +.Fn proc:::signal-clear +probe fires when a pending signal has been cleared by one of the +.Xr sigwait 2 , +.Xr sigtimedwait 2 , +or +.Xr sigwaitinfo 2 +system calls. +Its arguments are the signal number of the cleared signal, and a pointer to +the corresponding signal information. +The +.Vt siginfo_t +for the signal can be obtained from +.Dv args[1]->ksi_info . +.Sh ARGUMENTS +Though the +.Nm proc +provider probes use native +.Fx +arguments types, standard D types for processes and threads are available. +These are +.Vt psinfo_t +and +.Vt lwpsinfo_t +respectively, and are defined in +.Pa /usr/lib/dtrace/psinfo.d . +This file also defines two global variables, +.Va curpsinfo +and +.Va curlwpsinfo , +which provide representations of the current process and thread using these +types. +.Pp +The fields of +.Vt psinfo_t +are: +.Bl -tag -width "uintptr_t pr_addr" -offset indent +.It Vt int pr_nlwp +Number of threads in the process. +.It Vt pid_t pr_pid +Process ID. +.It Vt pid_t pr_ppid +Process ID of the parent process, or 0 if the process does not have a parent. +.It Vt pid_t pr_pgid +Process ID of the process group leader. +.It Vt pid_t pr_sid +Session ID, or 0 if the process does not belong to a session. +.It Vt pid_t pr_uid +Real user ID. +.It Vt pid_t pr_euid +Effective user ID. +.It Vt pid_t pr_gid +Real group ID. +.It Vt pid_t pr_egid +Effective group ID. +.It Vt uintptr_t pr_addr +Pointer to the +.Vt struct proc +for the process. +.It Vt string pr_psargs +Process arguments. +.It Vt u_int pr_arglen +Length of the process argument string. +.It Vt u_int pr_jailid +Jail ID of the process. +.El +.Pp +The fields of +.Vt lwpsinfo_t +are: +.Bl -tag -width "uintptr_t pr_wchar" -offset indent +.It Vt id_t pr_lwpid +Thread ID. +.It Vt int pr_flag +Thread flags. +.It Vt int pr_pri +Real scheduling priority of the thread. +.It Vt char pr_state +Currently always 0. +.It Vt char pr_sname +Currently always +.Ql ? . +.It Vt short pr_syscall +Currently always 0. +.It Vt uintptr_t pr_addr +Pointer to the +.Vt struct thread +for the thread. +.It Vt uintptr_t pr_wchan +Current wait address on which the thread is sleeping. +.El +.Sh FILES +.Bl -tag -width "/usr/lib/dtrace/psinfo.d" -compact +.It Pa /usr/lib/dtrace/psinfo.d +DTrace type and translator definitions for the +.Nm proc +provider. +.El +.Sh EXAMPLES +The following script logs process execution events as they occur: +.Bd -literal -offset indent +#pragma D option quiet + +proc:::exec-success +{ + printf("%s", curpsinfo->pr_psargs); +} +.Ed +.Pp +Note that the +.Dv pr_psargs +field is subject to the limit defined by the +.Va kern.ps_arg_cache_limit +sysctl. +In particular, processes with an argument list longer than the value defined by +this sysctl cannot be logged in this way. +.Sh COMPATIBILITY +The +.Nm proc +provider in +.Fx +is not compatible with the +.Nm proc +provider in Solaris. +In particular, +.Fx +uses the native +.Vt "struct proc" +and +.Vt "struct thread" +types for probe arguments rather than translated types. +Additionally, a number of +.Nm proc +provider probes found in Solaris are not currently available on +.Fx . +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr errno 2 , +.Xr fork 2 , +.Xr pdfork 2 , +.Xr rfork 2 , +.Xr vfork 2 , +.Xr siginfo 3 , +.Xr signal 3 , +.Xr dtrace-sched 4 , +.Xr kproc 9 +.Sh HISTORY +The +.Nm proc +provider first appeared in +.Fx +7.1. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . Property changes on: head/share/man/man4/dtrace-proc.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man4/dtrace-sched.4 =================================================================== --- head/share/man/man4/dtrace-sched.4 (nonexistent) +++ head/share/man/man4/dtrace-sched.4 (revision 281705) @@ -0,0 +1,227 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-SCHED 4 +.Os +.Sh NAME +.Nm dtrace-sched +.Nd a DTrace provider for tracing CPU scheduling events +.Sh SYNOPSIS +.Fn sched:::change-pri "struct thread *" "struct proc *" "uint8_t" +.Fn sched:::dequeue "struct thread *" "struct proc *" "void *" +.Fn sched:::enqueue "struct thread *" "struct proc *" "void *" "int" +.Fn sched:::lend-pri "struct thread *" "struct proc *" "uint8_t" "struct thread *" +.Fn sched:::load-change "int" "int" +.Fn sched:::off-cpu "struct thread *" "struct proc *" +.Fn sched:::on-cpu +.Fn sched:::preempt +.Fn sched:::remain-cpu +.Fn sched:::surrender "struct thread *" "struct proc *" +.Fn sched:::sleep +.Fn sched:::tick "struct thread *" "struct proc *" +.Fn sched:::wakeup "struct thread *" "struct proc *" +.Sh DESCRIPTION +The DTrace +.Nm sched +provider allows the tracing of events related to CPU scheduling in the 4BSD and +ULE schedulers. +.Pp +The +.Fn sched:::change-pri +probe fires when a thread's active scheduling priority is about to be updated. +The first two arguments are the thread whose priority is about to be changed, +and the corresponding process. +The third argument is the new absolute priority for the thread, while the +current value is given by +.Dv args[0]->td_priority . +The +.Fn sched:::lend-pri +probe fires when the currently-running thread elevates the priority of another +thread via priority lending. +The first two arguments are the thread whose priority is about to be changed, +and the corresponding process. +The third argument is the new absolute priority for the thread. +The fourth argument is the currently-running thread. +.Pp +The +.Fn sched:::dequeue +probe fires immediately before a runnable thread is removed from a scheduler +run queue. +This may occur when the thread is about to begin execution on a CPU, or because +the thread is being migrated to a different run queue. +The latter event may occur in several circumstances: the scheduler may be +attempting to rebalance load between multiple CPUs, the thread's scheduling +priority may have changed, or the thread's CPU affinity settings may have +changed. +The first two arguments to +.Fn sched:::dequeue +are the thread and corresponding process. +The third argument is currently always +.Dv NULL . +The +.Fn sched:::enqueue +probe fires when a runnable thread is about to be added to a scheduler run +queue. +Its first two arguments are the thread and corresponding process. +The third argument is currently always +.Dv NULL . +The fourth argument is a boolean value that is non-zero if the thread is +enqueued at the beginning of its run queue slot, and zero if the thread is +instead enqueued at the end. +.Pp +The +.Fn sched:::load-change +probe fires after the load of a thread queue is adjusted. +The first argument is the cpuid for the CPU associated with the thread queue, +and the second argument is the adjusted load of the thread queue, i.e., the +number of elements in the queue. +.Pp +The +.Fn sched:::off-cpu +probe is triggered by the scheduler suspending execution of the +currently-running thread, and the +.Fn sched:::on-cpu +probe fires when the current thread has been selected to run on a CPU and is +about to begin or resume execution. +The arguments to +.Fn sched:::off-cpu +are the thread and corresponding process selected to run following the +currently-running thread. +If these two threads are the same, the +.Fn sched:::remain-cpu +probe will fire instead. +.Pp +The +.Fn sched:::surrender +probe fires when the scheduler is called upon to make a scheduling decision by +a thread running on a different CPU, via an interprocessor interrupt. +The arguments to this probe are the interrupted thread and its corresponding +process. +This probe currently always fires in the context of the interrupted thread. +.Pp +The +.Fn sched:::preempt +probe will fire immediately before the currently-running thread is preempted. +When this occurs, the scheduler will select a new thread to run, and one of the +.Fn sched:::off-cpu +or +.Fn sched:::remain-cpu +probes will subsequently fire, depending on whether or not the scheduler selects +the preempted thread. +.Pp +The +.Fn sched:::sleep +probe fires immediately before the currently-running thread is about to suspend +execution and begin waiting for a condition to be met. +The +.Fn sched:::wakeup +probe fires when a thread is set up to resume execution after having gone to +sleep. +Its arguments are the thread being awoken, and the corresponding process. +.Pp +The +.Fn sched:::tick +fires before each scheduler clock tick. +Its arguments are the currently-running thread and its corresponding process. +.Sh ARGUMENTS +The +.Nm sched +provider probes use the kernel types +.Vt "struct proc" +and +.Vt "struct thread" +to represent processes and threads, respectively. +These structures have many fields and are defined in +.Pa sys/proc.h . +In a probe body, the currently-running thread can always be obtained with the +.Va curthread +global variable, which has type +.Vt "struct thread *" . +For example, when a running thread is about to sleep, the +.Fn sched:::sleep +probe fires in the context of that thread, which can be accessed using +.Va curthread . +The +.Va curcpu +global variable contains the cpuid of the CPU on which the currently-running +thread is executing. +.Sh EXAMPLES +The following script gives a breakdown of CPU utilization by process name: +.Bd -literal -offset indent +sched:::on-cpu +{ + self->ts = timestamp; +} + +sched:::off-cpu +/self->ts != 0/ +{ + @[execname] = sum((timestamp - self->ts) / 1000); + self->ts = 0; +} +.Ed +.Pp +Here, DTrace stores a timestamp each time a thread is scheduled to run, and +computes the time elapsed in microseconds when it is descheduled. +The results are summed by process name. +.Sh COMPATIBILITY +This provider is not compatible with the +.Nm sched +provider found in Solaris. +In particular, the probe argument types are native +.Fx +types, and the +.Fn sched:::cpucaps-sleep , +.Fn sched:::cpucaps-wakeup , +.Fn sched:::schedctl-nopreempt , +.Fn sched:::schedctl-preempt , +and +.Fn sched:::schedctl-yield +probes are not available in +.Fx . +.Pp +The +.Fn sched:::lend-pri +and +.Fn sched:::load-change +probes are specific to +.Fx . +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr sched_4bsd 4 , +.Xr sched_ule 4 , +.Xr SDT 9 , +.Xr sleepqueue 9 +.Sh HISTORY +The +.Nm sched +provider first appeared in +.Fx +8.4 and 9.1. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . Property changes on: head/share/man/man4/dtrace-sched.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man4/dtrace-tcp.4 =================================================================== --- head/share/man/man4/dtrace-tcp.4 (nonexistent) +++ head/share/man/man4/dtrace-tcp.4 (revision 281705) @@ -0,0 +1,400 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-TCP 4 +.Os +.Sh NAME +.Nm dtrace-tcp +.Nd a DTrace provider for tracing events related to the +.Xr tcp 4 +protocol +.Sh SYNOPSIS +.Fn tcp:::accept-established "pktinfo_t *" "csinfo_t *" "ipinfo_t *" \ + "tcpsinfo_t *" "tcpinfo_t *" +.Fn tcp:::accept-refused "pktinfo_t *" "csinfo_t *" "ipinfo_t *" \ + "tcpsinfo_t *" "tcpinfo_t *" +.Fn tcp:::connect-established "pktinfo_t *" "csinfo_t *" "ipinfo_t *" \ + "tcpsinfo_t *" "tcpinfo_t *" +.Fn tcp:::connect-refused "pktinfo_t *" "csinfo_t *" "ipinfo_t *" \ + "tcpsinfo_t *" "tcpinfo_t *" +.Fn tcp:::connect-request "pktinfo_t *" "csinfo_t *" "ipinfo_t *" \ + "tcpsinfo_t *" "tcpinfo_t *" +.Fn tcp:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "tcpsinfo_t *" \ + "tcpinfo_t *" +.Fn tcp:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "tcpsinfo_t *" \ + "tcpinfo_t *" +.Fn tcp:::state-change "void *" "csinfo_t *" "void *" "tcpsinfo_t *" "void *" \ + "tcplsinfo_t *" +.Sh DESCRIPTION +The DTrace +.Nm tcp +provider allows users to trace events in the +.Xr tcp 4 +protocol implementation. +This provider is similar to the +.Xr dtrace-ip 4 +and +.Xr dtrace-udp 4 +providers, but additionally contains probes corresponding to protocol events at +a level higher than packet reception and transmission. +All +.Nm tcp +probes except for +.Fn tcp:::state-change +have the same number and type of arguments. +The last three arguments are used to describe a TCP segment: the +.Vt ipinfo_t +argument exposes the version-agnostic fields of the IP header, while the +.Vt tcpinfo_t +argument exposes the TCP header, and the +.Vt tcpsinfo_t +argument describes details of the corresponding TCP connection state, if any. +Their fields are described in the ARGUMENTS section. +.Pp +The +.Fn tcp:::accept-established +probe fires when a remotely-initiated active TCP open succeeds. +At this point the new connection is in the ESTABLISHED state, and the probe +arguments expose the headers associated with the final ACK of the three-way +handshake. +The +.Fn tcp:::accept-refused +probe fires when a SYN arrives on a port without a listening socket. +The probe arguments expose the headers associated with the RST to be transmitted +to the remote host in response to the SYN segment. +.Pp +The +.Fn tcp:::connect-established , +.Fn tcp:::connect-refused , +and +.Fn tcp:::connect-request +probes are similar to the +.Ql accept +probes, except that they correspond to locally-initiated TCP connections. +The +.Fn tcp:::connect-established +probe fires when the SYN-ACK segment of a three-way handshake is received from +the remote host and a final ACK is prepared for transmission. +This occurs immediately after the local connection state transitions from +SYN-SENT to ESTABLISHED. +The probe arguments describe the headers associated with the received SYN-ACK +segment. +The +.Fn tcp:::connect-refused +probe fires when the local host receives a RST segment in response to a SYN +segment, indicating that the remote host refused to open a connection. +The probe arguments describe the IP and TCP headers associated with the received +RST segment. +The +.Fn tcp:::connect-request +probe fires as the kernel prepares to transmit the initial SYN segment of a +three-way handshake. +.Pp +The +.Fn tcp:::send +and +.Fn tcp:::receive +probes fire when the host sends or receives a TCP packet, respectively. +As with the +.Xr dtrace-udp 4 +provider, +.Nm tcp +probes fire only for packets sent by or to the local host; forwarded packets are +handled in the IP layer and are only visible to the +.Xr dtrace-ip 4 +provider. +.Pp +The +.Fn tcp:::state-change +probe fires upon local TCP connection state transitions. +Its first, third and fifth arguments are currently always +.Dv NULL . +Its last argument describes the from-state in the transition, and the to-state +can be obtained from +.Dv args[2]->tcps_state . +.Sh ARGUMENTS +The +.Vt pktinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uinptr_t pkt_addr" -offset indent +.It Vt uinptr_t pkt_addr +Always set to 0. +.El +.Pp +The +.Vt csinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uintptr_t cs_addr" -offset indent +.It Vt uintptr_t cs_addr +Always set to 0. +.It Vt uint64_t cs_cid +A pointer to the +.Vt struct inpcb +for this packet, or +.Dv NULL . +.It Vt pid_t cs_pid +Always set to 0. +.El +.Pp +The +.Vt ipinfo_t +type is a version-agnostic representation of fields from an IP header. +Its fields are described in the +.Xr dtrace-ip 4 +manual page. +.Pp +The +.Vt tcpsinfo_t +type is used to provide a stable representation of TCP connection state. +Some +.Nm tcp +probes, such as +.Fn tcp:::accept-refused , +fire in a context where there is no TCP connection; this argument is +.Dv NULL +in that case. +Its fields are: +.Bl -tag -width "uint16_t tcps_lport" -offset indent +.It Vt uintptr_t tcps_addr +The address of the corresponding TCP control block. +This is currently a pointer to a +.Vt struct tcpcb . +.It Vt int tcps_local +A boolean indicating whether the connection is local to the host. +Currently unimplemented and always set to -1. +.It Vt int tcps_active +A boolean indicating whether the connection was initiated by the local host. +Currently unimplemented and always set to -1. +.It Vt uint16_t tcps_lport +Local TCP port. +.It Vt uint16_t tcps_rport +Remote TCP port. +.It Vt string tcps_laddr +Local address. +.It Vt string tcps_raddr +Remote address. +.It Vt int32_t tcps_state +Current TCP state. +The valid TCP state values are given by the constants prefixed with +.Ql TCPS_ +in +.Pa /usr/lib/dtrace/tcp.d . +.It Vt uint32_t tcps_iss +Initial send sequence number. +.It Vt uint32_t tcps_suna +Initial sequence number of sent but unacknowledged data. +.It Vt uint32_t tcps_snxt +Next sequence number for send. +.It Vt uint32_t tcps_rack +Sequence number of received and acknowledged data. +.It Vt uint32_t tcps_rnxt +Next expected sequence number for receive. +.It Vt uint32_t tcps_swnd +TCP send window size. +.It Vt int32_t tcps_snd_ws +Window scaling factor for the TCP send window. +.It Vt uint32_t tcps_rwnd +TCP receive window size. +.It Vt int32_t tcps_rcv_ws +Window scaling factor for the TCP receive window. +.It Vt uint32_t tcps_cwnd +TCP congestion window size. +.It Vt uint32_t tcps_cwnd_ssthresh +Congestion window threshold at which slow start ends and congestion avoidance +begins. +.It Vt uint32_t tcps_sack_fack +Last sequence number selectively acknowledged by the receiver. +.It Vt uint32_t tcps_sack_snxt +Next selectively acknowledge sequence number at which to begin retransmitting. +.It Vt uint32_t tcps_rto +Round-trip timeout, in milliseconds. +.It Vt uint32_t tcps_mss +Maximum segment size. +.It Vt int tcps_retransmit +A boolean indicating that the local sender is retransmitting data. +.It Vt int tcps_srtt +Smoothed round-trip time. +.El +.Pp +The +.Vt tcpinfo_t +type exposes the fields in a TCP segment header in host order. +Its fields are: +.Bl -tag -width "struct tcphdr *tcp_hdr" -offset indent +.It Vt uint16_t tcp_sport +Source TCP port. +.It Vt uint16_t tcp_dport +Destination TCP port. +.It Vt uint32_t tcp_seq +Sequence number. +.It Vt uint32_t tcp_ack +Acknowledgement number. +.It Vt uint8_t tcp_offset +Data offset, in bytes. +.It Vt uint8_t tcp_flags +TCP flags. +.It Vt uint16_t tcp_window +TCP window size. +.It Vt uint16_t tcp_checksum +Checksum. +.It Vt uint16_t tcp_urgent +Urgent data pointer. +.It Vt struct tcphdr *tcp_hdr +A pointer to the raw TCP header. +.El +.Pp +The +.Vt tcplsinfo_t +type is used by the +.Fn tcp:::state-change +probe to provide the from-state of a transition. +Its fields are: +.Bl -tag -width "int32_t tcps_state" -offset indent +.It Vt int32_t tcps_state +A TCP state. +The valid TCP state values are given by the constants prefixed with +.Ql TCPS_ +in +.Pa /usr/lib/dtrace/tcp.d . +.El +.Sh FILES +.Bl -tag -width "/usr/lib/dtrace/tcp.d" -compact +.It Pa /usr/lib/dtrace/tcp.d +DTrace type and translator definitions for the +.Nm tcp +provider. +.El +.Sh EXAMPLES +The following script logs TCP segments in real time: +.Bd -literal -offset indent +#pragma D option quiet +#pragma D option switchrate=10hz + +dtrace:::BEGIN +{ + printf(" %3s %15s:%-5s %15s:%-5s %6s %s\n", "CPU", + "LADDR", "LPORT", "RADDR", "RPORT", "BYTES", "FLAGS"); +} + +tcp:::send +{ + this->length = args[2]->ip_plength - args[4]->tcp_offset; + printf(" %3d %16s:%-5d -> %16s:%-5d %6d (", cpu, args[2]->ip_saddr, + args[4]->tcp_sport, args[2]->ip_daddr, args[4]->tcp_dport, + this->length); + printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : ""); + printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : ""); + printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : ""); + printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : ""); + printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : ""); + printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : ""); + printf("%s", args[4]->tcp_flags == 0 ? "null " : ""); + printf("\b)\n"); +} + +tcp:::receive +{ + this->length = args[2]->ip_plength - args[4]->tcp_offset; + printf(" %3d %16s:%-5d <- %16s:%-5d %6d (", cpu, + args[2]->ip_daddr, args[4]->tcp_dport, args[2]->ip_saddr, + args[4]->tcp_sport, this->length); + printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : ""); + printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : ""); + printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : ""); + printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : ""); + printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : ""); + printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : ""); + printf("%s", args[4]->tcp_flags == 0 ? "null " : ""); + printf("\b)\n"); +} +.Ed +The following script logs TCP connection state changes as they occur: +.Bd -literal -offset indent +#pragma D option quiet +#pragma D option switchrate=25hz + +int last[int]; + +dtrace:::BEGIN +{ + printf(" %12s %-20s %-20s %s\n", + "DELTA(us)", "OLD", "NEW", "TIMESTAMP"); +} + +tcp:::state-change +{ + this->elapsed = (timestamp - last[args[1]->cs_cid]) / 1000; + printf(" %12d %-20s -> %-20s %d\n", this->elapsed, + tcp_state_string[args[5]->tcps_state], + tcp_state_string[args[3]->tcps_state], timestamp); + last[args[1]->cs_cid] = timestamp; +} + +tcp:::state-change +/last[args[1]->cs_cid] == 0/ +{ + printf(" %12s %-20s -> %-20s %d\n", "-", + tcp_state_string[args[5]->tcps_state], + tcp_state_string[args[3]->tcps_state], timestamp); + last[args[1]->cs_cid] = timestamp; +} +.Ed +.Sh COMPATIBILITY +This provider is compatible with the +.Nm tcp +provider in Solaris. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace-ip 4 , +.Xr dtrace-udp 4 , +.Xr tcp 4 , +.Xr SDT 9 +.Sh HISTORY +The +.Nm tcp +provider first appeared in +.Fx +10.0. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . +.Sh BUGS +The +.Fn tcp:::state-change +probe does not fire upon transitions to the TIME-WAIT state. +.Pp +The +.Vt tcps_local +and +.Vt tcps_active +fields of +.Vt tcpsinfo_t +are not filled in by the translator. Property changes on: head/share/man/man4/dtrace-tcp.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man4/dtrace-udp.4 =================================================================== --- head/share/man/man4/dtrace-udp.4 (nonexistent) +++ head/share/man/man4/dtrace-udp.4 (revision 281705) @@ -0,0 +1,199 @@ +.\" Copyright (c) 2015 Mark Johnston +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2015 +.Dt DTRACE-UDP 4 +.Os +.Sh NAME +.Nm dtrace-udp +.Nd a DTrace provider for tracing events related to the UDP protocol +.Sh SYNOPSIS +.Fn udp:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udpsinfo_t *" \ + "udpinfo_t *" +.Fn udp:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udpsinfo_t *" \ + "udpinfo_t *" +.Sh DESCRIPTION +The DTrace +.Nm udp +provider allows users to trace events in the +.Xr udp 4 +protocol implementation. +The +.Fn udp:::send +probe fires whenever the kernel prepares to transmit a UDP packet, and the +.Fn udp:::receive +probe fires whenever the kernel receives a UDP packet. +The arguments to these probes can be used to obtain detailed information about +the IP and UDP headers of the corresponding packet. +.Sh ARGUMENTS +The +.Vt pktinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uintptr_t pkt_addr" -offset indent +.It Vt uintptr_t pkt_addr +Always set to 0. +.El +.Pp +The +.Vt csinfo_t +argument is currently unimplemented and is included for compatibility with other +implementations of this provider. +Its fields are: +.Bl -tag -width "uintptr_t cs_addr" -offset indent +.It Vt uintptr_t cs_addr +Always set to 0. +.It Vt uint64_t cs_cid +A pointer to the +.Vt struct inpcb +for this packet, or +.Dv NULL . +.It Vt pid_t cs_pid +Always set to 0. +.El +.Pp +The +.Vt ipinfo_t +argument contains IP fields common to both IPv4 and IPv6 packets. +Its fields are: +.Bl -tag -width "uint32_t ip_plength" -offset indent +.It Vt uint8_t ip_ver +IP version of the packet, 4 for IPv4 packets and 6 for IPv6 packets. +.It Vt uint32_t ip_plength +IP payload size. +This does not include the size of the IP header or IPv6 option headers. +.It Vt string ip_saddr +IP source address. +.It Vt string ip_daddr +IP destination address. +.El +.Pp +The +.Vt udpsinfo_t +argument contains the state of the UDP connection associated with the packet. +Its fields are: +.Bl -tag -width "uintptr_t udps_addr" -offset indent +.It Vt uintptr_t udps_addr +Pointer to the +.Vt struct inpcb +containing the IP state for the associated socket. +.It Vt uint16_t udps_lport +Local UDP port. +.It Vt uint16_t udps_rport +Remote UDP port. +.It Vt string udps_laddr +Local IPv4 or IPv6 address. +.It Vt string udps_raddr +Remote IPv4 or IPv6 address. +.El +.Pp +The +.Vt udpinfo_t +argument is the raw UDP header of the packet, with all fields in host order. +Its fields are: +.Bl -tag -width "struct udphdr *udp_hdr" -offset indent +.It Vt uint16_t udp_sport +Source UDP port. +.It Vt uint16_t udp_dport +Destination UDP port. +.It Vt uint16_t udp_length +Length of the UDP header and payload, in bytes. +.It Vt uint16_t udp_checksum +A checksum of the UDP header and payload, or 0 if no checksum was calculated. +.It Vt struct udphdr *udp_hdr +A pointer to the raw UDP header. +.El +.Sh FILES +.Bl -tag -width "/usr/lib/dtrace/udp.d" -compact +.It Pa /usr/lib/dtrace/udp.d +DTrace type and translator definitions for the +.Nm udp +provider. +.El +.Sh EXAMPLES +The following script counts transmitted packets by destination port. +.Bd -literal -offset indent +udp:::send +{ + @num[args[4]->udp_dport] = count(); +} +.Ed +.Pp +This script will print some details of each UDP packet as it is sent or received +by the kernel: +.Bd -literal -offset indent +#pragma D option quiet +#pragma D option switchrate=10Hz + +dtrace:::BEGIN +{ + printf(" %10s %36s %-36s %6s\n", "DELTA(us)", "SOURCE", + "DEST", "BYTES"); + last = timestamp; +} + +udp:::send +{ + this->elapsed = (timestamp - last) / 1000; + self->dest = strjoin(strjoin(args[2]->ip_daddr, ":"), + lltostr(args[4]->udp_dport)); + printf(" %10d %30s:%-5d -> %-36s %6d\n", this->elapsed, + args[2]->ip_saddr, args[4]->udp_sport, + self->dest, args[4]->udp_length); + last = timestamp; +} + +udp:::receive +{ + this->elapsed = (timestamp - last) / 1000; + self->dest = strjoin(strjoin(args[2]->ip_saddr, ":"), + lltostr(args[4]->udp_sport)); + printf(" %10d %30s:%-5d <- %-36s %6d\n", this->elapsed, + args[2]->ip_daddr, args[4]->udp_dport, + self->dest, args[4]->udp_length); + last = timestamp; +} +.Ed +.Sh COMPATIBILITY +This provider is compatible with the +.Nm udp +provider in Solaris. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace-ip 4 , +.Xr dtrace-tcp 4 , +.Xr udp 4 , +.Xr SDT 9 +.Sh HISTORY +The +.Nm udp +provider first appeared in +.Fx +10.0. +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org . Property changes on: head/share/man/man4/dtrace-udp.4 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/share/man/man9/SDT.9 =================================================================== --- head/share/man/man9/SDT.9 (revision 281704) +++ head/share/man/man9/SDT.9 (revision 281705) @@ -1,340 +1,346 @@ -.\" Copyright (c) 2013 Mark Johnston +.\" Copyright (c) 2013-2015 Mark Johnston .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd April 18, 2015 .Dt SDT 9 .Os .Sh NAME .Nm SDT .Nd a DTrace framework for adding statically-defined tracing probes .Sh SYNOPSIS .In sys/param.h .In sys/queue.h .In sys/sdt.h .Fn SDT_PROVIDER_DECLARE prov .Fn SDT_PROVIDER_DEFINE prov .Fn SDT_PROBE_DECLARE prov mod func name .Fn SDT_PROBE_DEFINE prov mod func name .Fn SDT_PROBE_DEFINE0 prov mod func name .Fn SDT_PROBE_DEFINE1 prov mod func name arg0 .Fn SDT_PROBE_DEFINE2 prov mod func name arg0 arg1 .Fn SDT_PROBE_DEFINE3 prov mod func name arg0 arg1 arg2 .Fn SDT_PROBE_DEFINE4 prov mod func name arg0 arg1 arg2 arg3 .Fn SDT_PROBE_DEFINE5 prov mod func name arg0 arg1 arg2 arg3 arg4 .Fn SDT_PROBE_DEFINE6 prov mod func name arg0 arg1 arg2 arg3 arg4 arg5 .Fn SDT_PROBE_DEFINE7 prov mod func name arg0 arg1 arg2 arg3 arg4 arg5 \ arg6 .Fn SDT_PROBE_DEFINE0_XLATE prov mod func name .Fn SDT_PROBE_DEFINE1_XLATE prov mod func name arg0 xarg0 .Fn SDT_PROBE_DEFINE2_XLATE prov mod func name arg0 xarg0 arg1 xarg1 .Fn SDT_PROBE_DEFINE3_XLATE prov mod func name arg0 xarg0 arg1 xarg1 \ arg2 xarg2 .Fn SDT_PROBE_DEFINE4_XLATE prov mod func name arg0 xarg0 arg1 xarg1 \ arg2 xarg2 arg3 xarg3 .Fn SDT_PROBE_DEFINE5_XLATE prov mod func name arg0 xarg0 arg1 xarg1 \ arg2 xarg2 arg3 xarg3 arg4 xarg4 .Fn SDT_PROBE_DEFINE6_XLATE prov mod func name arg0 xarg0 arg1 xarg1 \ arg2 xarg2 arg3 xarg3 arg4 xarg4 arg5 xarg5 .Fn SDT_PROBE_DEFINE7_XLATE prov mod func name arg0 xarg0 arg1 xarg1 \ arg2 xarg2 arg3 xarg3 arg4 xarg4 arg5 xarg5 arg6 xarg6 .Fn SDT_PROBE0 prov mod func name .Fn SDT_PROBE1 prov mod func name arg0 .Fn SDT_PROBE2 prov mod func name arg0 arg1 .Fn SDT_PROBE3 prov mod func name arg0 arg1 arg2 .Fn SDT_PROBE4 prov mod func name arg0 arg1 arg2 arg3 .Fn SDT_PROBE5 prov mod func name arg0 arg1 arg2 arg3 arg4 .Fn SDT_PROBE6 prov mod func name arg0 arg1 arg2 arg3 arg4 arg5 .Fn SDT_PROBE7 prov mod func name arg0 arg1 arg2 arg3 arg4 arg5 arg6 .Sh DESCRIPTION The .Nm macros allow programmers to define static trace points in kernel code. These trace points are used by the .Nm framework to create DTrace probes, allowing the code to be instrumented using .Xr dtrace 1 . By default, .Nm trace points are disabled and have no effect on the surrounding code. When a DTrace probe corresponding to a given trace point is enabled, threads that execute the trace point will call a handler and cause the probe to fire. Moreover, trace points can take arguments, making it possible to pass data to the DTrace framework when an enabled probe fires. .Pp Multiple trace points may correspond to a single DTrace probe, allowing programmers to create DTrace probes that correspond to logical system events rather than tying probes to specific code execution paths. For instance, a DTrace probe corresponding to the arrival of an IP packet into the network stack may be defined using two .Nm trace points: one for IPv4 packets and one for IPv6 packets. .Pp In addition to defining DTrace probes, the .Nm macros allow programmers to define new DTrace providers, making it possible to namespace logically-related probes. An example is FreeBSD's sctp provider, which contains .Nm probes for FreeBSD's .Xr sctp 4 implementation. .Pp The .Fn SDT_PROVIDER_DECLARE and .Fn SDT_PROVIDER_DEFINE macros are used respectively to declare and define a DTrace provider named .Ar prov with the .Nm framework. A provider need only be defined once; however, the provider must be declared before defining any .Nm probes belonging to that provider. .Pp Similarly, the .Fn SDT_PROBE_DECLARE and .Fn SDT_PROBE_DEFINE* macros are used to declare and define DTrace probes using the .Nm framework. Once a probe has been defined, trace points for that probe may be added to kernel code. DTrace probe identifiers consist of a provider, module, function and name, all of which may be specified in the .Nm probe definition. Note that probes should not specify a module name: the module name of a probe is used to determine whether or not it should be destroyed when a kernel module is unloaded. See the .Sx BUGS section. Note in particular that probes must not be defined across multiple kernel modules. .Pp If .Ql - character (dash) is wanted in a probe name, then it should be represented as .Ql __ (double underscore) in the probe .Ar name parameter passed to various .Fn SDT_* macros, because of technical reasons (a dash is not valid in C identifiers). .Pp The .Fn SDT_PROBE_DEFINE* macros also allow programmers to declare the types of the arguments that are passed to probes. This is optional; if the argument types are omitted (through use of the .Fn SDT_PROBE_DEFINE macro), users wishing to make use of the arguments will have to manually cast them to the correct types in their D scripts. It is strongly recommended that probe definitions include a declaration of their argument types. .Pp The .Fn SDT_PROBE_DEFINE*_XLATE macros are used for probes whose argument types are to be dynamically translated to the types specified by the corresponding .Ar xarg arguments. This is mainly useful when porting probe definitions from other operating systems. As seen by .Xr dtrace 1 , the arguments of a probe defined using these macros will have types which match the .Ar xarg types in the probe definition. However, the arguments passed in at the trace point will have types matching the native argument types in the probe definition, and thus the native type is dynamically translated to the translated type. So long as an appropriate translator is defined in .Pa /usr/lib/dtrace , scripts making use of the probe need not concern themselves with the underlying type of a given .Nm probe argument. .Pp The .Fn SDT_PROBE* macros are used to create .Nm trace points. They are meant to be added to executable code and can be used to instrument the code in which they are called. .Sh PROVIDERS A number of kernel DTrace providers are available. In general, these providers define stable interfaces and should be treated as such: existing D scripts may be broken if a probe is renamed or its arguments are modified. However, it is often useful to define ad-hoc .Nm probes for debugging a subsystem or driver. Similarly, a developer may wish to provide a group of .Nm probes without committing to their future stability. Such probes should be added to the .Ql sdt provider instead of defining a new provider. .Sh EXAMPLES The DTrace providers available on the current system can be listed with .Bd -literal -offset indent dtrace -l | sed 1d | awk '{print $2}' | sort -u .Ed .Pp A detailed list of the probes offered by a given provider can be obtained by specifying the provider using the .Fl P flag. For example, to view the probes and argument types for the .Ql sched provider, run .Bd -literal -offset indent dtrace -lv -P sched .Ed .Pp The following probe definition will create a DTrace probe called .Ql icmp:::receive-unreachable , which would hypothetically be triggered when the kernel receives an ICMP packet of type Destination Unreachable: .Bd -literal -offset indent SDT_PROVIDER_DECLARE(icmp); SDT_PROBE_DEFINE1(icmp, , , receive__unreachable, "struct icmp *"); .Ed This particular probe would take a single argument: a pointer to the struct containing the ICMP header for the packet. Note that the module name of this probe is not specified. .Pp Consider a DTrace probe which fires when the network stack receives an IP packet. Such a probe would be defined by multiple tracepoints: .Bd -literal -offset indent SDT_PROBE_DEFINE3(ip, , , receive, "struct ifnet *", "struct ip *", "struct ip6_hdr *"); int ip_input(struct mbuf *m) { struct ip *ip; ... ip = mtod(m, struct ip *); SDT_PROBE3(ip, , , receive, m->m_pkthdr.rcvif, ip, NULL); ... } int ip6_input(struct mbuf *m) { struct ip6_hdr *ip6; ... ip6 = mtod(m, struct ip6_hdr *); SDT_PROBE3(ip, , , receive, m->m_pkthdr.rcvif, NULL, ip6); ... } .Ed In particular, the probe should fire when the kernel receives either an IPv4 packet or an IPv6 packet. .Pp Consider the ICMP probe discussed above. We note that its second argument is of type .Ar struct icmp , which is a type defined in the FreeBSD kernel to represent the ICMP header of an ICMP packet, defined in RFC 792. Linux has a corresponding type, .Ar struct icmphdr , for the same purpose, but its field names differ from FreeBSD's .Ar struct icmp . Similarly, illumos defines the .Ar icmph_t type, again with different field names. Even with the .Ql icmp:::pkt-receive probes defined in all three operating systems, one would still have to write OS-specific scripts to extract a given field out of the ICMP header argument. Dynamically-translated types solve this problem: one can define an OS-independent .Xr c 7 struct to represent an ICMP header, say .Ar struct icmp_hdr_dt , and define translators from each of the three OS-specific types to .Ar struct icmp_hdr_dt , all in the .Xr dtrace 1 library path. Then the FreeBSD probe above can be defined with: .Bd -literal -offset indent SDT_PROBE_DEFINE1_XLATE(ip, , , receive, "struct icmp *", "struct icmp_hdr_dt *"); .Ed .Sh SEE ALSO -.Xr dtrace 1 +.Xr dtrace 1 , +.Xr dtrace-io 4 , +.Xr dtrace-ip 4 , +.Xr dtrace-proc 4 , +.Xr dtrace-sched 4 , +.Xr dtrace-tcp 4 , +.Xr dtrace-udp 4 .Sh AUTHORS .An -nosplit DTrace and the .Nm framework were originally ported to FreeBSD from Solaris by .An John Birrell Aq Mt jb@FreeBSD.org . This manual page was written by .An Mark Johnston Aq Mt markj@FreeBSD.org . .Sh BUGS The .Nm macros allow the module and function names of a probe to be specified as part of a probe definition. The DTrace framework uses the module name of probes to determine which probes should be destroyed when a kernel module is unloaded, so the module name of a probe should match the name of the module in which its defined. .Nm will set the module name properly if it is left unspecified in the probe definition; see the .Sx EXAMPLES section. .Pp One of the goals of the original .Nm implementation (and by extension, of FreeBSD's port) is that inactive .Nm probes should have no performance impact. This is unfortunately not the case; .Nm trace points will add a small but non-zero amount of latency to the code in which they are defined. A more sophisticated implementation of the probes will help alleviate this problem.