summary refs log tree commit diff stats
path: root/build
Commit message (Expand)AuthorAgeFilesLines
* Fix gitlab ci yaml syntaxAndinus2020-03-181-8/+1
* Restructure for Cetus v0.5Andinus2020-03-181-23/+13
* Add cetus-wallhaven to gitlab ciAndinus2020-03-161-0/+5
* Support Bing Photo of the DayAndinus2020-03-151-0/+5
* Run gitlab-cli on push to master & merge requestsAndinus2020-03-151-3/+6
* Reconfigure gitlab-ciAndinus2020-03-151-1/+4
* Build linux image with gitlab-ciAndinus2020-03-141-0/+2
* Fix gitlab-cli errorAndinus2020-03-141-3/+5
* Add gitlab-ci build filesAndinus2020-03-141-0/+21
a id='n97' href='#n97'>97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
                    

                                                                                          






                                                                              
#!/usr/bin/env python
# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
Run all the benchmarks inside this directory.
Usage: ./all_benchmarks.py [count] [regexp-filters...]
"""

import os.path
import sys
rangerpath = os.path.join(os.path.dirname(__file__), '..')
if sys.path[1] != rangerpath:
	sys.path[1:1] = [rangerpath]

import re
import time

if __name__ == '__main__':
	count   = int(sys.argv[1]) if len(sys.argv) > 1 else 10
	regexes = [re.compile(fltr) for fltr in sys.argv[2:]]
	modules = (fname[:-3] for fname in os.listdir(sys.path[0]) \
			if fname[:3] == 'bm_' and fname[-3:] == '.py')

	def run_benchmark(cls, methodname):
		full_method_name = "{0}.{1}".format(cls.__name__, methodname)
		if all(re.search(full_method_name) for re in regexes):
			method = getattr(cls(), methodname)
			t1 = time.time()
			try:
				method(count)
			except:
				print("{0} failed!".format(full_method_name))
				raise
			else:
				t2 = time.time()
				print("{0:60}: {1:10}s".format(full_method_name, t2 - t1))

	for val in [__import__(module) for module in modules]:
		for cls in vars(val).values():
			if type(cls) == type:
				for methodname in vars(cls):
					if methodname.startswith('bm_'):
						run_benchmark(cls, methodname)