196
184
string create_string;
197
185
std::vector <uint32_t> concurrency;
187
const char *default_dbug_option= "d:t:o,/tmp/drizzleslap.trace";
199
188
std::string opt_csv_str;
202
191
static int process_options(void);
203
192
static uint32_t opt_drizzle_port= 0;
200
UPDATE_TYPE_REQUIRES_PREFIX= 3,
201
CREATE_TABLE_TYPE= 4,
202
SELECT_TYPE_REQUIRES_PREFIX= 5,
203
DELETE_TYPE_REQUIRES_PREFIX= 6
211
Statement(char *in_string,
213
slap_query_t in_type,
214
Statement *in_next) :
234
char *getString() const
239
size_t getLength() const
244
slap_query_t getType() const
249
Statement *getNext() const
254
void setString(char *in_string)
259
void setString(size_t length_arg)
261
string= (char *)calloc(length_arg + 1, sizeof(char));
265
void setString(size_t in_length, char in_char)
267
string[in_length]= in_char;
270
void setLength(size_t in_length)
275
void setType(slap_query_t in_type)
280
void setNext(Statement *in_next)
297
OptionString(char *in_string,
300
size_t in_option_length,
301
OptionString *in_next) :
305
option_length(in_option_length),
325
char *getString() const
330
size_t getLength() const
335
char *getOption() const
340
size_t getOptionLength() const
342
return option_length;
345
OptionString *getNext() const
350
void setString(char *in_string)
353
length= strlen(in_string);
356
void setOption(char *in_option)
358
option= strdup(in_option);
359
option_length= strlen(in_option);
362
void setNext(OptionString *in_next)
371
size_t option_length;
380
Stats(long int in_timing,
382
uint32_t in_real_users,
384
long int in_create_timing,
385
uint64_t in_create_count) :
388
real_users(in_real_users),
390
create_timing(in_create_timing),
391
create_count(in_create_count)
403
long int getTiming() const
408
uint32_t getUsers() const
413
uint32_t getRealUsers() const
418
uint64_t getRows() const
423
long int getCreateTiming() const
425
return create_timing;
428
uint64_t getCreateCount() const
433
void setTiming(long int in_timing)
438
void setUsers(uint32_t in_users)
443
void setRealUsers(uint32_t in_real_users)
445
real_users= in_real_users;
448
void setRows(uint64_t in_rows)
453
void setCreateTiming(long int in_create_timing)
455
create_timing= in_create_timing;
458
void setCreateCount(uint64_t in_create_count)
460
create_count= in_create_count;
468
long int create_timing;
469
uint64_t create_count;
477
ThreadContext(Statement *in_stmt,
488
Statement *getStmt() const
493
uint64_t getLimit() const
498
void setStmt(Statement *in_stmt)
503
void setLimit(uint64_t in_limit)
519
Conclusions(char *in_engine,
520
long int in_avg_timing,
521
long int in_max_timing,
522
long int in_min_timing,
524
uint32_t in_real_users,
525
uint64_t in_avg_rows,
526
long int in_sum_of_time,
528
long int in_create_avg_timing,
529
long int in_create_max_timing,
530
long int in_create_min_timing,
531
uint64_t in_create_count,
532
uint64_t in_max_rows,
533
uint64_t in_min_rows) :
535
avg_timing(in_avg_timing),
536
max_timing(in_max_timing),
537
min_timing(in_min_timing),
539
real_users(in_real_users),
540
avg_rows(in_avg_rows),
541
sum_of_time(in_sum_of_time),
543
create_avg_timing(in_create_avg_timing),
544
create_max_timing(in_create_max_timing),
545
create_min_timing(in_create_min_timing),
546
create_count(in_create_count),
547
max_rows(in_max_rows),
548
min_rows(in_min_rows)
561
create_avg_timing(0),
562
create_max_timing(0),
563
create_min_timing(0),
569
char *getEngine() const
574
long int getAvgTiming() const
579
long int getMaxTiming() const
584
long int getMinTiming() const
589
uint32_t getUsers() const
594
uint32_t getRealUsers() const
599
uint64_t getAvgRows() const
604
long int getSumOfTime() const
609
long int getStdDev() const
614
long int getCreateAvgTiming() const
616
return create_avg_timing;
619
long int getCreateMaxTiming() const
621
return create_max_timing;
624
long int getCreateMinTiming() const
626
return create_min_timing;
629
uint64_t getCreateCount() const
634
uint64_t getMinRows() const
639
uint64_t getMaxRows() const
644
void setEngine(char *in_engine)
649
void setAvgTiming(long int in_avg_timing)
651
avg_timing= in_avg_timing;
654
void setMaxTiming(long int in_max_timing)
656
max_timing= in_max_timing;
659
void setMinTiming(long int in_min_timing)
661
min_timing= in_min_timing;
664
void setUsers(uint32_t in_users)
669
void setRealUsers(uint32_t in_real_users)
671
real_users= in_real_users;
674
void setAvgRows(uint64_t in_avg_rows)
676
avg_rows= in_avg_rows;
679
void setSumOfTime(long int in_sum_of_time)
681
sum_of_time= in_sum_of_time;
684
void setStdDev(long int in_std_dev)
689
void setCreateAvgTiming(long int in_create_avg_timing)
691
create_avg_timing= in_create_avg_timing;
694
void setCreateMaxTiming(long int in_create_max_timing)
696
create_max_timing= in_create_max_timing;
699
void setCreateMinTiming(long int in_create_min_timing)
701
create_min_timing= in_create_min_timing;
704
void setCreateCount(uint64_t in_create_count)
706
create_count= in_create_count;
709
void setMinRows(uint64_t in_min_rows)
711
min_rows= in_min_rows;
714
void setMaxRows(uint64_t in_max_rows)
716
max_rows= in_max_rows;
727
long int sum_of_time;
729
/* These are just for create time stats */
730
long int create_avg_timing;
731
long int create_max_timing;
732
long int create_min_timing;
733
uint64_t create_count;
734
/* The following are not used yet */
205
740
static OptionString *engine_options= NULL;
206
741
static OptionString *query_options= NULL;
207
742
static Statement *pre_statements= NULL;
209
744
static Statement *create_statements= NULL;
211
746
static std::vector <Statement *> query_statements;
212
static uint32_t query_statements_count;
747
static unsigned int query_statements_count;
216
void print_conclusions(Conclusions &con);
217
void print_conclusions_csv(Conclusions &con);
751
void print_conclusions(Conclusions *con);
752
void print_conclusions_csv(Conclusions *con);
218
753
void generate_stats(Conclusions *con, OptionString *eng, Stats *sptr);
219
754
uint32_t parse_comma(const char *string, std::vector <uint32_t> &range);
220
755
uint32_t parse_delimiter(const char *script, Statement **stmt, char delm);
221
756
uint32_t parse_option(const char *origin, OptionString **stmt, char delm);
222
static void drop_schema(drizzle_con_st &con, const char *db);
757
static int drop_schema(drizzle_con_st *con, const char *db);
223
758
uint32_t get_random_string(char *buf, size_t size);
224
759
static Statement *build_table_string(void);
225
760
static Statement *build_insert_string(void);
226
761
static Statement *build_update_string(void);
227
762
static Statement * build_select_string(bool key);
228
static int generate_primary_key_list(drizzle_con_st &con, OptionString *engine_stmt);
229
static void create_schema(drizzle_con_st &con, const char *db, Statement *stmt, OptionString *engine_stmt, Stats *sptr);
230
static void run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit);
763
static int generate_primary_key_list(drizzle_con_st *con, OptionString *engine_stmt);
764
static int create_schema(drizzle_con_st *con, const char *db, Statement *stmt,
765
OptionString *engine_stmt, Stats *sptr);
766
static int run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur,
768
extern "C" pthread_handler_t run_task(void *p);
769
extern "C" pthread_handler_t timer_thread(void *p);
231
770
void statement_cleanup(Statement *stmt);
232
771
void option_cleanup(OptionString *stmt);
233
void concurrency_loop(drizzle_con_st &con, uint32_t current, OptionString *eptr);
234
static void run_statements(drizzle_con_st &con, Statement *stmt);
235
void slap_connect(drizzle_con_st &con, bool connect_to_schema);
236
void slap_close(drizzle_con_st &con);
237
static int run_query(drizzle_con_st &con, drizzle_result_st *result, const char *query, int len);
238
void standard_deviation(Conclusions &con, Stats *sptr);
772
void concurrency_loop(drizzle_con_st *con, uint32_t current, OptionString *eptr);
773
static int run_statements(drizzle_con_st *con, Statement *stmt);
774
void slap_connect(drizzle_con_st *con, bool connect_to_schema);
775
void slap_close(drizzle_con_st *con);
776
static int run_query(drizzle_con_st *con, drizzle_result_st *result, const char *query, int len);
777
void standard_deviation (Conclusions *con, Stats *sptr);
240
779
static const char ALPHANUMERICS[]=
241
780
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
265
804
user_supplied_query.append(delimiter);
270
static void run_task(ThreadContext *ctx)
272
uint64_t counter= 0, queries;
273
uint64_t detach_counter;
274
uint32_t commit_counter;
275
boost::scoped_ptr<drizzle_con_st> con_ap(new drizzle_con_st);
276
drizzle_con_st &con= *con_ap.get();
277
drizzle_result_st result;
281
master_wakeup.wait();
283
slap_connect(con, true);
286
printf("connected!\n");
291
run_query(con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
294
for (ptr= ctx->getStmt(), detach_counter= 0;
295
ptr && ptr->getLength();
296
ptr= ptr->getNext(), detach_counter++)
298
if (not opt_only_print && detach_rate && !(detach_counter % detach_rate))
301
slap_connect(con, true);
305
We have to execute differently based on query type. This should become a function.
307
bool is_failed_update= false;
308
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) ||
309
(ptr->getType() == SELECT_TYPE_REQUIRES_PREFIX))
313
char buffer[HUGE_STRING_LENGTH];
316
This should only happen if some sort of new engine was
317
implemented that didn't properly handle UPDATEs.
319
Just in case someone runs this under an experimental engine we don't
320
want a crash so the if() is placed here.
322
assert(primary_keys.size());
323
if (primary_keys.size())
325
key_val= (uint32_t)(random() % primary_keys.size());
327
key= primary_keys[key_val].c_str();
331
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
332
(int)ptr->getLength(), ptr->getString(), key);
334
if (run_query(con, &result, buffer, length))
336
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) and commit_rate)
338
// Expand to check to see if Innodb, if so we should restart the
341
is_failed_update= true;
342
failed_update_for_transaction.fetch_and_increment();
346
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
347
SLAP_NAME, (uint32_t)length, buffer, drizzle_con_error(&con));
355
if (run_query(con, &result, ptr->getString(), ptr->getLength()))
357
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) and commit_rate)
359
// Expand to check to see if Innodb, if so we should restart the
362
is_failed_update= true;
363
failed_update_for_transaction.fetch_and_increment();
367
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
368
SLAP_NAME, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
374
if (not opt_only_print and not is_failed_update)
376
while ((row = drizzle_row_next(&result)))
378
drizzle_result_free(&result);
382
if (commit_rate && (++commit_counter == commit_rate) and not is_failed_update)
385
run_query(con, NULL, "COMMIT", strlen("COMMIT"));
388
/* If the timer is set, and the alarm is not active then end */
389
if (opt_timer_length && timer_alarm == false)
392
/* If limit has been reached, and we are not in a timer_alarm just end */
393
if (ctx->getLimit() && queries == ctx->getLimit() && timer_alarm == false)
397
if (opt_timer_length && timer_alarm == true)
400
if (ctx->getLimit() && queries < ctx->getLimit())
406
run_query(con, NULL, "COMMIT", strlen("COMMIT"));
414
808
* commandline_options is the set of all options that can only be called via the command line.
1903
2296
if (run_query(con, NULL, query, len))
1905
2298
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
1906
SLAP_NAME, db, drizzle_con_error(&con));
2299
internal::my_progname, db, drizzle_con_error(con));
1911
static void run_statements(drizzle_con_st &con, Statement *stmt)
2309
run_statements(drizzle_con_st *con, Statement *stmt)
1913
for (Statement *ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
2313
for (ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1915
2315
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1917
2317
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1918
SLAP_NAME, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2318
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1925
static void timer_thread()
2327
run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit)
2330
unsigned int real_concurrency;
2331
struct timeval start_time, end_time;
2332
OptionString *sql_type;
2333
pthread_t mainthread; /* Thread descriptor */
2334
pthread_attr_t attr; /* Thread attributes */
2337
pthread_attr_init(&attr);
2338
pthread_attr_setdetachstate(&attr,
2339
PTHREAD_CREATE_DETACHED);
2341
pthread_mutex_lock(&counter_mutex);
2344
pthread_mutex_lock(&sleeper_mutex);
2346
pthread_mutex_unlock(&sleeper_mutex);
2348
real_concurrency= 0;
2350
for (y= 0, sql_type= query_options;
2351
y < query_statements_count;
2352
y++, sql_type= sql_type->getNext())
2354
unsigned int options_loop= 1;
2356
if (sql_type->getOption())
2358
options_loop= strtol(sql_type->getOption(),
2360
options_loop= options_loop ? options_loop : 1;
2363
while (options_loop--)
2365
for (uint32_t x= 0; x < concur; x++)
2368
con= new ThreadContext;
2371
fprintf(stderr, "Memory Allocation error in scheduler\n");
2374
con->setStmt(stmts[y]);
2375
con->setLimit(limit);
2378
/* now you create the thread */
2379
if (pthread_create(&mainthread, &attr, run_task,
2382
fprintf(stderr,"%s: Could not create thread\n", internal::my_progname);
1928
We lock around the initial call in case were we in a loop. This
1929
also keeps the value properly syncronized across call threads.
2391
The timer_thread belongs to all threads so it too obeys the wakeup
2392
call that run tasks obey.
1931
master_wakeup.wait();
1934
boost::mutex::scoped_lock scopedLock(timer_alarm_mutex);
1937
xtime_get(&xt, boost::TIME_UTC);
1938
xt.sec += opt_timer_length;
1940
(void)timer_alarm_threshold.timed_wait(scopedLock, xt);
1944
boost::mutex::scoped_lock scopedLock(timer_alarm_mutex);
1949
typedef boost::shared_ptr<boost::thread> Thread;
1950
typedef std::vector <Thread> Threads;
1951
static void run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit)
1953
uint32_t real_concurrency;
1954
struct timeval start_time, end_time;
1959
OptionString *sql_type;
1961
master_wakeup.reset();
1963
real_concurrency= 0;
1966
for (y= 0, sql_type= query_options;
1967
y < query_statements_count;
1968
y++, sql_type= sql_type->getNext())
1970
uint32_t options_loop= 1;
1972
if (sql_type->getOption())
1974
options_loop= strtol(sql_type->getOption(),
1976
options_loop= options_loop ? options_loop : 1;
1979
while (options_loop--)
1981
for (uint32_t x= 0; x < concur; x++)
1984
con= new ThreadContext;
1987
fprintf(stderr, "Memory Allocation error in scheduler\n");
1990
con->setStmt(stmts[y]);
1991
con->setLimit(limit);
1995
/* now you create the thread */
1997
thread= Thread(new boost::thread(boost::bind(&run_task, con)));
1998
threads.push_back(thread);
2005
The timer_thread belongs to all threads so it too obeys the wakeup
2006
call that run tasks obey.
2008
if (opt_timer_length)
2011
boost::mutex::scoped_lock alarmLock(timer_alarm_mutex);
2016
thread= Thread(new boost::thread(&timer_thread));
2017
threads.push_back(thread);
2021
master_wakeup.start();
2394
if (opt_timer_length)
2396
pthread_mutex_lock(&timer_alarm_mutex);
2398
pthread_mutex_unlock(&timer_alarm_mutex);
2400
if (pthread_create(&mainthread, &attr, timer_thread,
2401
(void *)&opt_timer_length) != 0)
2403
fprintf(stderr,"%s: Could not create timer thread\n", internal::my_progname);
2408
pthread_mutex_unlock(&counter_mutex);
2409
pthread_attr_destroy(&attr);
2411
pthread_mutex_lock(&sleeper_mutex);
2413
pthread_mutex_unlock(&sleeper_mutex);
2414
pthread_cond_broadcast(&sleep_threshhold);
2023
2416
gettimeofday(&start_time, NULL);
2026
2419
We loop until we know that all children have cleaned up.
2028
for (Threads::iterator iter= threads.begin(); iter != threads.end(); iter++)
2421
pthread_mutex_lock(&counter_mutex);
2422
while (thread_counter)
2424
struct timespec abstime;
2426
set_timespec(abstime, 3);
2427
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
2429
pthread_mutex_unlock(&counter_mutex);
2033
2431
gettimeofday(&end_time, NULL);
2035
2434
sptr->setTiming(timedif(end_time, start_time));
2036
2435
sptr->setUsers(concur);
2037
2436
sptr->setRealUsers(real_concurrency);
2038
2437
sptr->setRows(limit);
2443
pthread_handler_t timer_thread(void *p)
2445
uint32_t *timer_length= (uint32_t *)p;
2446
struct timespec abstime;
2450
We lock around the initial call in case were we in a loop. This
2451
also keeps the value properly syncronized across call threads.
2453
pthread_mutex_lock(&sleeper_mutex);
2454
while (master_wakeup)
2456
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2458
pthread_mutex_unlock(&sleeper_mutex);
2460
set_timespec(abstime, *timer_length);
2462
pthread_mutex_lock(&timer_alarm_mutex);
2463
pthread_cond_timedwait(&timer_alarm_threshold, &timer_alarm_mutex, &abstime);
2464
pthread_mutex_unlock(&timer_alarm_mutex);
2466
pthread_mutex_lock(&timer_alarm_mutex);
2468
pthread_mutex_unlock(&timer_alarm_mutex);
2473
pthread_handler_t run_task(void *p)
2475
uint64_t counter= 0, queries;
2476
uint64_t detach_counter;
2477
unsigned int commit_counter;
2479
drizzle_result_st result;
2482
ThreadContext *ctx= (ThreadContext *)p;
2484
pthread_mutex_lock(&sleeper_mutex);
2485
while (master_wakeup)
2487
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2489
pthread_mutex_unlock(&sleeper_mutex);
2491
slap_connect(&con, true);
2494
printf("connected!\n");
2499
run_query(&con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
2502
for (ptr= ctx->getStmt(), detach_counter= 0;
2503
ptr && ptr->getLength();
2504
ptr= ptr->getNext(), detach_counter++)
2506
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
2509
slap_connect(&con, true);
2513
We have to execute differently based on query type. This should become a function.
2515
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) ||
2516
(ptr->getType() == SELECT_TYPE_REQUIRES_PREFIX))
2519
unsigned int key_val;
2520
char buffer[HUGE_STRING_LENGTH];
2523
This should only happen if some sort of new engine was
2524
implemented that didn't properly handle UPDATEs.
2526
Just in case someone runs this under an experimental engine we don't
2527
want a crash so the if() is placed here.
2529
assert(primary_keys.size());
2530
if (primary_keys.size())
2532
key_val= (unsigned int)(random() % primary_keys.size());
2534
key= primary_keys[key_val].c_str();
2538
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
2539
(int)ptr->getLength(), ptr->getString(), key);
2541
if (run_query(&con, &result, buffer, length))
2543
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2544
internal::my_progname, (uint32_t)length, buffer, drizzle_con_error(&con));
2551
if (run_query(&con, &result, ptr->getString(), ptr->getLength()))
2553
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2554
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2559
if (!opt_only_print)
2561
while ((row = drizzle_row_next(&result)))
2563
drizzle_result_free(&result);
2567
if (commit_rate && (++commit_counter == commit_rate))
2570
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2573
/* If the timer is set, and the alarm is not active then end */
2574
if (opt_timer_length && timer_alarm == false)
2577
/* If limit has been reached, and we are not in a timer_alarm just end */
2578
if (ctx->getLimit() && queries == ctx->getLimit() && timer_alarm == false)
2582
if (opt_timer_length && timer_alarm == true)
2585
if (ctx->getLimit() && queries < ctx->getLimit())
2591
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2595
pthread_mutex_lock(&counter_mutex);
2597
pthread_cond_signal(&count_threshhold);
2598
pthread_mutex_unlock(&counter_mutex);
2042
2606
Parse records from comma seperated string. : is a reserved character and is used for options
2045
uint32_t parse_option(const char *origin, OptionString **stmt, char delm)
2610
parse_option(const char *origin, OptionString **stmt, char delm)
2048
2613
char *begin_ptr;
2200
void print_conclusions(Conclusions &con)
2768
print_conclusions(Conclusions *con)
2202
2770
printf("Benchmark\n");
2203
if (con.getEngine())
2204
printf("\tRunning for engine %s\n", con.getEngine());
2206
if (not opt_label.empty() || !opt_auto_generate_sql_type.empty())
2771
if (con->getEngine())
2772
printf("\tRunning for engine %s\n", con->getEngine());
2773
if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
2208
2775
const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
2209
2776
printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
2211
2778
printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
2212
con.getCreateAvgTiming() / 1000, con.getCreateAvgTiming() % 1000);
2779
con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
2213
2780
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
2214
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000);
2781
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000);
2215
2782
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
2216
con.getMinTiming() / 1000, con.getMinTiming() % 1000);
2783
con->getMinTiming() / 1000, con->getMinTiming() % 1000);
2217
2784
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
2218
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000);
2785
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000);
2219
2786
printf("\tTotal time for tests: %ld.%03ld seconds\n",
2220
con.getSumOfTime() / 1000, con.getSumOfTime() % 1000);
2221
printf("\tStandard Deviation: %ld.%03ld\n", con.getStdDev() / 1000, con.getStdDev() % 1000);
2222
printf("\tNumber of queries in create queries: %"PRIu64"\n", con.getCreateCount());
2787
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000);
2788
printf("\tStandard Deviation: %ld.%03ld\n", con->getStdDev() / 1000, con->getStdDev() % 1000);
2789
printf("\tNumber of queries in create queries: %"PRIu64"\n", con->getCreateCount());
2223
2790
printf("\tNumber of clients running queries: %u/%u\n",
2224
con.getUsers(), con.getRealUsers());
2791
con->getUsers(), con->getRealUsers());
2225
2792
printf("\tNumber of times test was run: %u\n", iterations);
2226
printf("\tAverage number of queries per client: %"PRIu64"\n", con.getAvgRows());
2228
uint64_t temp_val= failed_update_for_transaction;
2230
printf("\tFailed number of updates %"PRIu64"\n", temp_val);
2793
printf("\tAverage number of queries per client: %"PRIu64"\n", con->getAvgRows());
2235
void print_conclusions_csv(Conclusions &con)
2798
print_conclusions_csv(Conclusions *con)
2237
2801
char buffer[HUGE_STRING_LENGTH];
2238
2802
char label_buffer[HUGE_STRING_LENGTH];
2239
2803
size_t string_len;
2273
2837
snprintf(buffer, HUGE_STRING_LENGTH,
2274
2838
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,"
2275
2839
"%u,%u,%u,%"PRIu64"\n",
2276
con.getEngine() ? con.getEngine() : "", /* Storage engine we ran against */
2840
con->getEngine() ? con->getEngine() : "", /* Storage engine we ran against */
2277
2841
label_buffer, /* Load type */
2278
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000, /* Time to load */
2279
con.getMinTiming() / 1000, con.getMinTiming() % 1000, /* Min time */
2280
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000, /* Max time */
2281
con.getSumOfTime() / 1000, con.getSumOfTime() % 1000, /* Total time */
2282
con.getStdDev() / 1000, con.getStdDev() % 1000, /* Standard Deviation */
2842
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000, /* Time to load */
2843
con->getMinTiming() / 1000, con->getMinTiming() % 1000, /* Min time */
2844
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000, /* Max time */
2845
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000, /* Total time */
2846
con->getStdDev() / 1000, con->getStdDev() % 1000, /* Standard Deviation */
2283
2847
iterations, /* Iterations */
2284
con.getUsers(), /* Children used max_timing */
2285
con.getRealUsers(), /* Children used max_timing */
2286
con.getAvgRows() /* Queries run */
2848
con->getUsers(), /* Children used max_timing */
2849
con->getRealUsers(), /* Children used max_timing */
2850
con->getAvgRows() /* Queries run */
2288
2852
size_t buff_len= strlen(buffer);
2289
2853
ssize_t write_ret= write(csv_file, (unsigned char*) buffer, buff_len);