[skip ci] Add rps on benchmark (#9486)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
pull/9497/head
wt 2021-10-08 18:07:06 +08:00 committed by GitHub
parent 711031640f
commit 0b3c182f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -45,10 +45,15 @@ def time_wrapper(func):
# logger.debug("Milvus {} start".format(func.__name__))
log = kwargs.get("log", True)
kwargs.pop("log", None)
rps = kwargs.get("rps", False)
kwargs.pop("rps", None)
result = func(*args, **kwargs)
end = time.time()
if log:
logger.debug("Milvus {} run in {}s".format(func.__name__, round(end - start, 2)))
_rps = round(end - start, 2)
logger.debug("Milvus {} run in {}s".format(func.__name__, _rps))
if rps is not False:
return result, _rps
return result
return wrapper