Show More
@@ -0,0 +1,1 b'' | |||||
|
1 | ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'|grep paster |
@@ -5,7 +5,7 b'' | |||||
5 |
|
5 | |||
6 | Test for crawling a project for memory usage |
|
6 | Test for crawling a project for memory usage | |
7 |
|
7 | |||
8 | watch -n 1 "ps aux |grep paster" |
|
8 | watch -n1 ./rhodecode/tests/mem_watch | |
9 |
|
9 | |||
10 | :created_on: Apr 21, 2010 |
|
10 | :created_on: Apr 21, 2010 | |
11 | :author: marcink |
|
11 | :author: marcink | |
@@ -32,8 +32,12 b' import urllib2' | |||||
32 | import vcs |
|
32 | import vcs | |
33 | import time |
|
33 | import time | |
34 |
|
34 | |||
|
35 | from os.path import join as jn | |||
|
36 | ||||
|
37 | ||||
35 | BASE_URI = 'http://127.0.0.1:5000/%s' |
|
38 | BASE_URI = 'http://127.0.0.1:5000/%s' | |
36 |
PROJECT = ' |
|
39 | PROJECT = 'CPython' | |
|
40 | PROJECT_PATH = jn('/', 'home', 'marcink', 'hg_repos') | |||
37 |
|
41 | |||
38 |
|
42 | |||
39 | cj = cookielib.FileCookieJar('/tmp/rc_test_cookie.txt') |
|
43 | cj = cookielib.FileCookieJar('/tmp/rc_test_cookie.txt') | |
@@ -67,11 +71,11 b' def test_changelog_walk(pages=100):' | |||||
67 |
|
71 | |||
68 |
|
72 | |||
69 | def test_changeset_walk(): |
|
73 | def test_changeset_walk(): | |
|
74 | print jn(PROJECT_PATH, PROJECT) | |||
|
75 | total_time = 0 | |||
70 |
|
76 | |||
71 | # test against self |
|
77 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) | |
72 | repo = vcs.get_repo('../../../rhodecode') |
|
|||
73 |
|
78 | |||
74 | total_time = 0 |
|
|||
75 | for i in repo: |
|
79 | for i in repo: | |
76 |
|
80 | |||
77 | raw_cs = '/'.join((PROJECT, 'changeset', i.raw_id)) |
|
81 | raw_cs = '/'.join((PROJECT, 'changeset', i.raw_id)) | |
@@ -88,9 +92,39 b' def test_changeset_walk():' | |||||
88 | print 'average on req', total_time / float(len(repo)) |
|
92 | print 'average on req', total_time / float(len(repo)) | |
89 |
|
93 | |||
90 | def test_files_walk(): |
|
94 | def test_files_walk(): | |
|
95 | print jn(PROJECT_PATH, PROJECT) | |||
|
96 | total_time = 0 | |||
|
97 | ||||
|
98 | repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT)) | |||
|
99 | ||||
|
100 | paths_ = set() | |||
|
101 | try: | |||
|
102 | tip = repo.get_changeset('tip') | |||
|
103 | for topnode, dirs, files in tip.walk('/'): | |||
|
104 | for f in files: | |||
|
105 | paths_.add(f.path) | |||
|
106 | for dir in dirs: | |||
|
107 | for f in files: | |||
|
108 | paths_.add(f.path) | |||
|
109 | ||||
|
110 | except vcs.exception.RepositoryError, e: | |||
91 | pass |
|
111 | pass | |
92 |
|
112 | |||
|
113 | for f in paths_: | |||
|
114 | file_path = '/'.join((PROJECT, 'files', 'tip', f)) | |||
|
115 | ||||
|
116 | full_uri = (BASE_URI % file_path) | |||
|
117 | s = time.time() | |||
|
118 | f = o.open(full_uri) | |||
|
119 | size = len(f.read()) | |||
|
120 | e = time.time() - s | |||
|
121 | total_time += e | |||
|
122 | print 'visited %s size:%s req:%s ms' % (full_uri, size, e) | |||
|
123 | ||||
|
124 | print 'total_time', total_time | |||
|
125 | print 'average on req', total_time / float(len(repo)) | |||
|
126 | ||||
93 |
|
127 | |||
94 |
|
128 | #test_changelog_walk() | ||
95 | test_changelog_walk() |
|
|||
96 | #test_changeset_walk() |
|
129 | #test_changeset_walk() | |
|
130 | test_files_walk() |
General Comments 0
You need to be logged in to leave comments.
Login now