Created
March 8, 2010 17:42
-
-
Save Machx/325392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Invoke this script like so | |
./snow_leopard_garbage_collection.d -p [PID] | |
where pid is the process id of the app you are trying to trace | |
you may need to do | |
chmod +x snow_leopard_garbage_collection.d | |
to fix the permissions on the dtrace script so you can invoke it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
garbage_collection$target:::collection_begin | |
{ | |
self->collectionString = (arg1 == 0 ? "full" : (arg1 == 1 ? "generational" : "local")); | |
self->collectionBeginTime = vtimestamp; | |
} | |
garbage_collection$target:::collection_end | |
{ | |
self->collectionTotalTime = (vtimestamp - self->collectionBeginTime)/1000; | |
printf("\nDuration Time (ms) %d",self->collectionTotalTime); | |
printf("\n%d Objects Reclaimed (%d bytes) on Thread %x",(int)arg1,(int)arg2,tid); | |
printf("\nCollection Type: %s\n",self->collectionString); | |
printf("Bytes in use %d",(int)arg4); | |
printf(" Number in Use %d",(int)arg3); | |
ustack(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment