diff options
author | Chris Mason <clm@fb.com> | 2023-04-13 12:47:42 -0700 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2023-04-13 12:53:25 -0700 |
commit | 4efcebec0c4efa31f145cce9291b9b317b110c33 (patch) | |
tree | 374f09f279807c6fbce48bebe39f7ac79be0f114 | |
parent | 21591f881acd2ac7ce3a0979556961ec48be776b (diff) | |
download | schbench-4efcebec0c4efa31f145cce9291b9b317b110c33.tar.gz |
schbench: fix pipe mode
Recent changes made pipe mode do significantly more CPU work and also
sleep in the worker thread. This fixes things to properly focus on pipe
transfers.
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | schbench.c | 57 |
1 files changed, 32 insertions, 25 deletions
@@ -1028,24 +1028,27 @@ void *worker_thread(void *arg) do { struct request *tmp; - if (calibrate_only) { - /* - * in calibration mode, don't include the - * usleep in the timing - */ - usleep(100); + if (pipe_test) { gettimeofday(&work_start, NULL); } else { - /* - * lets start off with some simulated networking, - * and also make sure we get a fresh clean timeslice - */ - gettimeofday(&work_start, NULL); - usleep(100); + if (calibrate_only) { + /* + * in calibration mode, don't include the + * usleep in the timing + */ + usleep(100); + gettimeofday(&work_start, NULL); + } else { + /* + * lets start off with some simulated networking, + * and also make sure we get a fresh clean timeslice + */ + gettimeofday(&work_start, NULL); + usleep(100); + } + do_work(td); } - do_work(td); - gettimeofday(&now, NULL); td->runtime = tvdelta(&start, &now); @@ -1356,24 +1359,28 @@ int main(int ac, char **av) free(message_threads_mem); - show_latencies(&wakeup_stats, "Wakeup Latencies", "usec", runtime, - PLIST_FOR_LAT, PLIST_99); - show_latencies(&request_stats, "Request Latencies", "usec", runtime, - PLIST_FOR_LAT, PLIST_99); - show_latencies(&rps_stats, "RPS", "requests", runtime, - PLIST_FOR_RPS, PLIST_50); - if (pipe_test) { char *pretty; double mb_per_sec; + + show_latencies(&wakeup_stats, "Wakeup Latencies", "usec", runtime, + PLIST_20 | PLIST_FOR_LAT, PLIST_99); + mb_per_sec = (loop_count * pipe_test * USEC_PER_SEC) / loop_runtime; mb_per_sec = pretty_size(mb_per_sec, &pretty); printf("avg worker transfer: %.2f ops/sec %.2f%s/s\n", loops_per_sec, mb_per_sec, pretty); - + } else { + show_latencies(&wakeup_stats, "Wakeup Latencies", "usec", runtime, + PLIST_FOR_LAT, PLIST_99); + show_latencies(&request_stats, "Request Latencies", "usec", runtime, + PLIST_FOR_LAT, PLIST_99); + show_latencies(&rps_stats, "RPS", "requests", runtime, + PLIST_FOR_RPS, PLIST_50); + if (!auto_rps) + fprintf(stdout, "average rps: %.2f\n", + (double)(loop_count) / runtime); } - if (!auto_rps) - fprintf(stdout, "average rps: %.2f\n", - (double)(loop_count) / runtime); + return 0; } |