Show More
@@ -70,15 +70,17 b' def test_changelog_walk(pages=100):' | |||||
70 | print 'average on req', total_time / float(pages) |
|
70 | print 'average on req', total_time / float(pages) | |
71 |
|
71 | |||
72 |
|
72 | |||
73 | def test_changeset_walk(): |
|
73 | def test_changeset_walk(limit=None): | |
74 | print jn(PROJECT_PATH, PROJECT) |
|
74 | print 'processing', jn(PROJECT_PATH, PROJECT) | |
75 | total_time = 0 |
|
75 | total_time = 0 | |
76 |
|
76 | |||
77 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) |
|
77 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) | |
78 |
|
78 | cnt = 0 | ||
79 | for i in repo: |
|
79 | for i in repo: | |
80 |
|
80 | cnt += 1 | ||
81 | raw_cs = '/'.join((PROJECT, 'changeset', i.raw_id)) |
|
81 | raw_cs = '/'.join((PROJECT, 'changeset', i.raw_id)) | |
|
82 | if limit and limit == cnt: | |||
|
83 | break | |||
82 |
|
84 | |||
83 | full_uri = (BASE_URI % raw_cs) |
|
85 | full_uri = (BASE_URI % raw_cs) | |
84 | s = time.time() |
|
86 | s = time.time() | |
@@ -89,21 +91,27 b' def test_changeset_walk():' | |||||
89 | print 'visited %s\%s size:%s req:%s ms' % (full_uri, i, size, e) |
|
91 | print 'visited %s\%s size:%s req:%s ms' % (full_uri, i, size, e) | |
90 |
|
92 | |||
91 | print 'total_time', total_time |
|
93 | print 'total_time', total_time | |
92 |
print 'average on req', total_time / float( |
|
94 | print 'average on req', total_time / float(cnt) | |
|
95 | ||||
93 |
|
96 | |||
94 | def test_files_walk(): |
|
97 | def test_files_walk(): | |
95 | print jn(PROJECT_PATH, PROJECT) |
|
98 | print 'processing', jn(PROJECT_PATH, PROJECT) | |
96 | total_time = 0 |
|
99 | total_time = 0 | |
97 |
|
100 | |||
98 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) |
|
101 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) | |
99 |
|
102 | |||
100 | paths_ = set() |
|
103 | from rhodecode.lib.oset import OrderedSet | |
|
104 | ||||
|
105 | paths_ = OrderedSet(['']) | |||
101 | try: |
|
106 | try: | |
102 | tip = repo.get_changeset('tip') |
|
107 | tip = repo.get_changeset('tip') | |
103 | for topnode, dirs, files in tip.walk('/'): |
|
108 | for topnode, dirs, files in tip.walk('/'): | |
104 | for f in files: |
|
109 | ||
|
110 | for dir in dirs: | |||
|
111 | paths_.add(dir.path) | |||
|
112 | for f in dir: | |||
105 | paths_.add(f.path) |
|
113 | paths_.add(f.path) | |
106 | for dir in dirs: |
|
114 | ||
107 |
|
|
115 | for f in files: | |
108 |
|
|
116 | paths_.add(f.path) | |
109 |
|
117 | |||
@@ -125,6 +133,7 b' def test_files_walk():' | |||||
125 | print 'average on req', total_time / float(len(repo)) |
|
133 | print 'average on req', total_time / float(len(repo)) | |
126 |
|
134 | |||
127 |
|
135 | |||
128 | #test_changelog_walk() |
|
|||
129 | #test_changeset_walk() |
|
|||
130 | test_files_walk() |
|
136 | test_files_walk() | |
|
137 | test_changelog_walk(40) | |||
|
138 | test_changeset_walk(limit=100) | |||
|
139 |
General Comments 0
You need to be logged in to leave comments.
Login now