4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
15 * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
19 * time: Seconds since the epoch
20 * @ops: The number of reads and writes per interval
21 * @bytes: Bytes read and written per interval
22 * @latencies: Mean read and write latency per interval in ns
23 * These aggregations are indexed with read/write for back end
24 * statistics and zfs_read/zfs_write for ZPL level statistics.
27 #
pragma D option aggsortkey
28 #
pragma D option quiet
32 @ops["read"] = count();
33 @ops["write"] = count();
34 @ops["zfs_read"] = count();
35 @ops["zfs_write"] = count();
36 @latencies["read"] = avg(0);
37 @latencies["write"] = avg(0);
38 @latencies["zfs_read"] = avg(0);
39 @latencies["zfs_write"] = avg(0);
40 @bytes["read"] = sum(0);
41 @bytes["write"] = sum(0);
42 @bytes["zfs_read"] = sum(0);
43 @bytes["zfs_write"] = sum(0);
49 fbt
:zfs
:zfs_read
:entry
,
50 fbt
:zfs
:zfs_write
:entry
52 this->zp
= (znode_t
*)args
[0]->v_data
;
53 this->poolname
= stringof(this->zp
->z_zfsvfs
->z_os
->os_spa
->spa_name
);
56 fbt
:zfs
:zfs_read
:entry
,
57 fbt
:zfs
:zfs_write
:entry
58 / this->poolname
== $$1 /
61 @ops[probefunc
] = count();
62 @bytes[probefunc
] = sum(args
[1]->uio_resid
);
65 fbt
:zfs
:zfs_read
:return,
66 fbt
:zfs
:zfs_write
:return
69 @latencies[probefunc
] = avg(timestamp
- self
->ts
);
74 / strstr($$2, args
[1]->dev_statname
) != NULL
/
76 start
[args
[0]->b_edev
, args
[0]->b_blkno
] = timestamp
;
80 / start
[args
[0]->b_edev
, args
[0]->b_blkno
] /
82 this->elapsed
= timestamp
- start
[args
[0]->b_edev
, args
[0]->b_blkno
];
83 this->name
= args
[0]->b_flags
& B_READ ?
"read" : "write";
84 @ops[this->name
] = count();
85 @bytes[this->name
] = sum(args
[0]->b_bcount
);
86 @latencies[this->name
] = avg(this->elapsed
);
87 start
[args
[0]->b_edev
, args
[0]->b_blkno
] = 0;
92 printf("%u\n", `time);
93 printa("ops_%-21s%@u\n", @ops);
94 printa("bytes_%-21s%@u\n", @bytes);
95 printa("latencies_%-21s%@u\n", @latencies);