[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Nov 24 04:12:45 MST 2009


The branch, master has been updated
       via  be90385... s3:torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer
       via  0610f54... s3:torture/nbio: use timeval_current/timeval_elapsed instead of start_timer/end_timer
       via  14d2ca2... s3:dbwrap_torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer
       via  23d8190... RAW-PING-PONG: use timeval_current/timeval_elapsed instead of start_timer/end_timer
       via  a46b63f... s3:fix the merged build of bin/smbtorture4
      from  95d0f0a... docs: Fix Bug 6922: Add Registry patchfile for Win7 domain join.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit be90385a0b1f8a29c5d181d26c0844f314d04ea7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 24 10:59:09 2009 +0100

    s3:torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer
    
    metze

commit 0610f547aa5329b31f05408607d17dba68057b56
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 24 10:41:40 2009 +0100

    s3:torture/nbio: use timeval_current/timeval_elapsed instead of start_timer/end_timer
    
    metze

commit 14d2ca26b3abd0feb20f270c66847b7b2c17cb0a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 24 10:36:52 2009 +0100

    s3:dbwrap_torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer
    
    metze

commit 23d81904ebafffebec803c2e43bc645dedc88f8e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Nov 24 10:18:37 2009 +0100

    RAW-PING-PONG: use timeval_current/timeval_elapsed instead of start_timer/end_timer
    
    metze

commit a46b63fd98399700183cddb773c85521987ff132
Author: Michael Adam <obnox at samba.org>
Date:   Tue Nov 24 11:43:56 2009 +0100

    s3:fix the merged build of bin/smbtorture4
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source3/torture/denytest.c             |    2 +-
 source3/torture/mangle_test.c          |    2 +-
 source3/torture/nbio.c                 |    9 ++++--
 source3/torture/{torture.h => proto.h} |    2 -
 source3/torture/scanner.c              |    2 +-
 source3/torture/torture.c              |   52 ++++++++++++-------------------
 source3/torture/utable.c               |    2 +-
 source3/utils/dbwrap_torture.c         |   19 ++----------
 source4/torture/raw/pingpong.c         |   24 +++-----------
 9 files changed, 38 insertions(+), 76 deletions(-)
 rename source3/torture/{torture.h => proto.h} (98%)


Changeset truncated at 500 lines:

diff --git a/source3/torture/denytest.c b/source3/torture/denytest.c
index bf491bc..4762bf7 100644
--- a/source3/torture/denytest.c
+++ b/source3/torture/denytest.c
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 extern bool torture_showall;
 
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index e5f6947..594caba 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 extern int torture_numops;
 
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 5e7a458..0548068 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -20,7 +20,7 @@
 */
 
 #include "includes.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 #define MAX_FILES 1000
 
@@ -28,6 +28,7 @@ static char buf[70000];
 extern int line_count;
 extern int nbio_id;
 static int nprocs;
+static struct timeval nb_start;
 
 static struct {
 	int fd;
@@ -61,7 +62,9 @@ void nb_alarm(int ignore)
 		if (!children[i].done) num_clients++;
 	}
 
-	printf("%4d  %8d  %.2f MB/sec\r", num_clients, lines/nprocs, 1.0e-6 * nbio_total() / end_timer());
+	printf("%4d  %8d  %.2f MB/sec\r",
+	       num_clients, lines/nprocs,
+	       1.0e-6 * nbio_total() / timeval_elapsed(&nb_start));
 
 	signal(SIGALRM, nb_alarm);
 	alarm(1);	
@@ -122,7 +125,7 @@ void nb_setup(struct cli_state *cli)
 {
 	signal(SIGSEGV, sigsegv);
 	c = cli;
-	start_timer();
+	nb_start = timeval_current();
 	children[nbio_id].done = 0;
 }
 
diff --git a/source3/torture/torture.h b/source3/torture/proto.h
similarity index 98%
rename from source3/torture/torture.h
rename to source3/torture/proto.h
index 353b98c..5d7504a 100644
--- a/source3/torture/torture.h
+++ b/source3/torture/proto.h
@@ -61,8 +61,6 @@ bool torture_nttrans_scan(int dummy);
 
 /* The following definitions come from torture/torture.c  */
 
-void start_timer(void);
-double end_timer(void);
 void *shm_setup(int size);
 bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
 		      char **hostname, char **sharename);
diff --git a/source3/torture/scanner.c b/source3/torture/scanner.c
index 4d9ee28..d7f4d2e 100644
--- a/source3/torture/scanner.c
+++ b/source3/torture/scanner.c
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 #define VERBOSE 0
 #define OP_MIN 0
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 19103df..39f5559 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -20,7 +20,7 @@
 
 #include "includes.h"
 #include "nsswitch/libwbclient/wbc_async.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 extern char *optarg;
 extern int optind;
