μs for elapsed

This commit is contained in:
lionsoul2014 2025-11-02 21:43:54 +08:00
parent 32a755ac3f
commit db95055a56
2 changed files with 4 additions and 4 deletions

View File

@ -96,8 +96,8 @@ def run_bench_test(db_path: str, src_path: str, cache_policy: str):
return return
# print the stats info # print the stats info
each_ms = total_secs * 1000 / count each_us = total_secs * 1000_000 / count
print(f"Bench finished, {{cachePolicy: {cache_policy}, total: {count}, took: {total_secs:.3f} s, cost: {each_ms:.3f} ms/op}}"); print(f"Bench finished, {{cachePolicy: {cache_policy}, total: {count}, took: {total_secs:.3f} s, cost: {each_us:.0f} μs/op}}");
# resource cleanup # resource cleanup
searcher.close() searcher.close()

View File

@ -82,8 +82,8 @@ type 'quit' to exit'''.format(db_path, searcher.get_ip_version().name, cache_pol
print("failed to search({}): {}".format(util.ip_to_string(ip_bytes), str(e))) print("failed to search({}): {}".format(util.ip_to_string(ip_bytes), str(e)))
continue continue
took = (time.time() - s_time) * 1000 took = (time.time() - s_time) * 1000_000
print(f"{{region: {region}, ioCount: {searcher.get_io_count()}, took: {took:.3f} ms}}"); print(f"{{region: {region}, ioCount: {searcher.get_io_count()}, took: {took:.0f} μs}}");
# close the searcher # close the searcher
searcher.close() searcher.close()