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
2311
if (run_query(con, NULL, query, len))
1905
2313
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
1906
SLAP_NAME, db, drizzle_con_error(&con));
2314
internal::my_progname, db, drizzle_con_error(con));
1911
static void run_statements(drizzle_con_st &con, Statement *stmt)
2324
run_statements(drizzle_con_st *con, Statement *stmt)
1913
for (Statement *ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
2328
for (ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1915
2330
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1917
2332
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1918
SLAP_NAME, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2333
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1925
static void timer_thread()
2342
run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit)
2345
unsigned int real_concurrency;
2346
struct timeval start_time, end_time;
2347
OptionString *sql_type;
2348
pthread_t mainthread; /* Thread descriptor */
2349
pthread_attr_t attr; /* Thread attributes */
2352
pthread_attr_init(&attr);
2353
pthread_attr_setdetachstate(&attr,
2354
PTHREAD_CREATE_DETACHED);
2356
pthread_mutex_lock(&counter_mutex);
2359
pthread_mutex_lock(&sleeper_mutex);
2361
pthread_mutex_unlock(&sleeper_mutex);
2363
real_concurrency= 0;
2365
for (y= 0, sql_type= query_options;
2366
y < query_statements_count;
2367
y++, sql_type= sql_type->getNext())
2369
unsigned int options_loop= 1;
2371
if (sql_type->getOption())
2373
options_loop= strtol(sql_type->getOption(),
2375
options_loop= options_loop ? options_loop : 1;
2378
while (options_loop--)
2380
for (uint32_t x= 0; x < concur; x++)
2383
con= new ThreadContext;
2386
fprintf(stderr, "Memory Allocation error in scheduler\n");
2389
con->setStmt(stmts[y]);
2390
con->setLimit(limit);
2393
/* now you create the thread */
2394
if (pthread_create(&mainthread, &attr, run_task,
2397
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.
2406
The timer_thread belongs to all threads so it too obeys the wakeup
2407
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();
2409
if (opt_timer_length)
2411
pthread_mutex_lock(&timer_alarm_mutex);
2413
pthread_mutex_unlock(&timer_alarm_mutex);
2415
if (pthread_create(&mainthread, &attr, timer_thread,
2416
(void *)&opt_timer_length) != 0)
2418
fprintf(stderr,"%s: Could not create timer thread\n", internal::my_progname);
2423
pthread_mutex_unlock(&counter_mutex);
2424
pthread_attr_destroy(&attr);
2426
pthread_mutex_lock(&sleeper_mutex);
2428
pthread_mutex_unlock(&sleeper_mutex);
2429
pthread_cond_broadcast(&sleep_threshhold);
2023
2431
gettimeofday(&start_time, NULL);
2026
2434
We loop until we know that all children have cleaned up.
2028
for (Threads::iterator iter= threads.begin(); iter != threads.end(); iter++)
2436
pthread_mutex_lock(&counter_mutex);
2437
while (thread_counter)
2439
struct timespec abstime;
2441
set_timespec(abstime, 3);
2442
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
2444
pthread_mutex_unlock(&counter_mutex);
2033
2446
gettimeofday(&end_time, NULL);
2035
2449
sptr->setTiming(timedif(end_time, start_time));
2036
2450
sptr->setUsers(concur);
2037
2451
sptr->setRealUsers(real_concurrency);
2038
2452
sptr->setRows(limit);
2458
pthread_handler_t timer_thread(void *p)
2460
uint32_t *timer_length= (uint32_t *)p;
2461
struct timespec abstime;
2465
We lock around the initial call in case were we in a loop. This
2466
also keeps the value properly syncronized across call threads.
2468
pthread_mutex_lock(&sleeper_mutex);
2469
while (master_wakeup)
2471
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2473
pthread_mutex_unlock(&sleeper_mutex);
2475
set_timespec(abstime, *timer_length);
2477
pthread_mutex_lock(&timer_alarm_mutex);
2478
pthread_cond_timedwait(&timer_alarm_threshold, &timer_alarm_mutex, &abstime);
2479
pthread_mutex_unlock(&timer_alarm_mutex);
2481
pthread_mutex_lock(&timer_alarm_mutex);
2483
pthread_mutex_unlock(&timer_alarm_mutex);
2488
pthread_handler_t run_task(void *p)
2490
uint64_t counter= 0, queries;
2491
uint64_t detach_counter;
2492
unsigned int commit_counter;
2494
drizzle_result_st result;
2497
ThreadContext *ctx= (ThreadContext *)p;
2499
pthread_mutex_lock(&sleeper_mutex);
2500
while (master_wakeup)
2502
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
2504
pthread_mutex_unlock(&sleeper_mutex);
2506
slap_connect(&con, true);
2509
printf("connected!\n");
2514
run_query(&con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
2517
for (ptr= ctx->getStmt(), detach_counter= 0;
2518
ptr && ptr->getLength();
2519
ptr= ptr->getNext(), detach_counter++)
2521
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
2524
slap_connect(&con, true);
2528
We have to execute differently based on query type. This should become a function.
2530
if ((ptr->getType() == UPDATE_TYPE_REQUIRES_PREFIX) ||
2531
(ptr->getType() == SELECT_TYPE_REQUIRES_PREFIX))
2534
unsigned int key_val;
2535
char buffer[HUGE_STRING_LENGTH];
2538
This should only happen if some sort of new engine was
2539
implemented that didn't properly handle UPDATEs.
2541
Just in case someone runs this under an experimental engine we don't
2542
want a crash so the if() is placed here.
2544
assert(primary_keys.size());
2545
if (primary_keys.size())
2547
key_val= (unsigned int)(random() % primary_keys.size());
2549
key= primary_keys[key_val].c_str();
2553
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
2554
(int)ptr->getLength(), ptr->getString(), key);
2556
if (run_query(&con, &result, buffer, length))
2558
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2559
internal::my_progname, (uint32_t)length, buffer, drizzle_con_error(&con));
2566
if (run_query(&con, &result, ptr->getString(), ptr->getLength()))
2568
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
2569
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2574
if (!opt_only_print)
2576
while ((row = drizzle_row_next(&result)))
2578
drizzle_result_free(&result);
2582
if (commit_rate && (++commit_counter == commit_rate))
2585
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2588
/* If the timer is set, and the alarm is not active then end */
2589
if (opt_timer_length && timer_alarm == false)
2592
/* If limit has been reached, and we are not in a timer_alarm just end */
2593
if (ctx->getLimit() && queries == ctx->getLimit() && timer_alarm == false)
2597
if (opt_timer_length && timer_alarm == true)
2600
if (ctx->getLimit() && queries < ctx->getLimit())
2606
run_query(&con, NULL, "COMMIT", strlen("COMMIT"));
2610
pthread_mutex_lock(&counter_mutex);
2612
pthread_cond_signal(&count_threshhold);
2613
pthread_mutex_unlock(&counter_mutex);
2042
2621
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)
2625
parse_option(const char *origin, OptionString **stmt, char delm)
2048
2628
char *begin_ptr;
2200
void print_conclusions(Conclusions &con)
2783
print_conclusions(Conclusions *con)
2202
2785
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())
2786
if (con->getEngine())
2787
printf("\tRunning for engine %s\n", con->getEngine());
2788
if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
2208
2790
const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
2209
2791
printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
2211
2793
printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
2212
con.getCreateAvgTiming() / 1000, con.getCreateAvgTiming() % 1000);
2794
con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
2213
2795
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
2214
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000);
2796
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000);
2215
2797
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
2216
con.getMinTiming() / 1000, con.getMinTiming() % 1000);
2798
con->getMinTiming() / 1000, con->getMinTiming() % 1000);
2217
2799
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
2218
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000);
2800
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000);
2219
2801
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());
2802
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000);
2803
printf("\tStandard Deviation: %ld.%03ld\n", con->getStdDev() / 1000, con->getStdDev() % 1000);
2804
printf("\tNumber of queries in create queries: %"PRIu64"\n", con->getCreateCount());
2223
2805
printf("\tNumber of clients running queries: %u/%u\n",
2224
con.getUsers(), con.getRealUsers());
2806
con->getUsers(), con->getRealUsers());
2225
2807
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);
2808
printf("\tAverage number of queries per client: %"PRIu64"\n", con->getAvgRows());
2235
void print_conclusions_csv(Conclusions &con)
2813
print_conclusions_csv(Conclusions *con)
2237
2816
char buffer[HUGE_STRING_LENGTH];
2238
2817
char label_buffer[HUGE_STRING_LENGTH];
2239
2818
size_t string_len;
2273
2852
snprintf(buffer, HUGE_STRING_LENGTH,
2274
2853
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,"
2275
2854
"%u,%u,%u,%"PRIu64"\n",
2276
con.getEngine() ? con.getEngine() : "", /* Storage engine we ran against */
2855
con->getEngine() ? con->getEngine() : "", /* Storage engine we ran against */
2277
2856
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 */
2857
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000, /* Time to load */
2858
con->getMinTiming() / 1000, con->getMinTiming() % 1000, /* Min time */
2859
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000, /* Max time */
2860
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000, /* Total time */
2861
con->getStdDev() / 1000, con->getStdDev() % 1000, /* Standard Deviation */
2283
2862
iterations, /* Iterations */
2284
con.getUsers(), /* Children used max_timing */
2285
con.getRealUsers(), /* Children used max_timing */
2286
con.getAvgRows() /* Queries run */
2863
con->getUsers(), /* Children used max_timing */
2864
con->getRealUsers(), /* Children used max_timing */
2865
con->getAvgRows() /* Queries run */
2288
2867
size_t buff_len= strlen(buffer);
2289
2868
ssize_t write_ret= write(csv_file, (unsigned char*) buffer, buff_len);