2N/A# hotkernel - sample on-CPU kernel-level functions and modules. 2N/A# Written using Perl and DTrace (Solaris 10 03/05) 2N/A# This samples the on-CPU function at 1001 Hertz, for a simple yet 2N/A# effective kernel-level profiling tool for sampling exclusive function time. 2N/A# The output will identify which function is on the CPU the most - which is 2N/A# $Id: hotkernel 65 2007-10-04 11:09:40Z brendan $ 2N/A# USAGE: hotkernel [-hm] 2N/A# -m # match modules, not functions 2N/A# hotkernel # sample kernel functions 2N/A# hotkernel -m # sample kernel modules 2N/A# FUNCTION Function name 2N/A# COUNT Number of samples 2N/A# PCNT Percentage of total samples 2N/A# COPYRIGHT: Copyright (c) 2006 Brendan Gregg. 2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License, Version 1.0 only 2N/A# (the "License"). You may not use this file except in compliance # See the License for the specific language governing permissions # and limitations under the License. # Author: Brendan Gregg [Sydney, Australia] # 29-Jun-2006 Brendan Gregg Created this. # 29-Jun-2006 " " Last update. 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";