1N/A#!/usr/sbin/dtrace -Cs
1N/A/*
1N/A * kstat_types.d - Trace kstat reads with type info.
1N/A * Written using DTrace (Solaris 10 3/05)
1N/A *
1N/A * kstat is the Kernel Statistics framework, which is used by tools
1N/A * such as vmstat, iostat, mpstat and sar. Try running vmstat while
1N/A * kstat_types.d is tracing - you should see details of the kstat
1N/A * reads performed.
1N/A *
1N/A * $Id: kstat_types.d 3 2007-08-01 10:50:08Z brendan $
1N/A *
1N/A * USAGE: kstat_types.d (early release, check for updates)
1N/A *
1N/A * FIELDS:
1N/A * CMD command name
1N/A * CLASS kstat class (ks_class)
1N/A * TYPE kstat type as a string (ks_type)
1N/A * MOD:INS:NAME kstat module:instance:name
1N/A *
1N/A * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
1N/A *
1N/A * CDDL HEADER START
1N/A *
1N/A * The contents of this file are subject to the terms of the
1N/A * Common Development and Distribution License, Version 1.0 only
1N/A * (the "License"). You may not use this file except in compliance
1N/A * with the License.
1N/A *
1N/A * You can obtain a copy of the license at Docs/cddl1.txt
1N/A * or http://www.opensolaris.org/os/licensing.
1N/A * See the License for the specific language governing permissions
1N/A * and limitations under the License.
1N/A *
1N/A * CDDL HEADER END
1N/A *
1N/A * 11-Feb-2006 Brendan Gregg Created this.
1N/A * 11-Feb-2006 " " Last update.
1N/A */
1N/A
1N/A#include <sys/isa_defs.h>
1N/A
1N/A#pragma D option quiet
1N/A
1N/Adtrace:::BEGIN
1N/A{
1N/A printf("%-16s %-16s %-6s %s\n",
1N/A "CMD", "CLASS", "TYPE", "MOD:INS:NAME");
1N/A}
1N/A
1N/Afbt::read_kstat_data:entry
1N/A{
1N/A#ifdef _MULTI_DATAMODEL
1N/A self->uk = (kstat32_t *)copyin((uintptr_t)arg1, sizeof (kstat32_t));
1N/A#else
1N/A self->uk = (kstat_t *)copyin((uintptr_t)arg1, sizeof (kstat_t));
1N/A#endif
1N/A printf("%-16s %-16s %-6s %s:%d:%s\n", execname,
1N/A self->uk->ks_class == "" ? "." : self->uk->ks_class,
1N/A self->uk->ks_type == 0 ? "raw"
1N/A : self->uk->ks_type == 1 ? "named"
1N/A : self->uk->ks_type == 2 ? "intr"
1N/A : self->uk->ks_type == 3 ? "io"
1N/A : self->uk->ks_type == 4 ? "timer" : "?",
1N/A self->uk->ks_module, self->uk->ks_instance, self->uk->ks_name);
1N/A}