Staging
v0.5.1
https://github.com/python/cpython
Revision 3c60833e1e53f6239825b44f76fa22172feb1790 authored by Christian Heimes on 26 March 2008, 22:01:37 UTC, committed by Christian Heimes on 26 March 2008, 22:01:37 UTC
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
1 parent 0cb3e86
Raw File
Tip revision: 3c60833e1e53f6239825b44f76fa22172feb1790 authored by Christian Heimes on 26 March 2008, 22:01:37 UTC
Patch #2477: Added from __future__ import unicode_literals
Tip revision: 3c60833
T.py
# Simple interface to report execution times of program fragments.
# Call TSTART() to reset the timer, TSTOP(...) to report times.

import sys, os, time

def TSTART():
    global t0, t1
    u, s, cu, cs = os.times()
    t0 = u+cu, s+cs, time.time()

def TSTOP(*label):
    global t0, t1
    u, s, cu, cs = os.times()
    t1 = u+cu, s+cs, time.time()
    tt = []
    for i in range(3):
        tt.append(t1[i] - t0[i])
    [u, s, r] = tt
    msg = ''
    for x in label: msg = msg + (x + ' ')
    msg = msg + '%r user, %r sys, %r real\n' % (u, s, r)
    sys.stderr.write(msg)
back to top