Index: trunk/phase3/maintenance/dtrace/tree.d |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +/* |
| 3 | + * This software is in the public domain. |
| 4 | + * |
| 5 | + * $Id$ |
| 6 | + */ |
| 7 | + |
| 8 | +#pragma D option quiet |
| 9 | + |
| 10 | +self int indent; |
| 11 | +self int times[int]; |
| 12 | + |
| 13 | +php$target:::function-entry |
| 14 | +{ |
| 15 | + @counts[copyinstr(arg0)] = count(); |
| 16 | + printf("%*s", self->indent, ""); |
| 17 | + printf("-> %s\n", copyinstr(arg0)); |
| 18 | + self->times[self->indent] = timestamp; |
| 19 | + self->indent += 2; |
| 20 | +} |
| 21 | + |
| 22 | +php$target:::function-return |
| 23 | +{ |
| 24 | + self->indent -= 2; |
| 25 | + printf("%*s", self->indent, ""); |
| 26 | + printf("<- %s %dus\n", copyinstr(arg0), (timestamp - self->times[self->indent]) / 1000); |
| 27 | +} |
Property changes on: trunk/phase3/maintenance/dtrace/tree.d |
___________________________________________________________________ |
Added: svn:keywords |
1 | 28 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 29 | + native |
Index: trunk/phase3/maintenance/dtrace/counts.d |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +/* |
| 3 | + * This software is in the public domain. |
| 4 | + * |
| 5 | + * $Id$ |
| 6 | + */ |
| 7 | + |
| 8 | +#pragma D option quiet |
| 9 | + |
| 10 | +self int tottime; |
| 11 | +BEGIN { |
| 12 | + tottime = timestamp; |
| 13 | +} |
| 14 | + |
| 15 | +php$target:::function-entry |
| 16 | + @counts[copyinstr(arg0)] = count(); |
| 17 | +} |
| 18 | + |
| 19 | +END { |
| 20 | + printf("Total time: %dus\n", (timestamp - tottime) / 1000); |
| 21 | + printf("# calls by function:\n"); |
| 22 | + printa("%-40s %@d\n", @counts); |
| 23 | +} |
| 24 | + |
Property changes on: trunk/phase3/maintenance/dtrace/counts.d |
___________________________________________________________________ |
Added: svn:keywords |
1 | 25 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 26 | + native |