Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| dtrace:examples [2009/03/22 23:03] – Updated privilege check example to use priv provider. RobertWatson | dtrace:examples [2020/12/25 15:22] (current) – Update probe name for priv-err RobertWatson | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| < | < | ||
| - | callout_execute::: | + | callout_execute::: |
| { | { | ||
| self-> | self-> | ||
| } | } | ||
| - | callout_execute::: | + | callout_execute::: |
| { | { | ||
| Line 55: | Line 55: | ||
| ===== Measure total time spent in each callout handler over 1-second intervals ===== | ===== Measure total time spent in each callout handler over 1-second intervals ===== | ||
| - | This script is loosely based on a similar one from [[/OpenSolaris|OpenSolaris]]'s sdt Provider page, but due to slight differences in types and probe naming, we can't use theirs verbatim: | + | This script is loosely based on a similar one from %%OpenSolaris%%'s sdt Provider page, but due to slight differences in types and probe naming, we can't use theirs verbatim: |
| < | < | ||
| #pragma D option quiet | #pragma D option quiet | ||
| - | callout_execute::: | + | callout_execute::: |
| { | { | ||
| self-> | self-> | ||
| } | } | ||
| - | callout_execute::: | + | callout_execute::: |
| { | { | ||
| Line 86: | Line 86: | ||
| Submitted by [[/ | Submitted by [[/ | ||
| + | |||
| + | Note: Probes were named callout_start and callout_end in older versions. | ||
| This script works by measuring the time at the start of a callout, then again on termination and billing that time incrementally to the callout function that ran. Once a second, we print the results and reset the counters. | This script works by measuring the time at the start of a callout, then again on termination and billing that time incrementally to the callout function that ran. Once a second, we print the results and reset the counters. | ||
| Line 168: | Line 170: | ||
| < | < | ||
| - | priv:::priv_err | + | priv:::priv-err |
| { | { | ||
| @traces[stack()] = count(); | @traces[stack()] = count(); | ||
| Line 215: | Line 217: | ||
| ===== Histogram of time spent waiting on NFSv3 RPCs by system call ===== | ===== Histogram of time spent waiting on NFSv3 RPCs by system call ===== | ||
| This script measures all time spent waiting on RPC replies for each system call, and then generates a histogram of those times sorted by system call name. | This script measures all time spent waiting on RPC replies for each system call, and then generates a histogram of those times sorted by system call name. | ||
| + | |||
| + | Exists in %%FreeBSD%% as '' | ||
| < | < | ||
| Line 303: | Line 307: | ||
| 16777216 | | 16777216 | | ||
| </ | </ | ||
| + | |||
| + | ===== Trace of NFS RPCs and attribute/ | ||
| + | |||
| + | This script creates a trace of NFS RPCs, NFS attribute cache activity, and NFS access cache activity, along with the system call that instigated the activity. | ||
| + | |||
| + | Exists in %%FreeBSD%% as '' | ||
| + | |||
| + | < | ||
| + | syscall::: | ||
| + | { | ||
| + | |||
| + | self-> | ||
| + | } | ||
| + | |||
| + | syscall::: | ||
| + | { | ||
| + | |||
| + | self-> | ||
| + | } | ||
| + | |||
| + | nfsclient::: | ||
| + | / | ||
| + | { | ||
| + | |||
| + | trace(probemod); | ||
| + | trace(arg0); | ||
| + | trace(execname); | ||
| + | trace(self-> | ||
| + | } | ||
| + | |||
| + | nfsclient::: | ||
| + | / | ||
| + | { | ||
| + | |||
| + | trace(probemod); | ||
| + | trace(arg0); | ||
| + | trace(execname); | ||
| + | trace(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Submitted by [[/ | ||
| + | |||
| + | < | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 530 flush: | ||
| + | 1 532 get: | ||
| + | 1 568 | ||
| + | 1 569 getattr: | ||
| + | 1 533 | ||
| + | 1 527 | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 530 flush: | ||
| + | 1 532 get: | ||
| + | 1 568 | ||
| + | 1 569 getattr: | ||
| + | 1 533 | ||
| + | 1 531 | ||
| + | 1 602 fsstat: | ||
| + | 1 603 | ||
| + | 1 533 | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 531 | ||
| + | 1 531 | ||
| + | 1 531 | ||
| + | 1 527 | ||
| + | 1 527 | ||
| + | 1 531 | ||
| + | </ | ||
| + | |||
| + | ===== Distribution of name cache entry string lengths ===== | ||
| + | |||
| + | This example script captures a distribution of the length of strings added to the VFS name cache. | ||
| + | |||
| + | < | ||
| + | vfs: | ||
| + | { | ||
| + | |||
| + | @distribution = quantize(strlen((string)arg1)); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Submitted by [[/ | ||
| + | |||
| + | < | ||
| + | value ------------- Distribution ------------- count | ||
| + | 0 | 0 | ||
| + | 1 | 2 | ||
| + | 2 |@@ 296 | ||
| + | 4 |@@@@@@@@@@@ | ||
| + | 8 |@@@@@@@@@@@@@@@@ | ||
| + | 16 |@@@@@@@@@@@ | ||
| + | 32 | 69 | ||
| + | 64 | 2 | ||
| + | 128 | 0 | ||
| + | </ | ||
| + | |||
| + | A similar script to look at the distribution of lengths in hits could be generated using the probe vfs: | ||
| + | |||
| + | ---- | ||
| + | |||
| + | {{tag> | ||