File: //opt/perf/examples/adviser/proc_num_files
# Adviser Script: proc_num_files
#
# This script looks for processes that have more than 10 files open
# (PROC_FILE_OPEN). When found, it prints out the name of the process
# and the number of open files.
#
# Note: You must use a "proc_file loop" within the "process loop" in
# order access any of the PROC_FILE_* metrics associated with
# the specified process.
#
# The glance adviser capability allows you to print metrics to stdout.
# You can redirect this output to a file, if desired.
headers_printed = headers_printed
if headers_printed == 0 then {
print "Time Proc Name Proc_File_Open"
headers_printed = 1
}
process loop {
num_file_open = 0
proc_file loop {
if proc_file_open > 10 then {
num_file_open = proc_file_open
}
}
if num_file_open > 10 then {
print gbl_stattime, " ", proc_proc_name|12, " ",
num_file_open|6
}
}