From 58e737422cd6b09243404084a7a4000cceb85e0e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 May 1999 03:51:44 +0000 Subject: [PATCH] improved the netbench simulator a bit. give results as throughput in MB/sec --- source/utils/torture.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/source/utils/torture.c b/source/utils/torture.c index e53f46cab5b..07076bd9395 100644 --- a/source/utils/torture.c +++ b/source/utils/torture.c @@ -28,6 +28,8 @@ static int max_protocol = PROTOCOL_NT1; static char *sockops="TCP_NODELAY"; static int nprocs=1, numops=100; +static double create_procs(void (*fn)(void)); + static struct timeval tp1,tp2; @@ -225,9 +227,10 @@ static void run_torture(void) } } +static int nbsize1, nbsize2, nbprob1; /* run a test that simulates an approximate netbench client load */ -static void run_netbench(int size1, int size2, int prob1) +static void run_netbench(void) { struct cli_state cli; int fnum, i; @@ -262,10 +265,10 @@ static void run_netbench(int size1, int size2, int prob1) size = 0; while (size < 256*1024) { int s; - if (((unsigned)random()) % 100 > prob1) { - s = size2; + if (((unsigned)random()) % 100 > nbprob1) { + s = nbsize2; } else { - s = size1; + s = nbsize1; } if (cli_smbwrite(&cli, fnum, buf, size, s) != s) { @@ -288,13 +291,23 @@ static void run_netbench(int size1, int size2, int prob1) /* run a test that simulates an approximate netbench w9X client load */ static void run_nbw95(void) { - run_netbench(4096, 0, 100); + double t; + nbsize1 = 4096; + nbsize2 = 0; + nbprob1 = 100; + t = create_procs(run_netbench); + printf("Throughput %g MB/sec\n", nprocs*numops*256.0/(t*1024)); } /* run a test that simulates an approximate netbench wNT client load */ static void run_nbwnt(void) { - run_netbench(4296, 0, 67); + double t; + nbsize1 = 4296; + nbsize2 = 0; + nbprob1 = 67; + t = create_procs(run_netbench); + printf("Throughput %g MB/sec\n", nprocs*numops*256.0/(t*1024)); } @@ -1001,10 +1014,12 @@ static void run_trans2test(void) } -static void create_procs(void (*fn)(void)) +static double create_procs(void (*fn)(void)) { int i, status; + start_timer(); + for (i=0;i