diff options
author | River Tarnell <kateturner@users.mediawiki.org> | 2005-08-15 01:46:19 +0000 |
---|---|---|
committer | River Tarnell <kateturner@users.mediawiki.org> | 2005-08-15 01:46:19 +0000 |
commit | 27d901a2c6bc2ad42449cbbdeac116509e6686a9 (patch) | |
tree | 51c76198374fdcd05fb4d33b6f4043cb0dcb3cbd | |
parent | 4107c1dc1f9a12bb06c6fd627e47ea5f99ede7b2 (diff) | |
download | mediawikicore-27d901a2c6bc2ad42449cbbdeac116509e6686a9.tar.gz mediawikicore-27d901a2c6bc2ad42449cbbdeac116509e6686a9.zip |
some example dtrace scripts
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/10510
-rw-r--r-- | maintenance/dtrace/counts.d | 23 | ||||
-rw-r--r-- | maintenance/dtrace/tree.d | 26 |
2 files changed, 49 insertions, 0 deletions
diff --git a/maintenance/dtrace/counts.d b/maintenance/dtrace/counts.d new file mode 100644 index 000000000000..bedb45473623 --- /dev/null +++ b/maintenance/dtrace/counts.d @@ -0,0 +1,23 @@ +/* + * This software is in the public domain. + * + * $Id$ + */ + +#pragma D option quiet + +self int tottime; +BEGIN { + tottime = timestamp; +} + +php$target:::function-entry + @counts[copyinstr(arg0)] = count(); +} + +END { + printf("Total time: %dus\n", (timestamp - tottime) / 1000); + printf("# calls by function:\n"); + printa("%-40s %@d\n", @counts); +} + diff --git a/maintenance/dtrace/tree.d b/maintenance/dtrace/tree.d new file mode 100644 index 000000000000..a799cb12fc39 --- /dev/null +++ b/maintenance/dtrace/tree.d @@ -0,0 +1,26 @@ +/* + * This software is in the public domain. + * + * $Id$ + */ + +#pragma D option quiet + +self int indent; +self int times[int]; + +php$target:::function-entry +{ + @counts[copyinstr(arg0)] = count(); + printf("%*s", self->indent, ""); + printf("-> %s\n", copyinstr(arg0)); + self->times[self->indent] = timestamp; + self->indent += 2; +} + +php$target:::function-return +{ + self->indent -= 2; + printf("%*s", self->indent, ""); + printf("<- %s %dus\n", copyinstr(arg0), (timestamp - self->times[self->indent]) / 1000); +} |