@@ -49,22 +49,6 @@ bool torture_showall = False;
 static double create_procs(bool (*fn)(int), bool *result);
 
 
-static struct timeval tp1,tp2;
-
-
-void start_timer(void)
-{
-	GetTimeOfDay(&tp1);
-}
-
-double end_timer(void)
-{
-	GetTimeOfDay(&tp2);
-	return((tp2.tv_sec - tp1.tv_sec) + 
-	       (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
-}
-
-
 /* return a pointer to a anonymous shared memory segment of size "size"
    which will persist across fork() but will disappear when all processes
    exit 
@@ -2278,6 +2262,7 @@ static bool run_locktest9(int dummy)
 	pid_t child_pid;
 	char c = '\0';
 	int ret;
+	struct timeval start;
 	double seconds;
 	NTSTATUS status;
 
@@ -2350,7 +2335,7 @@ static bool run_locktest9(int dummy)
 	CatchSignal(SIGALRM, alarm_handler_parent);
 	alarm(20);
 
-	start_timer();
+	start = timeval_current();
 
 	if (!cli_lock(cli1, fnum, 0, 4, -1, WRITE_LOCK)) {
 		d_fprintf(stderr, "Unable to apply write lock on range 0:4, error was "
@@ -2359,7 +2344,7 @@ static bool run_locktest9(int dummy)
 	}
 	alarm(0);
 
-	seconds = end_timer();
+	seconds = timeval_elapsed(&start);
 
 	printf("Parent got the lock after %.2f seconds.\n",
 		seconds);
@@ -4777,7 +4762,7 @@ static bool run_dirtest(int dummy)
 	int i;
 	static struct cli_state *cli;
 	uint16_t fnum;
-	double t1;
+	struct timeval core_start;
 	bool correct = True;
 
 	printf("starting directory test\n");
@@ -4799,13 +4784,13 @@ static bool run_dirtest(int dummy)
 		cli_close(cli, fnum);
 	}
 
-	t1 = end_timer();
+	core_start = timeval_current();
 
 	printf("Matched %d\n", cli_list(cli, "a*.*", 0, list_fn, NULL));
 	printf("Matched %d\n", cli_list(cli, "b*.*", 0, list_fn, NULL));
 	printf("Matched %d\n", cli_list(cli, "xyzabc", 0, list_fn, NULL));
 
-	printf("dirtest core %g seconds\n", end_timer() - t1);
+	printf("dirtest core %g seconds\n", timeval_elapsed(&core_start));
 
 	srandom(0);
 	for (i=0;i<torture_numops;i++) {
@@ -5967,6 +5952,7 @@ static bool run_windows_write(int dummy)
 	int i;
 	bool ret = false;
 	const char *fname = "\\writetest.txt";
+	struct timeval start;
 	double seconds;
 	double kbytes;
 
@@ -5982,7 +5968,7 @@ static bool run_windows_write(int dummy)
 
 	cli_sockopt(cli1, sockops);
 
-	start_timer();
+	start = timeval_current();
 
 	for (i=0; i<torture_numops; i++) {
 		char c = 0;
@@ -6004,7 +5990,7 @@ static bool run_windows_write(int dummy)
 		}
 	}
 
-	seconds = end_timer();
+	seconds = timeval_elapsed(&start);
 	kbytes = (double)torture_blocksize * torture_numops;
 	kbytes /= 1024;
 
@@ -7051,6 +7037,7 @@ static double create_procs(bool (*fn)(int), bool *result)
 	volatile bool *child_status_out;
 	int synccount;
 	int tries = 8;
+	struct timeval start;
 
 	synccount = 0;
 
@@ -7071,7 +7058,7 @@ static double create_procs(bool (*fn)(int), bool *result)
 		child_status_out[i] = True;
 	}
 
-	start_timer();
+	start = timeval_current();
 
 	for (i=0;i<nprocs;i++) {
 		procnum = i;
@@ -7092,7 +7079,7 @@ static double create_procs(bool (*fn)(int), bool *result)
 
 			child_status[i] = getpid();
 
-			while (child_status[i] && end_timer() < 5) smb_msleep(2);
+			while (child_status[i] && timeval_elapsed(&start) < 5) smb_msleep(2);
 
 			child_status_out[i] = fn(i);
 			_exit(0);
@@ -7106,16 +7093,16 @@ static double create_procs(bool (*fn)(int), bool *result)
 		}
 		if (synccount == nprocs) break;
 		smb_msleep(10);
-	} while (end_timer() < 30);
+	} while (timeval_elapsed(&start) < 30);
 
 	if (synccount != nprocs) {
 		printf("FAILED TO START %d CLIENTS (started %d)\n", nprocs, synccount);
 		*result = False;
-		return end_timer();
+		return timeval_elapsed(&start);
 	}
 
 	/* start the client load */
-	start_timer();
+	start = timeval_current();
 
 	for (i=0;i<nprocs;i++) {
 		child_status[i] = 0;
@@ -7134,7 +7121,7 @@ static double create_procs(bool (*fn)(int), bool *result)
 			*result = False;
 		}
 	}
-	return end_timer();
+	return timeval_elapsed(&start);
 }
 
 #define FLAG_MULTIPROC 1
