196
183
string create_string;
197
184
std::vector <uint32_t> concurrency;
186
const char *default_dbug_option= "d:t:o,/tmp/drizzleslap.trace";
199
187
std::string opt_csv_str;
202
190
static int process_options(void);
203
191
static uint32_t opt_drizzle_port= 0;
199
UPDATE_TYPE_REQUIRES_PREFIX= 3,
200
CREATE_TABLE_TYPE= 4,
201
SELECT_TYPE_REQUIRES_PREFIX= 5,
202
DELETE_TYPE_REQUIRES_PREFIX= 6
210
Statement(char *in_string,
212
slap_query_t in_type,
213
Statement *in_next) :
233
char *getString() const
238
size_t getLength() const
243
slap_query_t getType() const
248
Statement *getNext() const
253
void setString(char *in_string)
258
void setString(size_t length_arg)
260
string= (char *)calloc(length_arg + 1, sizeof(char));
264
void setString(size_t in_length, char in_char)
266
string[in_length]= in_char;
269
void setLength(size_t in_length)
274
void setType(slap_query_t in_type)
279
void setNext(Statement *in_next)
296
OptionString(char *in_string,
299
size_t in_option_length,
300
OptionString *in_next) :
304
option_length(in_option_length),
324
char *getString() const
329
size_t getLength() const
334
char *getOption() const
339
size_t getOptionLength() const
341
return option_length;
344
OptionString *getNext() const
349
void setString(char *in_string)
352
length= strlen(in_string);
355
void setOption(char *in_option)
357
option= strdup(in_option);
358
option_length= strlen(in_option);
361
void setNext(OptionString *in_next)
370
size_t option_length;
379
Stats(long int in_timing,
381
uint32_t in_real_users,
383
long int in_create_timing,
384
uint64_t in_create_count) :
387
real_users(in_real_users),
389
create_timing(in_create_timing),
390
create_count(in_create_count)
402
long int getTiming() const
407
uint32_t getUsers() const
412
uint32_t getRealUsers() const
417
uint64_t getRows() const
422
long int getCreateTiming() const
424
return create_timing;
427
uint64_t getCreateCount() const
432
void setTiming(long int in_timing)
437
void setUsers(uint32_t in_users)
442
void setRealUsers(uint32_t in_real_users)
444
real_users= in_real_users;
447
void setRows(uint64_t in_rows)
452
void setCreateTiming(long int in_create_timing)
454
create_timing= in_create_timing;
457
void setCreateCount(uint64_t in_create_count)
459
create_count= in_create_count;
467
long int create_timing;
468
uint64_t create_count;
476
ThreadContext(Statement *in_stmt,
487
Statement *getStmt() const
492
uint64_t getLimit() const
497
void setStmt(Statement *in_stmt)
502
void setLimit(uint64_t in_limit)
518
Conclusions(char *in_engine,
519
long int in_avg_timing,
520
long int in_max_timing,
521
long int in_min_timing,
523
uint32_t in_real_users,
524
uint64_t in_avg_rows,
525
long int in_sum_of_time,
527
long int in_create_avg_timing,
528
long int in_create_max_timing,
529
long int in_create_min_timing,
530
uint64_t in_create_count,
531
uint64_t in_max_rows,
532
uint64_t in_min_rows) :
534
avg_timing(in_avg_timing),
535
max_timing(in_max_timing),
536
min_timing(in_min_timing),
538
real_users(in_real_users),
539
avg_rows(in_avg_rows),
540
sum_of_time(in_sum_of_time),
542
create_avg_timing(in_create_avg_timing),
543
create_max_timing(in_create_max_timing),
544
create_min_timing(in_create_min_timing),
545
create_count(in_create_count),
546
max_rows(in_max_rows),
547
min_rows(in_min_rows)
560
create_avg_timing(0),
561
create_max_timing(0),
562
create_min_timing(0),
568
char *getEngine() const
573
long int getAvgTiming() const
578
long int getMaxTiming() const
583
long int getMinTiming() const
588
uint32_t getUsers() const
593
uint32_t getRealUsers() const
598
uint64_t getAvgRows() const
603
long int getSumOfTime() const
608
long int getStdDev() const
613
long int getCreateAvgTiming() const
615
return create_avg_timing;
618
long int getCreateMaxTiming() const
620
return create_max_timing;
623
long int getCreateMinTiming() const
625
return create_min_timing;
628
uint64_t getCreateCount() const
633
uint64_t getMinRows() const
638
uint64_t getMaxRows() const
643
void setEngine(char *in_engine)
648
void setAvgTiming(long int in_avg_timing)
650
avg_timing= in_avg_timing;
653
void setMaxTiming(long int in_max_timing)
655
max_timing= in_max_timing;
658
void setMinTiming(long int in_min_timing)
660
min_timing= in_min_timing;
663
void setUsers(uint32_t in_users)
668
void setRealUsers(uint32_t in_real_users)
670
real_users= in_real_users;
673
void setAvgRows(uint64_t in_avg_rows)
675
avg_rows= in_avg_rows;
678
void setSumOfTime(long int in_sum_of_time)
680
sum_of_time= in_sum_of_time;
683
void setStdDev(long int in_std_dev)
688
void setCreateAvgTiming(long int in_create_avg_timing)
690
create_avg_timing= in_create_avg_timing;
693
void setCreateMaxTiming(long int in_create_max_timing)
695
create_max_timing= in_create_max_timing;
698
void setCreateMinTiming(long int in_create_min_timing)
700
create_min_timing= in_create_min_timing;
703
void setCreateCount(uint64_t in_create_count)
705
create_count= in_create_count;
708
void setMinRows(uint64_t in_min_rows)
710
min_rows= in_min_rows;
713
void setMaxRows(uint64_t in_max_rows)
715
max_rows= in_max_rows;
726
long int sum_of_time;
728
/* These are just for create time stats */
729
long int create_avg_timing;
730
long int create_max_timing;
731
long int create_min_timing;
732
uint64_t create_count;
733
/* The following are not used yet */
205
739
static OptionString *engine_options= NULL;
206
740
static OptionString *query_options= NULL;
207
741
static Statement *pre_statements= NULL;
209
743
static Statement *create_statements= NULL;
211
745
static std::vector <Statement *> query_statements;
212
static uint32_t query_statements_count;
746
static unsigned int query_statements_count;
216
void print_conclusions(Conclusions &con);
217
void print_conclusions_csv(Conclusions &con);
750
void print_conclusions(Conclusions *con);
751
void print_conclusions_csv(Conclusions *con);
218
752
void generate_stats(Conclusions *con, OptionString *eng, Stats *sptr);
219
753
uint32_t parse_comma(const char *string, std::vector <uint32_t> &range);
220
754
uint32_t parse_delimiter(const char *script, Statement **stmt, char delm);
221
755
uint32_t parse_option(const char *origin, OptionString **stmt, char delm);
222
static void drop_schema(drizzle_con_st &con, const char *db);
756
static int drop_schema(drizzle_con_st *con, const char *db);
223
757
uint32_t get_random_string(char *buf, size_t size);
224
758
static Statement *build_table_string(void);
225
759
static Statement *build_insert_string(void);
226
760
static Statement *build_update_string(void);
227
761
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);
762
static int generate_primary_key_list(drizzle_con_st *con, OptionString *engine_stmt);
763
static int create_schema(drizzle_con_st *con, const char *db, Statement *stmt,
764
OptionString *engine_stmt, Stats *sptr);
765
static int run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur,
767
extern "C" pthread_handler_t run_task(void *p);
768
extern "C" pthread_handler_t timer_thread(void *p);
231
769
void statement_cleanup(Statement *stmt);
232
770
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);
771
void concurrency_loop(drizzle_con_st *con, uint32_t current, OptionString *eptr);
772
static int run_statements(drizzle_con_st *con, Statement *stmt);
773
void slap_connect(drizzle_con_st *con, bool connect_to_schema);
774
void slap_close(drizzle_con_st *con);
775
static int run_query(drizzle_con_st *con, drizzle_result_st *result, const char *query, int len);
776
void standard_deviation (Conclusions *con, Stats *sptr);
240
778
static const char ALPHANUMERICS[]=
241
779
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
265
803
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
807
* commandline_options is the set of all options that can only be called via the command line.
1903
2295
if (run_query(con, NULL, query, len))
1905
2297
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
1906
SLAP_NAME, db, drizzle_con_error(&con));
2298
internal::my_progname, db, drizzle_con_error(con));
1911
static void run_statements(drizzle_con_st &con, Statement *stmt)
2308
run_statements(drizzle_con_st *con, Statement *stmt)
1913
for (Statement *ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
2312
for (ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1915
2314
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1917
2316
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1918
SLAP_NAME, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2317
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1925
static void timer_thread()
2326
run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit)
2329
unsigned int real_concurrency;
2330
struct timeval start_time, end_time;
2331
OptionString *sql_type;
2332
pthread_t mainthread; /* Thread descriptor */
2333
pthread_attr_t attr; /* Thread attributes */
2336
pthread_attr_init(&attr);
2337
pthread_attr_setdetachstate(&attr,
2338
PTHREAD_CREATE_DETACHED);
2340
pthread_mutex_lock(&counter_mutex);
2343
pthread_mutex_lock(&sleeper_mutex);
2345
pthread_mutex_unlock(&sleeper_mutex);
2347
real_concurrency= 0;
2349
for (y= 0, sql_type= query_options;
2350
y < query_statements_count;
2351
y++, sql_type= sql_type->getNext())
2353
unsigned int options_loop= 1;
2355
if (sql_type->getOption())
2357
options_loop= strtol(sql_type->getOption(),
2359
options_loop= options_loop ? options_loop : 1;
2362
while (options_loop--)
2364
for (uint32_t x= 0; x < concur; x++)
2367
con= new ThreadContext;
2370
fprintf(stderr, "Memory Allocation error in scheduler\n");
2373
con->setStmt(stmts[y]);
2374
con->setLimit(limit);
2377
/* now you create the thread */
2378
if (pthread_create(&mainthread, &attr, run_task,
2381
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.
2390
The timer_thread belongs to all threads so it too obeys the wakeup
2391
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();
2393
if (opt_timer_length)
2395
pthread_mutex_lock(&timer_alarm_mutex);
2397
pthread_mutex_unlock(&timer_alarm_mutex);
2399
if (pthread_create(&mainthread, &attr, timer_thread,
2400
(void *)&opt_timer_length) != 0)
2402
fprintf(stderr,"%s: Could not create timer thread\n", internal::my_progname);
2407
pthread_mutex_unlock(&counter_mutex);
2408
pthread_attr_destroy(&attr);
2410
pthread_mutex_lock(&sleeper_mutex);
2412
pthread_mutex_unlock(&sleeper_mutex);
2413
pthread_cond_broadcast(&sleep_threshhold);
2023
2415
gettimeofday(&start_time, NULL);
2026
2418
We loop until we know that all children have cleaned up.
2028
for (Threads::iterator iter= threads.begin(); iter != threads.end(); iter++)
2420
pthread_mutex_lock(&counter_mutex);
2421
while (thread_counter)
2423
struct timespec abstime;
2425
set_timespec(abstime, 3);
2426
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
2428
pthread_mutex_unlock(&counter_mutex);
2033
2430
gettimeofday(&end_time, NULL);
2035
2433
sptr->setTiming(timedif(end_time, start_time));
2036
2434
sptr->setUsers(concur);
2037
2435
sptr->setRealUsers(real_concurrency);
2038
2436
sptr->setRows(limit);
2442
pthread_handler_t timer_thread(void *p)
2444
uint32_t *timer_length= (uint32_t *)p;
2445
struct timespec abstime;
2449
We lock around the initial call in case were we in a loop. This
2450
also keeps the value properly syncronized across call threads.
2452
pthread_mutex_lock(&sleeper_mutex);
2453
while (master_wakeup)
2455
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2457
pthread_mutex_unlock(&sleeper_mutex);
2459
set_timespec(abstime, *timer_length);
2461
pthread_mutex_lock(&timer_alarm_mutex);
2462
pthread_cond_timedwait(&timer_alarm_threshold, &timer_alarm_mutex, &abstime);
2463
pthread_mutex_unlock(&timer_alarm_mutex);
2465
pthread_mutex_lock(&timer_alarm_mutex);
2467
pthread_mutex_unlock(&timer_alarm_mutex);
2472
pthread_handler_t run_task(void *p)
2474
uint64_t counter= 0, queries;
2475
uint64_t detach_counter;
2476
unsigned int commit_counter;
2478
drizzle_result_st result;
2481
ThreadContext *ctx= (ThreadContext *)p;
2483
pthread_mutex_lock(&sleeper_mutex);
2484
while (master_wakeup)
2486
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2488
pthread_mutex_unlock(&sleeper_mutex);
2490
slap_connect(&con, true);
2493
printf("connected!\n");
2498
run_query(&con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
2501
for (ptr= ctx->getStmt(), detach_counter= 0;
2502
ptr && ptr->getLength();
2503
ptr= ptr->getNext(), detach_counter++)
2505
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
2508
slap_connect(&con, true);
2512
We have to execute differently based on query type. This should become a function.
2514
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) ||
2515
(ptr->getType() == SELECT_TYPE_REQUIRES_PREFIX))
2518
unsigned int key_val;
2519
char buffer[HUGE_STRING_LENGTH];
2522
This should only happen if some sort of new engine was
2523
implemented that didn't properly handle UPDATEs.
2525
Just in case someone runs this under an experimental engine we don't
2526
want a crash so the if() is placed here.
2528
assert(primary_keys.size());
2529
if (primary_keys.size())
2531
key_val= (unsigned int)(random() % primary_keys.size());
2533
key= primary_keys[key_val].c_str();
2537
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
2538
(int)ptr->getLength(), ptr->getString(), key);
2540
if (run_query(&con, &result, buffer, length))
2542
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2543
internal::my_progname, (uint32_t)length, buffer, drizzle_con_error(&con));
2550
if (run_query(&con, &result, ptr->getString(), ptr->getLength()))
2552
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2553
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2558
if (!opt_only_print)
2560
while ((row = drizzle_row_next(&result)))
2562
drizzle_result_free(&result);
2566
if (commit_rate && (++commit_counter == commit_rate))
2569
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2572
/* If the timer is set, and the alarm is not active then end */
2573
if (opt_timer_length && timer_alarm == false)
2576
/* If limit has been reached, and we are not in a timer_alarm just end */
2577
if (ctx->getLimit() && queries == ctx->getLimit() && timer_alarm == false)
2581
if (opt_timer_length && timer_alarm == true)
2584
if (ctx->getLimit() && queries < ctx->getLimit())
2590
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2594
pthread_mutex_lock(&counter_mutex);
2596
pthread_cond_signal(&count_threshhold);
2597
pthread_mutex_unlock(&counter_mutex);
2042
2605
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)
2609
parse_option(const char *origin, OptionString **stmt, char delm)
2048
2612
char *begin_ptr;
2200
void print_conclusions(Conclusions &con)
2767
print_conclusions(Conclusions *con)
2202
2769
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())
2770
if (con->getEngine())
2771
printf("\tRunning for engine %s\n", con->getEngine());
2772
if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
2208
2774
const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
2209
2775
printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
2211
2777
printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
2212
con.getCreateAvgTiming() / 1000, con.getCreateAvgTiming() % 1000);
2778
con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
2213
2779
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
2214
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000);
2780
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000);
2215
2781
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
2216
con.getMinTiming() / 1000, con.getMinTiming() % 1000);
2782
con->getMinTiming() / 1000, con->getMinTiming() % 1000);
2217
2783
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
2218
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000);
2784
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000);
2219
2785
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());
2786
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000);
2787
printf("\tStandard Deviation: %ld.%03ld\n", con->getStdDev() / 1000, con->getStdDev() % 1000);
2788
printf("\tNumber of queries in create queries: %"PRIu64"\n", con->getCreateCount());
2223
2789
printf("\tNumber of clients running queries: %u/%u\n",
2224
con.getUsers(), con.getRealUsers());
2790
con->getUsers(), con->getRealUsers());
2225
2791
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);
2792
printf("\tAverage number of queries per client: %"PRIu64"\n", con->getAvgRows());
2235
void print_conclusions_csv(Conclusions &con)
2797
print_conclusions_csv(Conclusions *con)
2237
2800
char buffer[HUGE_STRING_LENGTH];
2238
2801
char label_buffer[HUGE_STRING_LENGTH];
2239
2802
size_t string_len;
2273
2836
snprintf(buffer, HUGE_STRING_LENGTH,
2274
2837
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,"
2275
2838
"%u,%u,%u,%"PRIu64"\n",
2276
con.getEngine() ? con.getEngine() : "", /* Storage engine we ran against */
2839
con->getEngine() ? con->getEngine() : "", /* Storage engine we ran against */
2277
2840
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 */
2841
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000, /* Time to load */
2842
con->getMinTiming() / 1000, con->getMinTiming() % 1000, /* Min time */
2843
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000, /* Max time */
2844
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000, /* Total time */
2845
con->getStdDev() / 1000, con->getStdDev() % 1000, /* Standard Deviation */
2283
2846
iterations, /* Iterations */
2284
con.getUsers(), /* Children used max_timing */
2285
con.getRealUsers(), /* Children used max_timing */
2286
con.getAvgRows() /* Queries run */
2847
con->getUsers(), /* Children used max_timing */
2848
con->getRealUsers(), /* Children used max_timing */
2849
con->getAvgRows() /* Queries run */
2288
2851
size_t buff_len= strlen(buffer);
2289
2852
ssize_t write_ret= write(csv_file, (unsigned char*) buffer, buff_len);