#!/usr/sbin/dtrace -s /* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Copyright (c) 2016, Joyent, Inc. */ /* * fastclatencytime: dump fast client request latency information over time */ #pragma D option aggpack #pragma D option aggsortkey #pragma D option aggzoom #pragma D option quiet #pragma D option zdefs BEGIN { printf("Latencies are reported in milliseconds. CTRL-C to stop.\n"); } fastclient*:::rpc-start { pending[pid, arg0, arg1] = copyinstr(arg2); starts[pid, arg0, arg1] = timestamp; } fastclient*:::rpc-done /pending[pid, arg0, arg1] != 0/ { @[pending[pid, arg0, arg1], walltimestamp / 1000000000] = quantize((timestamp - starts[pid, arg0, arg1]) / 1000000); pending[pid, arg0, arg1] = 0; starts[pid, arg0, arg1] = 0; }