diff options
Diffstat (limited to 'bitbake/bin/bitbake-hashclient')
-rwxr-xr-x | bitbake/bin/bitbake-hashclient | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient index e1e1144644..8d15604b34 100755 --- a/bitbake/bin/bitbake-hashclient +++ b/bitbake/bin/bitbake-hashclient | |||
@@ -82,6 +82,7 @@ def main(): | |||
82 | nonlocal found_hashes | 82 | nonlocal found_hashes |
83 | nonlocal missed_hashes | 83 | nonlocal missed_hashes |
84 | nonlocal max_time | 84 | nonlocal max_time |
85 | nonlocal times | ||
85 | 86 | ||
86 | with hashserv.create_client(args.address) as client: | 87 | with hashserv.create_client(args.address) as client: |
87 | for i in range(args.requests): | 88 | for i in range(args.requests): |
@@ -99,29 +100,41 @@ def main(): | |||
99 | else: | 100 | else: |
100 | missed_hashes += 1 | 101 | missed_hashes += 1 |
101 | 102 | ||
102 | max_time = max(elapsed, max_time) | 103 | times.append(elapsed) |
103 | pbar.update() | 104 | pbar.update() |
104 | 105 | ||
105 | max_time = 0 | 106 | max_time = 0 |
106 | found_hashes = 0 | 107 | found_hashes = 0 |
107 | missed_hashes = 0 | 108 | missed_hashes = 0 |
108 | lock = threading.Lock() | 109 | lock = threading.Lock() |
109 | total_requests = args.clients * args.requests | 110 | times = [] |
110 | start_time = time.perf_counter() | 111 | start_time = time.perf_counter() |
111 | with ProgressBar(total=total_requests) as pbar: | 112 | with ProgressBar(total=args.clients * args.requests) as pbar: |
112 | threads = [threading.Thread(target=thread_main, args=(pbar, lock), daemon=False) for _ in range(args.clients)] | 113 | threads = [threading.Thread(target=thread_main, args=(pbar, lock), daemon=False) for _ in range(args.clients)] |
113 | for t in threads: | 114 | for t in threads: |
114 | t.start() | 115 | t.start() |
115 | 116 | ||
116 | for t in threads: | 117 | for t in threads: |
117 | t.join() | 118 | t.join() |
119 | total_elapsed = time.perf_counter() - start_time | ||
118 | 120 | ||
119 | elapsed = time.perf_counter() - start_time | ||
120 | with lock: | 121 | with lock: |
121 | print("%d requests in %.1fs. %.1f requests per second" % (total_requests, elapsed, total_requests / elapsed)) | 122 | mean = statistics.mean(times) |
122 | print("Average request time %.8fs" % (elapsed / total_requests)) | 123 | median = statistics.median(times) |
123 | print("Max request time was %.8fs" % max_time) | 124 | stddev = statistics.pstdev(times) |
124 | print("Found %d hashes, missed %d" % (found_hashes, missed_hashes)) | 125 | |
126 | print(f"Number of clients: {args.clients}") | ||
127 | print(f"Requests per client: {args.requests}") | ||
128 | print(f"Number of requests: {len(times)}") | ||
129 | print(f"Total elapsed time: {total_elapsed:.3f}s") | ||
130 | print(f"Total request rate: {len(times)/total_elapsed:.3f} req/s") | ||
131 | print(f"Average request time: {mean:.3f}s") | ||
132 | print(f"Median request time: {median:.3f}s") | ||
133 | print(f"Request time std dev: {stddev:.3f}s") | ||
134 | print(f"Maximum request time: {max(times):.3f}s") | ||
135 | print(f"Minimum request time: {min(times):.3f}s") | ||
136 | print(f"Hashes found: {found_hashes}") | ||
137 | print(f"Hashes missed: {missed_hashes}") | ||
125 | 138 | ||
126 | if args.report: | 139 | if args.report: |
127 | with ProgressBar(total=args.requests) as pbar: | 140 | with ProgressBar(total=args.requests) as pbar: |