[PATCH] ignore log to stdout in benchmarks
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 8 21:48:54 BST 2006
Jan Balster wrote:
> To reduce the memory footprint of the benchmark tests I wrote a patch to
> throw the log output away. This and the related patch "[merge] remove
> some more mutters" reduced the memory consumption of the benchmark suite
> benchmarks from 1.1 GB to ~120 MB (the suite contains the bundle
> benchmarks we are working on).
>
> The attached diff overwrites the _finishLogFile method of the Benchmark
> class in bzrlib/benchmarks/__init__.py.
>
> Cheers,
> Jan
>
>
Seems reasonable to me, but you need to clean up a couple small things.
> ------------------------------------------------------------------------
>
>
> === modified file 'bzrlib/benchmarks/__init__.py'
> --- bzrlib/benchmarks/__init__.py 2006-07-19 05:54:36 +0000
> +++ bzrlib/benchmarks/__init__.py 2006-08-08 13:24:50 +0000
> @@ -20,10 +20,22 @@
> from bzrlib import bzrdir, plugin
> from bzrlib.tests.TestUtil import TestLoader
> from bzrlib.tests.blackbox import ExternalBase
> +import bzrlib.trace
> +import os
>
^- PEP8 standard library imports come first, separated by a blank line,
then dependency imports, then local imports. So as an example
"""File docstring"""
import os
import sys
import cElementTree
import paramiko
from bzrlib import (
bzrdir,
errors,
)
class Foo
We've started prefering 'from bzrlib import trace' over 'import
bzrlib.trace', but either is okay.
>
> class Benchmark(ExternalBase):
>
> + def _finishLogFile(self):
> + if self._log_file is None:
> + return
> + bzrlib.trace.disable_test_log(self._log_nonce)
> + self._log_contents = 'DELETED to lower the memory footprint'
> + self._log_file.close()
> + os.remove(self._log_file_name)
> + self._log_file = self._log_file_name = None
> +
> +
> def make_kernel_like_tree(self, url=None):
> """Setup a temporary tree roughly like a kernel tree.
>
^- only 1 blank space between class functions.
+1 on the concept, just needs some small cleanup.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060808/6f6896b3/attachment.pgp
More information about the bazaar
mailing list