~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzleslap.cc

  • Committer: Brian Aker
  • Date: 2009-02-20 22:48:37 UTC
  • Revision ID: brian@tangent.org-20090220224837-fw5wrf46n4ru3e6a
First pass of stripping uint

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
bool get_one_option(int optid, const struct my_option *, char *argument);
104
104
 
105
105
/* Global Thread counter */
106
 
uint thread_counter;
 
106
uint32_t thread_counter;
107
107
pthread_mutex_t counter_mutex;
108
108
pthread_cond_t count_threshhold;
109
 
uint master_wakeup;
 
109
uint32_t master_wakeup;
110
110
pthread_mutex_t sleeper_mutex;
111
111
pthread_cond_t sleep_threshhold;
112
112
 
150
150
  CLIENT_MULTI_STATEMENTS;
151
151
 
152
152
static int verbose, delimiter_length;
153
 
static uint commit_rate;
154
 
static uint detach_rate;
155
 
static uint opt_timer_length;
156
 
static uint opt_delayed_start;
 
153
static uint32_t commit_rate;
 
154
static uint32_t detach_rate;
 
155
static uint32_t opt_timer_length;
 
156
static uint32_t opt_delayed_start;
157
157
const char *num_int_cols_opt;
158
158
const char *num_char_cols_opt;
159
159
const char *num_blob_cols_opt;
171
171
static unsigned int num_int_cols_index= 0;
172
172
static unsigned int num_char_cols_index= 0;
173
173
static unsigned int iterations;
174
 
static uint my_end_arg= 0;
 
174
static uint32_t my_end_arg= 0;
175
175
static uint64_t actual_queries= 0;
176
176
static uint64_t auto_actual_queries;
177
177
static uint64_t auto_generate_sql_unique_write_number;
181
181
static uint64_t auto_generate_sql_number;
182
182
const char *concurrency_str= NULL;
183
183
static char *create_string;
184
 
uint *concurrency;
 
184
uint32_t *concurrency;
185
185
 
186
186
const char *default_dbug_option= "d:t:o,/tmp/drizzleslap.trace";
187
187
const char *opt_csv_str;
228
228
 
229
229
struct stats {
230
230
  long int timing;
231
 
  uint users;
232
 
  uint real_users;
 
231
  uint32_t users;
 
232
  uint32_t real_users;
233
233
  uint64_t rows;
234
234
  long int create_timing;
235
235
  uint64_t create_count;
249
249
  long int avg_timing;
250
250
  long int max_timing;
251
251
  long int min_timing;
252
 
  uint users;
253
 
