196
185
string create_string;
197
186
std::vector <uint32_t> concurrency;
188
const char *default_dbug_option= "d:t:o,/tmp/drizzleslap.trace";
199
189
std::string opt_csv_str;
202
192
static int process_options(void);
203
193
static uint32_t opt_drizzle_port= 0;
201
UPDATE_TYPE_REQUIRES_PREFIX= 3,
202
CREATE_TABLE_TYPE= 4,
203
SELECT_TYPE_REQUIRES_PREFIX= 5,
204
DELETE_TYPE_REQUIRES_PREFIX= 6
212
Statement(char *in_string,
214
slap_query_t in_type,
215
Statement *in_next) :
235
char *getString() const
240
size_t getLength() const
245
slap_query_t getType() const
250
Statement *getNext() const
255
void setString(char *in_string)
260
void setString(size_t length_arg)
262
string= (char *)calloc(length_arg + 1, sizeof(char));
266
void setString(size_t in_length, char in_char)
268
string[in_length]= in_char;
271
void setLength(size_t in_length)
276
void setType(slap_query_t in_type)
281
void setNext(Statement *in_next)
298
OptionString(char *in_string,
301
size_t in_option_length,
302
OptionString *in_next) :
306
option_length(in_option_length),
326
char *getString() const
331
size_t getLength() const
336
char *getOption() const
341
size_t getOptionLength() const
343
return option_length;
346
OptionString *getNext() const
351
void setString(char *in_string)
354
length= strlen(in_string);
357
void setOption(char *in_option)
359
option= strdup(in_option);
360
option_length= strlen(in_option);
363
void setNext(OptionString *in_next)
372
size_t option_length;
381
Stats(long int in_timing,
383
uint32_t in_real_users,
385
long int in_create_timing,
386
uint64_t in_create_count) :
389
real_users(in_real_users),
391
create_timing(in_create_timing),
392
create_count(in_create_count)
404
long int getTiming() const
409
uint32_t getUsers() const
414
uint32_t getRealUsers() const
419
uint64_t getRows() const
424
long int getCreateTiming() const
426
return create_timing;
429
uint64_t getCreateCount() const
434
void setTiming(long int in_timing)
439
void setUsers(uint32_t in_users)
444
void setRealUsers(uint32_t in_real_users)
446
real_users= in_real_users;
449
void setRows(uint64_t in_rows)
454
void setCreateTiming(long int in_create_timing)
456
create_timing= in_create_timing;
459
void setCreateCount(uint64_t in_create_count)
461
create_count= in_create_count;
469
long int create_timing;
470
uint64_t create_count;
478
ThreadContext(Statement *in_stmt,
489
Statement *getStmt() const
494
uint64_t getLimit() const
499
void setStmt(Statement *in_stmt)
504
void setLimit(uint64_t in_limit)
520
Conclusions(char *in_engine,
521
long int in_avg_timing,
522
long int in_max_timing,
523
long int in_min_timing,
525
uint32_t in_real_users,
526
uint64_t in_avg_rows,
527
long int in_sum_of_time,
529
long int in_create_avg_timing,
530
long int in_create_max_timing,
531
long int in_create_min_timing,
532
uint64_t in_create_count,
533
uint64_t in_max_rows,
534
uint64_t in_min_rows) :
536
avg_timing(in_avg_timing),
537
max_timing(in_max_timing),
538
min_timing(in_min_timing),
540
real_users(in_real_users),
541
avg_rows(in_avg_rows),
542
sum_of_time(in_sum_of_time),
544
create_avg_timing(in_create_avg_timing),
545
create_max_timing(in_create_max_timing),
546
create_min_timing(in_create_min_timing),
547
create_count(in_create_count),
548
max_rows(in_max_rows),
549
min_rows(in_min_rows)
562
create_avg_timing(0),
563
create_max_timing(0),
564
create_min_timing(0),
570
char *getEngine() const
575
long int getAvgTiming() const
580
long int getMaxTiming() const
585
long int getMinTiming() const
590
uint32_t getUsers() const
595
uint32_t getRealUsers() const
600
uint64_t getAvgRows() const
605
long int getSumOfTime() const
610
long int getStdDev() const
615
long int getCreateAvgTiming() const
617
return create_avg_timing;
620
long int getCreateMaxTiming() const
622
return create_max_timing;
625
long int getCreateMinTiming() const
627
return create_min_timing;
630
uint64_t getCreateCount() const
635
uint64_t getMinRows() const
640
uint64_t getMaxRows() const
645
void setEngine(char *in_engine)
650
void setAvgTiming(long int in_avg_timing)
652
avg_timing= in_avg_timing;
655
void setMaxTiming(long int in_max_timing)
657
max_timing= in_max_timing;
660
void setMinTiming(long int in_min_timing)
662
min_timing= in_min_timing;
665
void setUsers(uint32_t in_users)
670
void setRealUsers(uint32_t in_real_users)
672
real_users= in_real_users;
675
void setAvgRows(uint64_t in_avg_rows)
677
avg_rows= in_avg_rows;
680
void setSumOfTime(long int in_sum_of_time)
682
sum_of_time= in_sum_of_time;
685
void setStdDev(long int in_std_dev)
690
void setCreateAvgTiming(long int in_create_avg_timing)
692
create_avg_timing= in_create_avg_timing;
695
void setCreateMaxTiming(long int in_create_max_timing)
697
create_max_timing= in_create_max_timing;
700
void setCreateMinTiming(long int in_create_min_timing)
702
create_min_timing= in_create_min_timing;
705
void setCreateCount(uint64_t in_create_count)
707
create_count= in_create_count;
710
void setMinRows(uint64_t in_min_rows)
712
min_rows= in_min_rows;
715
void setMaxRows(uint64_t in_max_rows)
717
max_rows= in_max_rows;
728
long int sum_of_time;
730
/* These are just for create time stats */
731
long int create_avg_timing;
732
long int create_max_timing;
733
long int create_min_timing;
734
uint64_t create_count;
735
/* The following are not used yet */
205
741
static OptionString *engine_options= NULL;
206
742
static OptionString *query_options= NULL;
207
743
static Statement *pre_statements= NULL;
209
745
static Statement *create_statements= NULL;
211
747
static std::vector <Statement *> query_statements;
212
static uint32_t query_statements_count;
748
static unsigned int query_statements_count;
216
void print_conclusions(Conclusions &con);
217
void print_conclusions_csv(Conclusions &con);
752
void print_conclusions(Conclusions *con);
753
void print_conclusions_csv(Conclusions *con);
218
754
void generate_stats(Conclusions *con, OptionString *eng, Stats *sptr);
219
755
uint32_t parse_comma(const char *string, std::vector <uint32_t> &range);
220
756
uint32_t parse_delimiter(const char *script, Statement **stmt, char delm);
221
757
uint32_t parse_option(const char *origin, OptionString **stmt, char delm);
222
static void drop_schema(drizzle_con_st &con, const char *db);
758
static int drop_schema(drizzle_con_st *con, const char *db);
223
759
uint32_t get_random_string(char *buf, size_t size);
224
760
static Statement *build_table_string(void);
225
761
static Statement *build_insert_string(void);
226
762
static Statement *build_update_string(void);
227
763
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);
764
static int generate_primary_key_list(drizzle_con_st *con, OptionString *engine_stmt);
765
static int create_schema(drizzle_con_st *con, const char *db, Statement *stmt,
766
OptionString *engine_stmt, Stats *sptr);
767
static int run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur,
769
extern "C" pthread_handler_t run_task(void *p);
770
extern "C" pthread_handler_t timer_thread(void *p);
231
771
void statement_cleanup(Statement *stmt);
232
772
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);
773
void concurrency_loop(drizzle_con_st *con, uint32_t current, OptionString *eptr);
774
static int run_statements(drizzle_con_st *con, Statement *stmt);
775
void slap_connect(drizzle_con_st *con, bool connect_to_schema);
776
void slap_close(drizzle_con_st *con);
777
static int run_query(drizzle_con_st *con, drizzle_result_st *result, const char *query, int len);
778
void standard_deviation (Conclusions *con, Stats *sptr);
240
780
static const char ALPHANUMERICS[]=
241
781
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
265
805
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
809
* commandline_options is the set of all options that can only be called via the command line.
1903
2313
if (run_query(con, NULL, query, len))
1905
2315
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
1906
SLAP_NAME, db, drizzle_con_error(&con));
2316
internal::my_progname, db, drizzle_con_error(con));
1911
static void run_statements(drizzle_con_st &con, Statement *stmt)
2326
run_statements(drizzle_con_st *con, Statement *stmt)
1913
for (Statement *ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
2330
for (ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1915
2332
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1917
2334
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1918
SLAP_NAME, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2335
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1925
static void timer_thread()
2344
run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit)
2347
unsigned int real_concurrency;
2348
struct timeval start_time, end_time;
2349
OptionString *sql_type;
2350
pthread_t mainthread; /* Thread descriptor */
2351
pthread_attr_t attr; /* Thread attributes */
2354
pthread_attr_init(&attr);
2355
pthread_attr_setdetachstate(&attr,
2356
PTHREAD_CREATE_DETACHED);
2358
pthread_mutex_lock(&counter_mutex);
2361
pthread_mutex_lock(&sleeper_mutex);
2363
pthread_mutex_unlock(&sleeper_mutex);
2365
real_concurrency= 0;
2367
for (y= 0, sql_type= query_options;
2368
y < query_statements_count;
2369
y++, sql_type= sql_type->getNext())
2371
unsigned int options_loop= 1;
2373
if (sql_type->getOption())
2375
options_loop= strtol(sql_type->getOption(),
2377
options_loop= options_loop ? options_loop : 1;
2380
while (options_loop--)
2382
for (uint32_t x= 0; x < concur; x++)
2385
con= new ThreadContext;
2388
fprintf(stderr, "Memory Allocation error in scheduler\n");
2391
con->setStmt(stmts[y]);
2392
con->setLimit(limit);
2395
/* now you create the thread */
2396
if (pthread_create(&mainthread, &attr, run_task,
2399
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.
2408
The timer_thread belongs to all threads so it too obeys the wakeup
2409
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();
2411
if (opt_timer_length)
2413
pthread_mutex_lock(&timer_alarm_mutex);
2415
pthread_mutex_unlock(&timer_alarm_mutex);
2417
if (pthread_create(&mainthread, &attr, timer_thread,
2418
(void *)&opt_timer_length) != 0)
2420
fprintf(stderr,"%s: Could not create timer thread\n", internal::my_progname);
2425
pthread_mutex_unlock(&counter_mutex);
2426
pthread_attr_destroy(&attr);
2428
pthread_mutex_lock(&sleeper_mutex);
2430
pthread_mutex_unlock(&sleeper_mutex);
2431
pthread_cond_broadcast(&sleep_threshhold);
2023
2433
gettimeofday(&start_time, NULL);
2026
2436
We loop until we know that all children have cleaned up.
2028
for (Threads::iterator iter= threads.begin(); iter != threads.end(); iter++)
2438
pthread_mutex_lock(&counter_mutex);
2439
while (thread_counter)
2441
struct timespec abstime;
2443
set_timespec(abstime, 3);
2444
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
2446
pthread_mutex_unlock(&counter_mutex);
2033
2448
gettimeofday(&end_time, NULL);
2035
2451
sptr->setTiming(timedif(end_time, start_time));
2036
2452
sptr->setUsers(concur);
2037
2453
sptr->setRealUsers(real_concurrency);
2038
2454
sptr->setRows(limit);
2460
pthread_handler_t timer_thread(void *p)
2462
uint32_t *timer_length= (uint32_t *)p;
2463
struct timespec abstime;
2467
We lock around the initial call in case were we in a loop. This
2468
also keeps the value properly syncronized across call threads.
2470
pthread_mutex_lock(&sleeper_mutex);
2471
while (master_wakeup)
2473
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2475
pthread_mutex_unlock(&sleeper_mutex);
2477
set_timespec(abstime, *timer_length);
2479
pthread_mutex_lock(&timer_alarm_mutex);
2480
pthread_cond_timedwait(&timer_alarm_threshold, &timer_alarm_mutex, &abstime);
2481
pthread_mutex_unlock(&timer_alarm_mutex);
2483
pthread_mutex_lock(&timer_alarm_mutex);
2485
pthread_mutex_unlock(&timer_alarm_mutex);
2490
pthread_handler_t run_task(void *p)
2492
uint64_t counter= 0, queries;
2493
uint64_t detach_counter;
2494
unsigned int commit_counter;
2496
drizzle_result_st result;
2499
ThreadContext *ctx= (ThreadContext *)p;
2501
pthread_mutex_lock(&sleeper_mutex);
2502
while (master_wakeup)
2504
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2506
pthread_mutex_unlock(&sleeper_mutex);
2508
slap_connect(&con, true);
2511
printf("connected!\n");
2516
run_query(&con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
2519
for (ptr= ctx->getStmt(), detach_counter= 0;
2520
ptr && ptr->getLength();
2521
ptr= ptr->getNext(), detach_counter++)
2523
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
2526
slap_connect(&con, true);
2530
We have to execute differently based on query type. This should become a function.
2532
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) ||
2533
(ptr->getType() == SELECT_TYPE_REQUIRES_PREFIX))
2536
unsigned int key_val;
2537
char buffer[HUGE_STRING_LENGTH];
2540
This should only happen if some sort of new engine was
2541
implemented that didn't properly handle UPDATEs.
2543
Just in case someone runs this under an experimental engine we don't
2544
want a crash so the if() is placed here.
2546
assert(primary_keys.size());
2547
if (primary_keys.size())
2549
key_val= (unsigned int)(random() % primary_keys.size());
2551
key= primary_keys[key_val].c_str();
2555
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
2556
(int)ptr->getLength(), ptr->getString(), key);
2558
if (run_query(&con, &result, buffer, length))
2560
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2561
internal::my_progname, (uint32_t)length, buffer, drizzle_con_error(&con));
2568
if (run_query(&con, &result, ptr->getString(), ptr->getLength()))
2570
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2571
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2576
if (!opt_only_print)
2578
while ((row = drizzle_row_next(&result)))
2580
drizzle_result_free(&result);
2584
if (commit_rate && (++commit_counter == commit_rate))
2587
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2590
/* If the timer is set, and the alarm is not active then end */
2591
if (opt_timer_length && timer_alarm == false)
2594
/* If limit has been reached, and we are not in a timer_alarm just end */
2595
if (ctx->getLimit() && queries == ctx->getLimit() && timer_alarm == false)
2599
if (opt_timer_length && timer_alarm == true)
2602
if (ctx->getLimit() && queries < ctx->getLimit())
2608
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2612
pthread_mutex_lock(&counter_mutex);
2614
pthread_cond_signal(&count_threshhold);
2615
pthread_mutex_unlock(&counter_mutex);
2042
2623
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)
2627
parse_option(const char *origin, OptionString **stmt, char delm)
2048
2630
char *begin_ptr;
2200
void print_conclusions(Conclusions &con)
2785
print_conclusions(Conclusions *con)
2202
2787
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())
2788
if (con->getEngine())
2789
printf("\tRunning for engine %s\n", con->getEngine());
2790
if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
2208
2792
const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
2209
2793
printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
2211
2795
printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
2212
con.getCreateAvgTiming() / 1000, con.getCreateAvgTiming() % 1000);
2796
con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
2213
2797
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
2214
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000);
2798
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000);
2215
2799
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
2216
con.getMinTiming() / 1000, con.getMinTiming() % 1000);
2800
con->getMinTiming() / 1000, con->getMinTiming() % 1000);
2217
2801
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
2218
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000);
2802
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000);
2219
2803
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());
2804
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000);
2805
printf("\tStandard Deviation: %ld.%03ld\n", con->getStdDev() / 1000, con->getStdDev() % 1000);
2806
printf("\tNumber of queries in create queries: %"PRIu64"\n", con->getCreateCount());
2223
2807
printf("\tNumber of clients running queries: %u/%u\n",
2224
con.getUsers(), con.getRealUsers());
2808
con->getUsers(), con->getRealUsers());
2225
2809
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);
2810
printf("\tAverage number of queries per client: %"PRIu64"\n", con->getAvgRows());
2235
void print_conclusions_csv(Conclusions &con)
2815
print_conclusions_csv(Conclusions *con)
2237
2818
char buffer[HUGE_STRING_LENGTH];
2238
2819
char label_buffer[HUGE_STRING_LENGTH];
2239
2820
size_t string_len;
2273
2854
snprintf(buffer, HUGE_STRING_LENGTH,
2274
2855
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,"
2275
2856
"%u,%u,%u,%"PRIu64"\n",
2276
con.getEngine() ? con.getEngine() : "", /* Storage engine we ran against */
2857
con->getEngine() ? con->getEngine() : "", /* Storage engine we ran against */
2277
2858
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 */
2859
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000, /* Time to load */
2860
con->getMinTiming() / 1000, con->getMinTiming() % 1000, /* Min time */
2861
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000, /* Max time */
2862
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000, /* Total time */
2863
con->getStdDev() / 1000, con->getStdDev() % 1000, /* Standard Deviation */
2283
2864
iterations, /* Iterations */
2284
con.getUsers(), /* Children used max_timing */
2285
con.getRealUsers(), /* Children used max_timing */
2286
con.getAvgRows() /* Queries run */
2865
con->getUsers(), /* Children used max_timing */
2866
con->getRealUsers(), /* Children used max_timing */
2867
con->getAvgRows() /* Queries run */
2288
2869
size_t buff_len= strlen(buffer);
2289
2870
ssize_t write_ret= write(csv_file, (unsigned char*) buffer, buff_len);