1N/A# hotkernel - sample on-CPU kernel-level functions and modules. 1N/A# Written using Perl and DTrace (Solaris 10 03/05) 1N/A# This samples the on-CPU function at 1001 Hertz, for a simple yet 1N/A# effective kernel-level profiling tool for sampling exclusive function time. 1N/A# The output will identify which function is on the CPU the most - which is 1N/A# $Id: hotkernel 65 2007-10-04 11:09:40Z brendan $ 1N/A# USAGE: hotkernel [-hm] 1N/A# -m # match modules, not functions 1N/A# hotkernel # sample kernel functions 1N/A# hotkernel -m # sample kernel modules 1N/A# FUNCTION Function name 1N/A# COUNT Number of samples 1N/A# PCNT Percentage of total samples 1N/A# COPYRIGHT: Copyright (c) 2006 Brendan Gregg. 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# See the License for the specific language governing permissions 1N/A# and limitations under the License. 1N/A# Author: Brendan Gregg [Sydney, Australia] 1N/A# 29-Jun-2006 Brendan Gregg Created this. 1N/A# 29-Jun-2006 " " Last update. 1N/A# Command Line Arguments 1N/A# Declare DTrace script 1N/A/usr/sbin/dtrace -n ' 1N/A #pragma D option quiet 1N/A profile:::profile-1001hz 1N/A \@pc[arg0] = count(); 1N/A printa("%a %\@d\\n", \@pc); 1N/A# Run DTrace, process output 1N/Aprint "Sampling... Hit Ctrl-C to end.\n";
1N/Aprintf "\n%-52s %8s %6s\n",
$mods ?
"MODULE" :
"FUNCTION",
"COUNT",
"PCNT";
1N/A print STDERR " hotkernel # sample kernel functions\n"; 1N/A print STDERR " hotkernel -m # sample kernel modules\n";