xref: /xnu-8796.141.3/bsd/dev/dtrace/scripts/vm_object_ownership.d (revision 1b191cb58250d0705d8a51287127505aa4bc0789)
1*1b191cb5SApple OSS Distributions #!/usr/sbin/dtrace -s
2*1b191cb5SApple OSS Distributions 
3*1b191cb5SApple OSS Distributions vminfo:::object_ownership_change
4*1b191cb5SApple OSS Distributions {
5*1b191cb5SApple OSS Distributions 	old_owner = (task_t)arg1;
6*1b191cb5SApple OSS Distributions 	if (old_owner == 0) {
7*1b191cb5SApple OSS Distributions 		old_pid = -1;
8*1b191cb5SApple OSS Distributions 		old_name = "(nil)";
9*1b191cb5SApple OSS Distributions 	} else {
10*1b191cb5SApple OSS Distributions 		old_proc = xlate <psinfo_t *>((proc_t)old_owner->t_tro->tro_proc);
11*1b191cb5SApple OSS Distributions 		old_pid = old_proc->pr_pid;
12*1b191cb5SApple OSS Distributions 		old_name = old_proc->pr_fname;
13*1b191cb5SApple OSS Distributions 	}
14*1b191cb5SApple OSS Distributions 	new_owner = (task_t)arg4;
15*1b191cb5SApple OSS Distributions 	if (new_owner == 0) {
16*1b191cb5SApple OSS Distributions 		new_pid = -1;
17*1b191cb5SApple OSS Distributions 		new_name = "(nil)";
18*1b191cb5SApple OSS Distributions 	} else {
19*1b191cb5SApple OSS Distributions 		new_proc = xlate <psinfo_t *>((proc_t)new_owner->t_tro->tro_proc);
20*1b191cb5SApple OSS Distributions 		new_pid = new_proc->pr_pid;
21*1b191cb5SApple OSS Distributions 		new_name = new_proc->pr_fname;
22*1b191cb5SApple OSS Distributions 	}
23*1b191cb5SApple OSS Distributions 
24*1b191cb5SApple OSS Distributions 	printf("%d[%s] object 0x%p id 0x%x purgeable:%d owner:0x%p (%d[%s]) tag:%d nofootprint:%d -> owner:0x%p (%d[%s]) tag:%d nofootprint:%d",
25*1b191cb5SApple OSS Distributions 	       pid, execname, arg0, arg7, ((vm_object_t)arg0)->purgable,
26*1b191cb5SApple OSS Distributions 	       old_owner, old_pid, old_name,
27*1b191cb5SApple OSS Distributions 	       arg2, arg3,
28*1b191cb5SApple OSS Distributions 	       new_owner, new_pid, new_name,
29*1b191cb5SApple OSS Distributions 	       arg5, arg6);
30*1b191cb5SApple OSS Distributions 	stack();
31*1b191cb5SApple OSS Distributions 	ustack();
32*1b191cb5SApple OSS Distributions }
33