1 1.1 christos #!/usr/sbin/dtrace -s 2 1.1 christos /* 3 1.1 christos * vmbypid.d - print vminfo events by process. DTrace. 4 1.1 christos * 5 1.1 christos * $Id: vmbypid.d,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $ 6 1.1 christos * 7 1.1 christos * USAGE: vmbypid.d 8 1.1 christos * 9 1.1 christos * FIELDS: 10 1.1 christos * EXEC Process name 11 1.1 christos * PID Process ID 12 1.1 christos * VM Virtual Memory statistic (/usr/include/sys/sysinfo.h) 13 1.1 christos * VALUE Value by which statistic was incremented 14 1.1 christos * 15 1.1 christos * The virtual memory statistics are documented in the cpu_vminfo struct 16 1.1 christos * in the /usr/include/sys/sysinfo.h file; and also in the vminfo provider 17 1.1 christos * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223. 18 1.1 christos * 19 1.1 christos * COPYRIGHT: Copyright (c) 2005 Brendan Gregg. 20 1.1 christos * 21 1.1 christos * CDDL HEADER START 22 1.1 christos * 23 1.1 christos * The contents of this file are subject to the terms of the 24 1.1 christos * Common Development and Distribution License, Version 1.0 only 25 1.1 christos * (the "License"). You may not use this file except in compliance 26 1.1 christos * with the License. 27 1.1 christos * 28 1.1 christos * You can obtain a copy of the license at Docs/cddl1.txt 29 1.1 christos * or http://www.opensolaris.org/os/licensing. 30 1.1 christos * See the License for the specific language governing permissions 31 1.1 christos * and limitations under the License. 32 1.1 christos * 33 1.1 christos * CDDL HEADER END 34 1.1 christos * 35 1.1 christos * 14-May-2005 Brendan Gregg Created this. 36 1.1 christos * 20-Apr-2006 " " Last update. 37 1.1 christos */ 38 1.1 christos 39 1.1 christos #pragma D option quiet 40 1.1 christos 41 1.1 christos dtrace:::BEGIN 42 1.1 christos { 43 1.1 christos printf("Tracing... Hit Ctrl-C to end.\n"); 44 1.1 christos } 45 1.1 christos 46 1.1 christos vminfo::: 47 1.1 christos { 48 1.1 christos @VM[execname, pid, probename] = sum(arg0); 49 1.1 christos } 50 1.1 christos 51 1.1 christos dtrace:::END { 52 1.1 christos printf("%16s %8s %22s %8s\n", "EXEC", "PID", "VM", "VALUE"); 53 1.1 christos printa("%16s %8d %22s %@8d\n", @VM); 54 1.1 christos } 55