  uint real_users;
 
252
  uint32_t users;
 
253
  uint32_t real_users;
254
254
  uint64_t avg_rows;
255
255
  long int sum_of_time;
256
256
  long int std_dev;
278
278
void print_conclusions(conclusions *con);
279
279
void print_conclusions_csv(conclusions *con);
280
280
void generate_stats(conclusions *con, option_string *eng, stats *sptr);
281
 
uint parse_comma(const char *string, uint **range);
282
 
uint parse_delimiter(const char *script, statement **stmt, char delm);
283
 
uint parse_option(const char *origin, option_string **stmt, char delm);
 
281
uint32_t parse_comma(const char *string, uint32_t **range);
 
282
uint32_t parse_delimiter(const char *script, statement **stmt, char delm);
 
283
uint32_t parse_option(const char *origin, option_string **stmt, char delm);
284
284
static int drop_schema(DRIZZLE *drizzle, const char *db);
285
 
uint get_random_string(char *buf, size_t size);
 
285
uint32_t get_random_string(char *buf, size_t size);
286
286
static statement *build_table_string(void);
287
287
static statement *build_insert_string(void);
288
288
static statement *build_update_string(void);
291
291
static int drop_primary_key_list(void);
292
292
static int create_schema(DRIZZLE *drizzle, const char *db, statement *stmt,
293
293
                         option_string *engine_stmt, stats *sptr);
294
 
static int run_scheduler(stats *sptr, statement **stmts, uint concur,
 
294
static int run_scheduler(stats *sptr, statement **stmts, uint32_t concur,
295
295
                         uint64_t limit);
296
296
extern "C" pthread_handler_t run_task(void *p);
297
297
extern "C" pthread_handler_t timer_thread(void *p);
298
298
void statement_cleanup(statement *stmt);
299
299
void option_cleanup(option_string *stmt);
300
 
void concurrency_loop(DRIZZLE *drizzle, uint current, option_string *eptr);
 
300
void concurrency_loop(DRIZZLE *drizzle, uint32_t current, option_string *eptr);
301
301
static int run_statements(DRIZZLE *drizzle, statement *stmt);
302
302
void slap_connect(DRIZZLE *drizzle, bool connect_to_schema);
303
303
void slap_close(DRIZZLE *drizzle);
375
375
  do
376
376
  {
377
377
    /* For the final stage we run whatever queries we were asked to run */
378
 
    uint *current;
 
378
    uint32_t *current;
379
379
 
380
380
    if (verbose >= 2)
381
381
      printf("Starting Concurrency Test\n");
387
387
    }
388
388
    else
389
389
    {
390
 
      uint infinite= 1;
 
390
      uint32_t infinite= 1;
391
391
      do {
392
392
        concurrency_loop(&drizzle, infinite, eptr);
393
393
      }
436
436
  return 0;
437
437
}
438
438
 
439
 
void concurrency_loop(DRIZZLE *drizzle, uint current, option_string *eptr)
 
439
void concurrency_loop(DRIZZLE *drizzle, uint32_t current, option_string *eptr)
440
440
{
441
441
  unsigned int x;
442
442
  stats *head_sptr;
2028
2028
}
2029
2029
 
2030
2030
static int
2031
 
run_scheduler(stats *sptr, statement **stmts, uint concur, uint64_t limit)
 
2031
run_scheduler(stats *sptr, statement **stmts, uint32_t concur, uint64_t limit)
2032
2032
{
2033
 
  uint x;
2034
 
  uint y;
 
2033
  uint32_t x;
 
2034
  uint32_t y;
2035
2035
  unsigned int real_concurrency;
2036
2036
  struct timeval start_time, end_time;
2037
2037
  option_string *sql_type;
2145
2145
 
2146
2146
pthread_handler_t timer_thread(void *p)
2147
2147
{
2148
 
  uint *timer_length= (uint *)p;
 
2148
  uint32_t *timer_length= (uint32_t *)p;
2149
2149
  struct timespec abstime;
2150
2150
 
2151
2151
 
2324
2324
  char *end_ptr;
2325
2325
  option_string **sptr= stmt;
2326
2326
  option_string *tmp;
2327
 
  uint length= strlen(origin);
2328
 
  uint count= 0; /* We know that there is always one */
 
2327
  uint32_t length= strlen(origin);
 
2328
  uint32_t count= 0; /* We know that there is always one */
2329
2329
 
2330
2330
  end_ptr= (char *)origin + length;
2331
2331
 
2419
2419
  char *ptr= (char *)script;
2420
2420
  statement **sptr= stmt;
2421
2421
  statement *tmp;
2422
 
  uint length= strlen(script);
2423
 
  uint count= 0; /* We know that there is always one */
 
2422
  uint32_t length= strlen(script);
 
2423
  uint32_t count= 0; /* We know that there is always one */
2424
2424
 
2425
2425
  for (tmp= *sptr= (statement *)malloc(sizeof(statement));
2426
2426
       (retstr= strchr(ptr, delm));
2467
2467
  In restrospect, this is a lousy name from this function.
2468
2468
*/
2469
2469
uint
2470
 
parse_comma(const char *string, uint **range)
 
2470
parse_comma(const char *string, uint32_t **range)
2471
2471
{
2472
2472
  unsigned int count= 1,x; /* We know that there is always one */
2473
2473
  char *retstr;
2478
2478
    if (*ptr == ',') count++;
2479
2479
 
2480
2480
  /* One extra spot for the NULL */
2481
 
  nptr= *range= (uint *)malloc(sizeof(unsigned int) * (count + 1));
 
2481
  nptr= *range= (uint32_t *)malloc(sizeof(unsigned int) * (count + 1));
2482
2482
  memset(nptr, 0, sizeof(unsigned int) * (count + 1));
2483
2483
 
2484
2484
  ptr= (char *)string;