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 * $Id: minfbypid.d,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $ 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 * 20-Apr-2006 " " Last update. 39 */ 40 41 #pragma D option quiet 42 43 dtrace:::BEGIN 44 { 45 printf("Tracing... Hit Ctrl-C to end.\n"); 46 } 47 48 vminfo:::as_fault 49 { 50 @mem[pid, execname] = sum(arg0); 51 } 52 53 dtrace:::END 54 { 55 printf("%6s %-16s %16s\n", "PID", "CMD", "MINFAULTS"); 56 printa("%6d %-16s %@16d\n", @mem); 57 } 58