summaryrefslogtreecommitdiff
path: root/morphlib/stopwatch.py
Commit message (Collapse)AuthorAgeFilesLines
* python scripts: pep8ize codebaseRichard Maw2012-08-011-9/+8
| | | | | | | | | This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies.
* Bump copyright years, get rid of long lines and unused imports.Jannis Pohlmann2012-01-231-4/+3
|
* make a Stopwatch usable with the "with" statementLars Wirzenius2012-01-121-0/+15
| | | | | | | | | | | | | | | | | | This simplifies its use. Previously: w.start('foo') ... w.stop('foo') Now: with w('foo'): ... With "with", it is immediately clear from the code, and its indentation, what is being measured. With the old code, you have to hunt for the start and stop method calls.
* Add Stopwatch.start_stop_seconds(), don't use timedelta.total_seconds().Jannis Pohlmann2011-12-081-0/+8
| | | | | | | | | | | | | | | | | | This function is only available in Python >= 2.7. On http://docs.python.org/library/datetime.html#timedelta-objects it says total_seconds() is equal to (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 with true division enabled. We are using td.days * 24 * 3600 + td.seconds + operator.truediv(td.microseconds, 10**6) now in Stopwatch.start_stop_seconds(), which I find more readable.
* Use assertEqual and drop has_keys().Jannis Pohlmann2011-12-061-1/+1
|
* Make Stopwatch less ambiguous, add tests, update Builder.Jannis Pohlmann2011-12-061-8/+10
|
* Add Stopwatch class, write build times to $cache_prefix.meta.Jannis Pohlmann2011-12-061-0/+48
The Stopwatch class does not have unit tests yet and the build times stored in the cache for system images may be a little too fine-grained at the moment.