2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2006 Canonical Ltd
|
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
2052.3.1
by John Arbash Meinel
Add tests to cleanup the copyright of all source files |
4 |
# it under the terms of the GNU General Public License as published by
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
7 |
#
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Tests for bzr benchmark utilities performance."""
|
|
18 |
||
1908.2.5
by John Arbash Meinel
Updated bench_bench tests to test exactly what we really want to test |
19 |
from bzrlib import ( |
20 |
osutils, |
|
21 |
)
|
|
1908.2.16
by John Arbash Meinel
Move all the new TreeCreator classes into separate files. |
22 |
from bzrlib.benchmarks import Benchmark |
23 |
from bzrlib.benchmarks.tree_creator.kernel_like import ( |
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
24 |
KernelLikeTreeCreator, |
25 |
KernelLikeAddedTreeCreator, |
|
26 |
KernelLikeCommittedTreeCreator, |
|
27 |
)
|
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
28 |
from bzrlib.tests import TestSkipped |
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
29 |
|
30 |
||
31 |
class MakeKernelLikeTreeBenchmark(Benchmark): |
|
2399.1.7
by John Arbash Meinel
Cleanup bzrlib/benchmarks/* so that everything at least has a valid doc string. |
32 |
"""Benchmark creating benchmark trees."""
|
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
33 |
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
34 |
def test_make_kernel_like_tree(self): |
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
35 |
"""Making a kernel sized tree should be ~ 5seconds on modern disk."""
|
36 |
# on roberts machine: this originally took: 7372ms/ 7479ms
|
|
1755.1.2
by Robert Collins
(robertc, ab)Merge some commit and fetch tuning steps. |
37 |
# with the LocalTransport._abspath call: 3730ms/ 3778ms
|
1755.3.1
by Robert Collins
Tune the time to build our kernel_like tree : make LocalTransport.put faster, AtomicFile faster, LocalTransport.append faster. |
38 |
# with AtomicFile tuning: 2888ms/ 2926ms
|
1955.3.16
by John Arbash Meinel
Switch over to Transport.append_bytes or append_files |
39 |
# switching to transport.append_bytes: 1468ms/ 2849ms
|
1755.2.1
by Robert Collins
Add a benchmark for make_kernel_like_tree. |
40 |
self.time(self.make_kernel_like_tree) |
1908.2.2
by John Arbash Meinel
Allow caching basic kernel-like trees |
41 |
|
42 |
def test_02_make_kernel_like_tree(self): |
|
43 |
"""Hardlinking a kernel-like working tree should be ~1s"""
|
|
1908.2.5
by John Arbash Meinel
Updated bench_bench tests to test exactly what we really want to test |
44 |
# make sure kernel_like_tree is cached
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
45 |
creator = KernelLikeTreeCreator(self, link_working=True) |
46 |
if not creator.is_caching_enabled(): |
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
47 |
raise TestSkipped('caching is disabled') |
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
48 |
creator.ensure_cached() |
49 |
self.time(creator.create, root='bar') |
|
1908.2.2
by John Arbash Meinel
Allow caching basic kernel-like trees |
50 |
|
51 |
def test_03_make_kernel_like_added_tree(self): |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
52 |
"""Time the first creation of a kernel like added tree"""
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
53 |
creator = KernelLikeAddedTreeCreator(self) |
54 |
creator.disable_cache() |
|
55 |
self.time(creator.create, root='foo') |
|
1908.2.2
by John Arbash Meinel
Allow caching basic kernel-like trees |
56 |
|
57 |
def test_04_make_kernel_like_added_tree(self): |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
58 |
"""Time the second creation of a kernel like added tree
|
1908.2.2
by John Arbash Meinel
Allow caching basic kernel-like trees |
59 |
(this should be a clone)
|
60 |
"""
|
|
1908.2.5
by John Arbash Meinel
Updated bench_bench tests to test exactly what we really want to test |
61 |
# make sure kernel_like_added_tree is cached
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
62 |
creator = KernelLikeAddedTreeCreator(self, link_working=True) |
63 |
if not creator.is_caching_enabled(): |
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
64 |
# Caching is disabled, this test is meaningless
|
65 |
raise TestSkipped('caching is disabled') |
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
66 |
creator.ensure_cached() |
67 |
self.time(creator.create, root='bar') |
|
1908.2.2
by John Arbash Meinel
Allow caching basic kernel-like trees |
68 |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
69 |
def test_05_make_kernel_like_committed_tree(self): |
70 |
"""Time the first creation of a committed kernel like tree"""
|
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
71 |
creator = KernelLikeCommittedTreeCreator(self) |
72 |
creator.disable_cache() |
|
73 |
self.time(creator.create, root='foo') |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
74 |
|
75 |
def test_06_make_kernel_like_committed_tree(self): |
|
76 |
"""Time the second creation of a committed kernel like tree
|
|
77 |
(this should be a clone)
|
|
78 |
"""
|
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
79 |
creator = KernelLikeCommittedTreeCreator(self, |
80 |
link_working=True, |
|
81 |
link_bzr=False) |
|
82 |
if not creator.is_caching_enabled(): |
|
83 |
# Caching is disabled, this test is meaningless
|
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
84 |
raise TestSkipped('caching is disabled') |
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
85 |
creator.ensure_cached() |
86 |
self.time(creator.create, root='bar') |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
87 |
|
88 |
def test_07_make_kernel_like_committed_tree_hardlink(self): |
|
89 |
"""Time the creation of a committed kernel like tree
|
|
90 |
(this should also hardlink the .bzr/ directory)
|
|
91 |
"""
|
|
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
92 |
creator = KernelLikeCommittedTreeCreator(self, |
93 |
link_working=True, |
|
94 |
link_bzr=True) |
|
95 |
if not creator.is_caching_enabled(): |
|
96 |
# Caching is disabled, this test is meaningless
|
|
1908.2.11
by John Arbash Meinel
Change caching logic. Don't cache at all without --cache-dir being supplied |
97 |
raise TestSkipped('caching is disabled') |
1908.2.14
by John Arbash Meinel
Hook the bench_bench.py tests up for the new classes |
98 |
creator.ensure_cached() |
99 |
self.time(creator.create, root='bar') |
|
1908.2.3
by John Arbash Meinel
Support caching a committed kernel-like tree, and mark hardlinked trees as readonly. |
100 |
|
101 |