def test_response_speed(response, max_size, max_duration):
	import time
	current_duration = 0
	current_size = 0
	start = time.clock()
	while current_duration < max_duration and current_size < max_size:
		data = response.read(max_size - current_size)
		if not data:
			# print "End of file"
			break
		current_size += len(data)
		end = time.clock()
		current_duration = end - start
	if current_size < 1024:
		raise Exception("Sample too small: %d" % current_size)
	return current_size / current_duration, current_size, current_duration
dataset/ETHPy150Open iambus/xunlei-lixian/lixian_nodes.py/test_response_speed/original