On Mon, 2009-10-26 at 11:38 +0100, Branko Čibej wrote:
>
> "As discussed", yes; but I don't believe this will account for the
> discrepancy between wall clock time and reported test execution time,
> also "as discussed". :)
Yes; refer to my reply to another email thread for reasons that is
contributing to this discrepancy.
> > Index: build/run_tests.py
> > =======================================
> > --- build/run_tests.py (revision 40220)
> > +++ build/run_tests.py (working copy)
> > @@ -270,8 +270,14 @@
> > log.write('FAIL: %s: Unknown test failure.\n' % progbase)
> > # Log the elapsed time.
> > - elapsed_time = time.strftime('%H:%M:%S',
> > - time.gmtime(time.time() - start_time))
> > + test_time = time.time() - start_time
> > + elapsed_time = time.strftime('%H:%M:%S', time.gmtime(test_time))
> > +
> > + # certain system clock may not provide fractions of second
> > + if str(test_time).find('.') == -1:
> > + elapsed_time += '.00'
> > + else:
> > + elapsed_time += '.' + str(test_time).split('.')[1]
> > log.write('END: %s\n' % progbase)
> > log.write('ELAPSED: %s %s\n' % (progbase, elapsed_time))
> > log.write('\n')
>
> Uh. Why don't you just format in the milliseconds in strftime? The
> Python documentation is your friend. Who cares if the system clock
> isn't
> precise enough -- you'll just get the zeros there from strftime
> instead.
> (And note that you need three digits, not two, to correctly represent
> milliseconds.)
AFAIK, srrftime() does not seem to support milliseconds. However, as per
document, starting v2.6 the microsecond format '%f' is supported. Our
code should be compatible with v2.4, right? Moreover, I could use
datetime.strftime() method to print microseconds using '%f' format (in
v2.6 release), but it does not work the same way using time.strftime()
method.
http://docs.python.org/library/datetime.html
That said, I am able to do these check using combination of both
datetime and time modules, something like this:
In [3]: start_time = datetime.datetime.now()
In [4]: end_time = datetime.datetime.now()
In [5]: delta = end_time - start_time
In [6]: elapsed = time.strftime('%H:%M:%S', time.gmtime(delta.seconds))
In [7]: elapsed += '.' + str(delta.microseconds/1000)
In [8]: elapsed
Out[8]: '00:00:09.256'
May i go for it?
--
Bhuvaneswaran A
CollabNet Software P Ltd. | www.collab.net
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2411353
Received on 2009-10-26 12:48:02 CET