Using Mbytes/s is less useful, people expect values in MiB. Example output:
$ ./synch-parallel.sh ... bytes sent: 12686721024 (1209.9 MiB/s) bytes received: 12734693376 (1214.47 MiB/s) I/O requests: 96975 (9697.5 IOPS) Signed-off-by: Nir Soffer <[email protected]> --- tests/synch-parallel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/synch-parallel.c b/tests/synch-parallel.c index cecfeae..423e1f0 100644 --- a/tests/synch-parallel.c +++ b/tests/synch-parallel.c @@ -36,40 +36,42 @@ #include <sys/time.h> #include <pthread.h> #include <libnbd.h> #include "byte-swapping.h" /* We keep a shadow of the RAM disk so we can check integrity of the data. */ static char *ramdisk; /* This is also defined in synch-parallel.sh and checked here. */ #define EXPORTSIZE (8*1024*1024) /* How long (seconds) that the test will run for. */ #define RUN_TIME 10 /* Number of threads. */ #define NR_THREADS 8 +#define MiB (1024*1024) + #define MICROSECONDS 1000000 /* Unix socket. */ static const char *unixsocket; struct thread_status { size_t i; /* Thread index, 0 .. NR_THREADS-1 */ uint64_t offset, length; /* Area assigned to this thread. */ int status; /* Return status. */ unsigned requests; /* Total number of requests made. */ uint64_t bytes_sent, bytes_received; /* Bytes sent and received by thread. */ }; static void *start_thread (void *arg); static inline int64_t microtime (void) { struct timeval tv; @@ -139,44 +141,44 @@ main (int argc, char *argv[]) fprintf (stderr, "thread %zu failed with status %d\n", i, status[i].status); errors++; } requests += status[i].requests; bytes_sent += status[i].bytes_sent; bytes_received += status[i].bytes_received; } free (ramdisk); /* Print some stats. */ printf ("TLS: %s\n", #ifdef TLS "enabled" #else "disabled" #endif ); - printf ("bytes sent: %" PRIu64 " (%g Mbytes/s)\n", - bytes_sent, (double) bytes_sent / RUN_TIME / 1000000); - printf ("bytes received: %" PRIu64 " (%g Mbytes/s)\n", - bytes_received, (double) bytes_received / RUN_TIME / 1000000); + printf ("bytes sent: %" PRIu64 " (%g MiB/s)\n", + bytes_sent, (double) bytes_sent / RUN_TIME / MiB); + printf ("bytes received: %" PRIu64 " (%g MiB/s)\n", + bytes_received, (double) bytes_received / RUN_TIME / MiB); printf ("I/O requests: %u (%g IOPS)\n", requests, (double) requests / RUN_TIME); exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } #define BUFFER_SIZE 16384 static void * start_thread (void *arg) { struct thread_status *status = arg; struct nbd_handle *nbd; char *buf; int cmd; uint64_t offset; int64_t start_usec, stop_usec, now_usec; buf = calloc (BUFFER_SIZE, 1); -- 2.31.1 _______________________________________________ Libguestfs mailing list [email protected] https://listman.redhat.com/mailman/listinfo/libguestfs
