1#!/usr/sbin/dtrace -s 2/* 3 * minfbypid.d - minor faults by PID. 4 * Written using DTrace (Solaris 10 3/05) 5 * 6 * This program prints a report of minor faults by PID. Minor faults are 7 * an indiction of memory consumption. This script could be used to help 8 * determine which process was consuming the most memory during the sample. 9 * 10 * 20-Apr-2006, ver 1.01 11 * 12 * USAGE: minfbypid.d # hit Ctrl-C to end sample 13 * 14 * FIELDS: 15 * PID process ID 16 * CMD process name 17 * MINFAULTS number of minor faults 18 * 19 * This is based on a script from DExplorer. 20 * 21 * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg. 22 * 23 * CDDL HEADER START 24 * 25 * The contents of this file are subject to the terms of the 26 * Common Development and Distribution License, Version 1.0 only 27 * (the "License"). You may not use this file except in compliance 28 * with the License. 29 * 30 * You can obtain a copy of the license at Docs/cddl1.txt 31 * or http://www.opensolaris.org/os/licensing. 32 * See the License for the specific language governing permissions 33 * and limitations under the License. 34 * 35 * CDDL HEADER END 36 * 37 * 28-Jun-2005 Brendan Gregg Created this. 38 */ 39 40#pragma D option quiet 41 42dtrace:::BEGIN 43{ 44 printf("Tracing... Hit Ctrl-C to end.\n"); 45} 46 47vminfo:::as_fault 48{ 49 @mem[pid, execname] = sum(arg0); 50} 51 52dtrace:::END 53{ 54 printf("%6s %-16s %16s\n", "PID", "CMD", "MINFAULTS"); 55 printa("%6d %-16s %@16d\n", @mem); 56} 57