[macruby-changes] [713] MacRuby/trunk/sample-macruby/DTrace

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 6 13:58:40 PST 2008


Revision: 713
          http://trac.macosforge.org/projects/ruby/changeset/713
Author:   lsansonetti at apple.com
Date:     2008-11-06 13:58:40 -0800 (Thu, 06 Nov 2008)
Log Message:
-----------
added 64-bit version of the collected_objects.d script

Modified Paths:
--------------
    MacRuby/trunk/sample-macruby/DTrace/collected_objects.d

Added Paths:
-----------
    MacRuby/trunk/sample-macruby/DTrace/collected_objects64.d

Modified: MacRuby/trunk/sample-macruby/DTrace/collected_objects.d
===================================================================
--- MacRuby/trunk/sample-macruby/DTrace/collected_objects.d	2008-11-06 21:58:01 UTC (rev 712)
+++ MacRuby/trunk/sample-macruby/DTrace/collected_objects.d	2008-11-06 21:58:40 UTC (rev 713)
@@ -1,5 +1,7 @@
 #!/usr/sbin/dtrace -s
 
+/* This script should be run against MacRuby 32-bit */
+
 #pragma D option quiet
 
 BEGIN
@@ -9,9 +11,6 @@
 
 objc$target::-finalize:entry
 {
-    /* Thanks http://www.friday.com/bbum/2008/01/26/objective-c-printing-class-name-from-dtrace/ 
-     * TODO does not work in 64-bit
-     */
     isaptr = *(uint32_t *)copyin(arg0, 4);
     classnameptr = *(uint32_t *)copyin(isaptr + 8, 4);
     classname = copyinstr(classnameptr);

Added: MacRuby/trunk/sample-macruby/DTrace/collected_objects64.d
===================================================================
--- MacRuby/trunk/sample-macruby/DTrace/collected_objects64.d	                        (rev 0)
+++ MacRuby/trunk/sample-macruby/DTrace/collected_objects64.d	2008-11-06 21:58:40 UTC (rev 713)
@@ -0,0 +1,29 @@
+#!/usr/sbin/dtrace -s
+
+/* This script should be run against MacRuby 64-bit */
+
+#pragma D option quiet
+
+BEGIN
+{
+    printf("Target pid: %d\n\n", $target);
+}
+
+objc$target::-finalize:entry
+{
+    isaptr = *(uint64_t *)copyin(arg0, 8);
+    class_rw_t = *(uint64_t *)copyin(isaptr + (4 * 8), 8);
+    class_ro_t = *(uint64_t *)copyin(class_rw_t + (2 * 4), 8);
+    classnameptr = *(uint64_t *)copyin(class_ro_t + (4 * 4) + 8, 8);
+    classname = copyinstr(classnameptr);
+
+    @[classname] = count();
+}
+
+END
+{
+    printf("\n");
+    printf("%50s       %-10s\n", "CLASS", "COUNT");
+    printf("--------------------------------------------------------------------------------\n");
+    printa("%50s       %-10 at d\n", @);
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081106/b5163092/attachment.html>


More information about the macruby-changes mailing list