@@ -7252,12 +7239,13 @@ static bool run_test(const char *name)
 					printf("TEST %s FAILED!\n", name);
 				}
 			} else {
-				start_timer();
+				struct timeval start;
+				start = timeval_current();
 				if (!torture_ops[i].fn(0)) {
 					ret = False;
 					printf("TEST %s FAILED!\n", name);
 				}
-				t = end_timer();
+				t = timeval_elapsed(&start);
 			}
 			printf("%s took %g secs\n\n", name, t);
 		}
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index 247642b..f5afeb7 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "torture.h"
+#include "torture/proto.h"
 
 bool torture_utable(int dummy)
 {
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 2077eea..a6e2d2b 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -33,20 +33,6 @@
 
 extern bool AllowDebugChange;
 
-static struct timeval tp1,tp2;
-
-static void start_timer(void)
-{
-	gettimeofday(&tp1,NULL);
-}
-
-static double end_timer(void)
-{
-	gettimeofday(&tp2,NULL);
-	return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) -
-		(tp1.tv_sec + (tp1.tv_usec*1.0e-6));
-}
-
 #define DEFAULT_DB_NAME "transaction.tdb"
 
 static int timelimit = 10;
@@ -138,12 +124,13 @@ static void test_store_records(struct db_context *db, struct tevent_context *ev)
 	TDB_DATA key;
 	uint32_t *counters;
 	TALLOC_CTX *tmp_ctx = talloc_stackframe();
+	struct timeval start;
 
 	key.dptr = (unsigned char *)discard_const("testkey");
 	key.dsize = strlen((const char *)key.dptr)+1;
 
-	start_timer();
-	while ((timelimit == 0) || (end_timer() < timelimit)) {
+	start = timeval_current();
+	while ((timelimit == 0) || (timeval_elapsed(&start) < timelimit)) {
 		struct db_record *rec;
 		TDB_DATA data;
 		int ret;
diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c
index f620c48..124cf69 100644
--- a/source4/torture/raw/pingpong.c
+++ b/source4/torture/raw/pingpong.c
@@ -155,21 +155,6 @@ static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
 	}
 }	
 
-
-static struct timeval tp1, tp2;
-
-static void start_timer(void)
-{
-	gettimeofday(&tp1, NULL);
-}
-
-static double end_timer(void)
-{
-	gettimeofday(&tp2, NULL);
-	return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) - 
-		(tp1.tv_sec + (tp1.tv_usec*1.0e-6));
-}
-
 /* 
    ping pong
 */
@@ -187,6 +172,7 @@ bool torture_ping_pong(struct torture_context *torture)
 	uint8_t incr=0, last_incr=0;
 	uint8_t *val;
 	int count, loops;
+	struct timeval start;
 
 	fn = torture_setting_string(torture, "filename", NULL);
 	if (fn == NULL) {
@@ -219,7 +205,7 @@ bool torture_ping_pong(struct torture_context *torture)
 	lock_byte(cli, fd, 0, lock_timeout);
 
 
-	start_timer();
+	start = timeval_current();
 	val = talloc_zero_array(mem_ctx, uint8_t, num_locks);
 	i = 0;
 	count = 0;
@@ -248,11 +234,11 @@ bool torture_ping_pong(struct torture_context *torture)
 			printf("data increment = %u\n", incr);
 			fflush(stdout);
 		}
-		if (end_timer() > 1.0) {
+		if (timeval_elapsed(&start) > 1.0) {
 			printf("%8u locks/sec\r", 
-			       (unsigned)(2*count/end_timer()));
+			       (unsigned)(2*count/timeval_elapsed(&start)));
 			fflush(stdout);
-			start_timer();
+			start = timeval_current();
 			count=0;
 		}
 		loops++;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list