/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_bench.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-07 21:12:32 UTC
  • mto: (1908.4.6 commit-perf)
  • mto: This revision was merged to the branch mainline in revision 1923.
  • Revision ID: john@arbash-meinel.com-20060807211232-96637b7104feace3
Add the ability to specify a benchmark cache directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 by Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License version 2 as published by
 
5
# the Free Software Foundation.
 
6
#
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
 
 
16
"""Tests for bzr benchmark utilities performance."""
 
17
 
 
18
 
 
19
from bzrlib.benchmarks import Benchmark
 
20
 
 
21
 
 
22
class MakeKernelLikeTreeBenchmark(Benchmark):
 
23
 
 
24
    def test_01_make_kernel_like_tree(self):
 
25
        """Making a kernel sized tree should be ~ 5seconds on modern disk.""" 
 
26
        # on roberts machine: this originally took:  7372ms/ 7479ms
 
27
        # with the LocalTransport._abspath call:     3730ms/ 3778ms
 
28
        self.time(self.make_kernel_like_tree)
 
29
 
 
30
    def test_02_make_kernel_like_tree(self):
 
31
        """Hardlinking a kernel-like working tree should be ~1s"""
 
32
        # Make sure we have populated the cache first
 
33
        self.make_kernel_like_tree(root='foo', hardlink_working=True)
 
34
        self.time(self.make_kernel_like_tree, root='bar',
 
35
                  hardlink_working=True)
 
36
 
 
37
    def test_03_make_kernel_like_added_tree(self):
 
38
        """Time the first creation of a kernel like added tree"""
 
39
        # This may not be an accurate test, in the case that the cached entry
 
40
        # has already been created
 
41
        self.time(self.make_kernel_like_added_tree, root='foo')
 
42
 
 
43
    def test_04_make_kernel_like_added_tree(self):
 
44
        """Time the second creation of a kernel like added tree 
 
45
        (this should be a clone)
 
46
        """
 
47
        # Call make_kernel_like_added_tree to make sure it is cached
 
48
        self.make_kernel_like_added_tree(root='foo')
 
49
        self.time(self.make_kernel_like_added_tree, root='bar')
 
50
 
 
51
    def test_05_make_kernel_like_committed_tree(self):
 
52
        """Time the first creation of a committed kernel like tree"""
 
53
        # This may not be an accurate test, in the case that the cached entry
 
54
        # has already been created
 
55
        self.time(self.make_kernel_like_committed_tree, root='foo')
 
56
 
 
57
    def test_06_make_kernel_like_committed_tree(self):
 
58
        """Time the second creation of a committed kernel like tree 
 
59
        (this should be a clone)
 
60
        """
 
61
        # Call make_kernel_like_committed_tree to make sure it is cached
 
62
        # we just throw it away, so hardlink the first bzr directory
 
63
        self.make_kernel_like_committed_tree(root='foo', hardlink_bzr=True)
 
64
        self.time(self.make_kernel_like_committed_tree, root='bar')
 
65
 
 
66
    def test_07_make_kernel_like_committed_tree_hardlink(self):
 
67
        """Time the creation of a committed kernel like tree 
 
68
        (this should also hardlink the .bzr/ directory)
 
69
        """
 
70
        # Call make_kernel_like_committed_tree to make sure it is cached
 
71
        self.make_kernel_like_committed_tree(root='foo', hardlink_bzr=True)
 
72
        self.time(self.make_kernel_like_committed_tree, root='bar',
 
73
                    hardlink_bzr=True)
 
74
 
 
75