|
Last change
on this file since 602 was 2, checked in by Yuri Dario, 15 years ago |
|
Initial import for vendor code.
|
-
Property svn:eol-style
set to
native
|
|
File size:
767 bytes
|
| Line | |
|---|
| 1 | import errno
|
|---|
| 2 | import hotshot
|
|---|
| 3 | import hotshot.stats
|
|---|
| 4 | import sys
|
|---|
| 5 | import test.pystone
|
|---|
| 6 |
|
|---|
| 7 | def main(logfile):
|
|---|
| 8 | p = hotshot.Profile(logfile)
|
|---|
| 9 | benchtime, stones = p.runcall(test.pystone.pystones)
|
|---|
| 10 | p.close()
|
|---|
| 11 |
|
|---|
| 12 | print "Pystone(%s) time for %d passes = %g" % \
|
|---|
| 13 | (test.pystone.__version__, test.pystone.LOOPS, benchtime)
|
|---|
| 14 | print "This machine benchmarks at %g pystones/second" % stones
|
|---|
| 15 |
|
|---|
| 16 | stats = hotshot.stats.load(logfile)
|
|---|
| 17 | stats.strip_dirs()
|
|---|
| 18 | stats.sort_stats('time', 'calls')
|
|---|
| 19 | try:
|
|---|
| 20 | stats.print_stats(20)
|
|---|
| 21 | except IOError, e:
|
|---|
| 22 | if e.errno != errno.EPIPE:
|
|---|
| 23 | raise
|
|---|
| 24 |
|
|---|
| 25 | if __name__ == '__main__':
|
|---|
| 26 | if sys.argv[1:]:
|
|---|
| 27 | main(sys.argv[1])
|
|---|
| 28 | else:
|
|---|
| 29 | import tempfile
|
|---|
| 30 | main(tempfile.NamedTemporaryFile().name)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.