0N/A# hotkernel - sample on-CPU kernel-level functions and modules. 0N/A# Written using Perl and DTrace (Solaris 10 03/05) 0N/A# This samples the on-CPU function at 1001 Hertz, for a simple yet 0N/A# effective kernel-level profiling tool for sampling exclusive function time. 0N/A# The output will identify which function is on the CPU the most - which is 2362N/A# $Id: hotkernel 65 2007-10-04 11:09:40Z brendan $ 0N/A# USAGE: hotkernel [-hm] 0N/A# -m # match modules, not functions 0N/A# hotkernel # sample kernel functions 0N/A# hotkernel -m # sample kernel modules 0N/A# FUNCTION Function name 2365N/A# PCNT Percentage of total samples 0N/A# COPYRIGHT: Copyright (c) 2006 Brendan Gregg. 0N/A# The contents of this file are subject to the terms of the 0N/A# Common Development and Distribution License, Version 1.0 only 0N/A# (the "License"). You may not use this file except in compliance 0N/A# See the License for the specific language governing permissions 0N/A# and limitations under the License. 0N/A# Author: Brendan Gregg [Sydney, Australia] 0N/A# 29-Jun-2006 Brendan Gregg Created this. 0N/A# 29-Jun-2006 " " Last update. 0N/A# Command Line Arguments printa("%a %\@d\\n", \@pc); # Run DTrace, process output print "Sampling... Hit Ctrl-C to end.\n";
next if $line =~ /^\s*$/; printf "\n%-52s %8s %6s\n",
$mods ?
"MODULE" :
"FUNCTION",
"COUNT",
"PCNT";
print STDERR "USAGE: hotkernel [-hm]\n"; print STDERR " hotkernel # sample kernel functions\n"; print STDERR " hotkernel -m # sample kernel modules\n";