Commit 341be451 authored by 赵威's avatar 赵威

add timer

parent 232519b3
...@@ -22,7 +22,9 @@ def match_tractate_by_device(device_id, n=10): ...@@ -22,7 +22,9 @@ def match_tractate_by_device(device_id, n=10):
try: try:
if device_id not in ["0", "unknown", "87654", ""]: if device_id not in ["0", "unknown", "87654", ""]:
time_begin = time.time() time_begin = time.time()
portrait_time_begin = time.time()
business_tags = get_user_portrait_tag3_business_tags(device_id, tags_num=3) business_tags = get_user_portrait_tag3_business_tags(device_id, tags_num=3)
portrait_time_end = time.time() - portrait_time_begin
res = [] res = []
if business_tags: if business_tags:
vectors = [] vectors = []
...@@ -48,6 +50,7 @@ def match_tractate_by_device(device_id, n=10): ...@@ -48,6 +50,7 @@ def match_tractate_by_device(device_id, n=10):
"api": "strategy_embedding/personas_vector/match", "api": "strategy_embedding/personas_vector/match",
"device_id": device_id, "device_id": device_id,
"n": n, "n": n,
"get_business_tags": "{:.3f}ms".format(portrait_time_end * 1000),
"search": "{:.3f}ms".format(search_time_end * 1000), "search": "{:.3f}ms".format(search_time_end * 1000),
"total_time": "{:.3f}ms".format(time_end * 1000) "total_time": "{:.3f}ms".format(time_end * 1000)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment