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