diff options
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 99965adcc04..db5779387f7 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -85,13 +85,28 @@ TODO: #include <stdarg.h> #include <sslopt-vars.h> #include <sys/types.h> +#ifndef __WIN__ #include <sys/wait.h> +#endif #include <ctype.h> #include <my_pthread.h> #define MYSLAPLOCK "/myslaplock.lck" #define MYSLAPLOCK_DIR "/tmp" +#ifdef __WIN__ +#define srandom srand +#define random rand +#define snprintf _snprintf +#define USE_THREADS_DEFAULT TRUE +#else +#define USE_THREADS_DEFAULT FALSE +#endif + +#ifdef HAVE_SMEM +static char *shared_memory_base_name=0; +#endif + static char **defaults_argv; static char *host= NULL, *opt_password= NULL, *user= NULL, @@ -213,6 +228,17 @@ static long int timedif(struct timeval a, struct timeval b) return s + us; } +#ifdef __WIN__ +static int gettimeofday(struct timeval *tp, void *tzp) +{ + unsigned int ticks; + ticks= GetTickCount(); + tp->tv_usec= ticks*1000; + tp->tv_sec= ticks/1000; + + return 0; +} +#endif int main(int argc, char **argv) { @@ -222,7 +248,7 @@ int main(int argc, char **argv) unsigned long long client_limit; statement *eptr; - DBUG_ENTER("main"); + //DBUG_ENTER("main"); MY_INIT(argv[0]); /* Seed the random number generator if we will be using it. */ @@ -353,7 +379,7 @@ int main(int argc, char **argv) free_defaults(defaults_argv); my_end(0); - DBUG_RETURN(0); /* No compiler warnings */ + return 0; } @@ -452,7 +478,7 @@ static struct my_option my_long_options[] = {"use-threads", OPT_USE_THREADS, "Use pthread calls instead of fork() calls (default on Windows)", (gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + GET_NO_ARG, NO_ARG, USE_THREADS_DEFAULT, 0, 0, 0, 0, 0}, #include <sslopt-longopts.h> #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) &user, @@ -936,7 +962,6 @@ drop_schema(MYSQL *mysql, const char *db) DBUG_RETURN(0); } - static int run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) { @@ -980,6 +1005,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) } } } +#ifndef __WIN__ else { fflush(NULL); @@ -1020,6 +1046,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) } } } +#endif /* Lets release use some clients! */ if (!opt_slave) @@ -1041,6 +1068,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) } my_lock(lock_file, F_UNLCK, 0, F_TO_EOF, MYF(0)); } +#ifndef __WIN__ else { WAIT: @@ -1051,6 +1079,7 @@ WAIT: DBUG_PRINT("info", ("Parent: child %d status %d", pid, status)); } } +#endif gettimeofday(&end_time, NULL); my_close(lock_file, MYF(0)); |