##// END OF EJS Templates
Add printing of wall time to %run, particularly important for parallel timing.
Fernando Perez -
Show More
@@ -1684,6 +1684,7 b' Currently the magic system has the following functions:\\n"""'
1684 return
1684 return
1685 except (KeyError):
1685 except (KeyError):
1686 nruns = 1
1686 nruns = 1
1687 twall0 = time.time()
1687 if nruns == 1:
1688 if nruns == 1:
1688 t0 = clock2()
1689 t0 = clock2()
1689 runner(filename,prog_ns,prog_ns,
1690 runner(filename,prog_ns,prog_ns,
@@ -1692,8 +1693,8 b' Currently the magic system has the following functions:\\n"""'
1692 t_usr = t1[0]-t0[0]
1693 t_usr = t1[0]-t0[0]
1693 t_sys = t1[1]-t0[1]
1694 t_sys = t1[1]-t0[1]
1694 print "\nIPython CPU timings (estimated):"
1695 print "\nIPython CPU timings (estimated):"
1695 print " User : %10s s." % t_usr
1696 print " User : %10.2f s." % t_usr
1696 print " System: %10s s." % t_sys
1697 print " System : %10.2f s." % t_sys
1697 else:
1698 else:
1698 runs = range(nruns)
1699 runs = range(nruns)
1699 t0 = clock2()
1700 t0 = clock2()
@@ -1705,10 +1706,12 b' Currently the magic system has the following functions:\\n"""'
1705 t_sys = t1[1]-t0[1]
1706 t_sys = t1[1]-t0[1]
1706 print "\nIPython CPU timings (estimated):"
1707 print "\nIPython CPU timings (estimated):"
1707 print "Total runs performed:",nruns
1708 print "Total runs performed:",nruns
1708 print " Times : %10s %10s" % ('Total','Per run')
1709 print " Times : %10.2f %10.2f" % ('Total','Per run')
1709 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1710 print " User : %10.2f s, %10.2f s." % (t_usr,t_usr/nruns)
1710 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1711 print " System : %10.2f s, %10.2f s." % (t_sys,t_sys/nruns)
1711
1712 twall1 = time.time()
1713 print "Wall time: %10.2f s." % (twall1-twall0)
1714
1712 else:
1715 else:
1713 # regular execution
1716 # regular execution
1714 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1717 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
General Comments 0
You need to be logged in to leave comments. Login now