~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-09 10:04:04 UTC
  • mfrom: (1755.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060609100404-a45cd70353a09a67
(robertc, ab)Merge some commit and fetch tuning steps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Benchmark test suite for bzr."""
19
19
 
 
20
import bzrlib
20
21
from bzrlib.tests import TestLoader
21
22
from bzrlib.tests.blackbox import ExternalBase
22
23
 
23
24
class Benchmark(ExternalBase):
24
25
 
25
 
    def make_kernel_like_tree(self):
26
 
        """Setup a temporary tree roughly like a kernel tree."""
 
26
    def make_kernel_like_tree(self, url=None):
 
27
        """Setup a temporary tree roughly like a kernel tree.
 
28
        
 
29
        :param url: Creat the kernel like tree as a lightweight checkout
 
30
        of a new branch created at url.
 
31
        """
27
32
        # a kernel tree has ~10000 and 500 directory, with most files around 
28
33
        # 3-4 levels deep. 
29
34
        # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
30
35
        # and 20 files each.
31
 
        self.run_bzr('init')
 
36
        if url is not None:
 
37
            b = bzrlib.bzrdir.BzrDir.create_branch_convenience(url)
 
38
            d = bzrlib.bzrdir.BzrDir.create('.')
 
39
            bzrlib.branch.BranchReferenceFormat().initialize(d, b)
 
40
            d.create_workingtree()
 
41
        else:
 
42
            self.run_bzr('init')
32
43
        files = []
33
44
        for outer in range(8):
34
45
            files.append("%s/" % outer)
45
56
    """Build and return a TestSuite which contains benchmark tests only."""
46
57
    testmod_names = [ \
47
58
                   'bzrlib.benchmarks.bench_add',
 
59
                   'bzrlib.benchmarks.bench_bench',
48
60
                   'bzrlib.benchmarks.bench_checkout',
49
61
                   'bzrlib.benchmarks.bench_commit',
50
62
                   'bzrlib.benchmarks.bench_rocks',