169
170
num_char_cols_opt,
170
171
num_int_cols_opt;
171
172
string opt_label;
172
static unsigned int opt_set_random_seed;
173
static uint32_t opt_set_random_seed;
174
175
string auto_generate_selected_columns_opt;
176
177
/* Yes, we do set defaults here */
177
static unsigned int num_int_cols= 1;
178
static unsigned int num_char_cols= 1;
179
static unsigned int num_blob_cols= 0;
180
static unsigned int num_blob_cols_size;
181
static unsigned int num_blob_cols_size_min;
182
static unsigned int num_int_cols_index= 0;
183
static unsigned int num_char_cols_index= 0;
178
static uint32_t num_int_cols= 1;
179
static uint32_t num_char_cols= 1;
180
static uint32_t num_blob_cols= 0;
181
static uint32_t num_blob_cols_size;
182
static uint32_t num_blob_cols_size_min;
183
static uint32_t num_int_cols_index= 0;
184
static uint32_t num_char_cols_index= 0;
184
185
static uint32_t iterations;
185
186
static uint64_t actual_queries= 0;
186
187
static uint64_t auto_actual_queries;
207
207
static Statement *create_statements= NULL;
209
209
static std::vector <Statement *> query_statements;
210
static unsigned int query_statements_count;
210
static uint32_t query_statements_count;
214
void print_conclusions(Conclusions *con);
215
void print_conclusions_csv(Conclusions *con);
214
void print_conclusions(Conclusions &con);
215
void print_conclusions_csv(Conclusions &con);
216
216
void generate_stats(Conclusions *con, OptionString *eng, Stats *sptr);
217
217
uint32_t parse_comma(const char *string, std::vector <uint32_t> &range);
218
218
uint32_t parse_delimiter(const char *script, Statement **stmt, char delm);
219
219
uint32_t parse_option(const char *origin, OptionString **stmt, char delm);
220
static int drop_schema(drizzle_con_st *con, const char *db);
220
static void drop_schema(drizzle_con_st &con, const char *db);
221
221
uint32_t get_random_string(char *buf, size_t size);
222
222
static Statement *build_table_string(void);
223
223
static Statement *build_insert_string(void);
224
224
static Statement *build_update_string(void);
225
225
static Statement * build_select_string(bool key);
226
static int generate_primary_key_list(drizzle_con_st *con, OptionString *engine_stmt);
227
static int create_schema(drizzle_con_st *con, const char *db, Statement *stmt,
228
OptionString *engine_stmt, Stats *sptr);
229
static int run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur,
226
static int generate_primary_key_list(drizzle_con_st &con, OptionString *engine_stmt);
227
static void create_schema(drizzle_con_st &con, const char *db, Statement *stmt, OptionString *engine_stmt, Stats *sptr);
228
static void run_scheduler(Stats *sptr, Statement **stmts, uint32_t concur, uint64_t limit);
231
229
void statement_cleanup(Statement *stmt);
232
230
void option_cleanup(OptionString *stmt);
233
void concurrency_loop(drizzle_con_st *con, uint32_t current, OptionString *eptr);
234
static int 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);
231
void concurrency_loop(drizzle_con_st &con, uint32_t current, OptionString *eptr);
232
static void run_statements(drizzle_con_st &con, Statement *stmt);
233
void slap_connect(drizzle_con_st &con, bool connect_to_schema);
234
void slap_close(drizzle_con_st &con);
235
static int run_query(drizzle_con_st &con, drizzle_result_st *result, const char *query, int len);
236
void standard_deviation(Conclusions &con, Stats *sptr);
240
238
static const char ALPHANUMERICS[]=
241
239
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
293
286
commit_counter= 0;
295
run_query(&con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
288
run_query(con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
298
291
for (ptr= ctx->getStmt(), detach_counter= 0;
299
292
ptr && ptr->getLength();
300
293
ptr= ptr->getNext(), detach_counter++)
302
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
295
if (not opt_only_print && detach_rate && !(detach_counter % detach_rate))
305
slap_connect(&con, true);
298
slap_connect(con, true);
334
327
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
335
328
(int)ptr->getLength(), ptr->getString(), key);
337
if (run_query(&con, &result, buffer, length))
330
if (run_query(con, &result, buffer, length))
339
332
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
340
333
internal::my_progname, (uint32_t)length, buffer, drizzle_con_error(&con));
347
if (run_query(&con, &result, ptr->getString(), ptr->getLength()))
340
if (run_query(con, &result, ptr->getString(), ptr->getLength()))
349
342
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
350
343
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
348
if (not opt_only_print)
357
350
while ((row = drizzle_row_next(&result)))
643
636
printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
644
637
drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
648
641
/* Seed the random number generator if we will be using it. */
649
642
if (auto_generate_sql)
651
644
if (opt_set_random_seed == 0)
652
opt_set_random_seed= (unsigned int)time(NULL);
645
opt_set_random_seed= (uint32_t)time(NULL);
653
646
srandom(opt_set_random_seed);
656
649
/* globals? Yes, so we only have to run strlen once */
657
650
delimiter_length= delimiter.length();
659
slap_connect(&con, false);
652
slap_connect(con, false);
661
654
/* Main iterations loop */
672
665
if (concurrency.size())
674
667
for (current= &concurrency[0]; current && *current; current++)
675
concurrency_loop(&con, *current, eptr);
668
concurrency_loop(con, *current, eptr);
679
672
uint32_t infinite= 1;
681
concurrency_loop(&con, infinite, eptr);
674
concurrency_loop(con, infinite, eptr);
683
676
while (infinite++);
687
drop_schema(&con, create_schema_string.c_str());
679
if (not opt_preserve)
680
drop_schema(con, create_schema_string.c_str());
689
682
} while (eptr ? (eptr= eptr->getNext()) : 0);
696
689
/* now free all the strings we created */
697
if (!opt_password.empty())
690
if (not opt_password.empty())
698
691
opt_password.erase();
700
693
concurrency.clear();
810
803
generate_stats(&conclusion, eptr, head_sptr);
813
print_conclusions(&conclusion);
814
if (!opt_csv_str.empty())
815
print_conclusions_csv(&conclusion);
806
print_conclusions(conclusion);
807
if (not opt_csv_str.empty())
808
print_conclusions_csv(conclusion);
817
810
delete [] head_sptr;
822
get_random_string(char *buf, size_t size)
814
uint32_t get_random_string(char *buf, size_t size)
824
816
char *buf_ptr= buf;
1259
1249
verbose= opt_verbose.length();
1261
1251
/* If something is created we clean it up, otherwise we leave schemas alone */
1262
if ( (!create_string.empty()) || auto_generate_sql)
1252
if ( (not create_string.empty()) || auto_generate_sql)
1263
1253
opt_preserve= false;
1265
if (auto_generate_sql && (!create_string.empty() || !user_supplied_query.empty()))
1255
if (auto_generate_sql && (not create_string.empty() || !user_supplied_query.empty()))
1267
1257
fprintf(stderr,
1268
1258
"%s: Can't use --auto-generate-sql when create and query strings are specified!\n",
1269
1259
internal::my_progname);
1273
1263
if (auto_generate_sql && auto_generate_sql_guid_primary &&
1499
if (!create_string.empty() && !stat(create_string.c_str(), &sbuf))
1489
if (not create_string.empty() && !stat(create_string.c_str(), &sbuf))
1502
1492
std::vector<char> tmp_string;
1503
if (!S_ISREG(sbuf.st_mode))
1493
if (not S_ISREG(sbuf.st_mode))
1505
1495
fprintf(stderr,"%s: Create file was not a regular file\n",
1506
1496
internal::my_progname);
1509
1499
if ((data_file= open(create_string.c_str(), O_RDWR)) == -1)
1511
1501
fprintf(stderr,"%s: Could not open create file\n", internal::my_progname);
1514
1504
if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1516
1506
fprintf(stderr, "Request for more memory than architecture supports\n");
1519
1509
tmp_string.resize(sbuf.st_size + 1);
1520
1510
bytes_read= read(data_file, (unsigned char*) &tmp_string[0],
1527
1517
parse_delimiter(&tmp_string[0], &create_statements, delimiter[0]);
1529
else if (!create_string.empty())
1519
else if (not create_string.empty())
1531
1521
parse_delimiter(create_string.c_str(), &create_statements, delimiter[0]);
1534
1524
/* Set this up till we fully support options on user generated queries */
1535
if (!user_supplied_query.empty())
1525
if (not user_supplied_query.empty())
1537
1527
query_statements_count=
1538
1528
parse_option("default", &query_options, ',');
1540
1530
query_statements.resize(query_statements_count);
1543
if (!user_supplied_query.empty() && !stat(user_supplied_query.c_str(), &sbuf))
1533
if (not user_supplied_query.empty() && !stat(user_supplied_query.c_str(), &sbuf))
1546
1536
std::vector<char> tmp_string;
1548
if (!S_ISREG(sbuf.st_mode))
1538
if (not S_ISREG(sbuf.st_mode))
1550
1540
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
1551
1541
internal::my_progname);
1554
1544
if ((data_file= open(user_supplied_query.c_str(), O_RDWR)) == -1)
1556
1546
fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1559
1549
if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1561
1551
fprintf(stderr, "Request for more memory than architecture supports\n");
1564
1554
tmp_string.resize((size_t)(sbuf.st_size + 1));
1565
1555
bytes_read= read(data_file, (unsigned char*) &tmp_string[0],
1570
1560
fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1572
if (!user_supplied_query.empty())
1562
if (not user_supplied_query.empty())
1573
1563
actual_queries= parse_delimiter(&tmp_string[0], &query_statements[0],
1576
else if (!user_supplied_query.empty())
1566
else if (not user_supplied_query.empty())
1578
1568
actual_queries= parse_delimiter(user_supplied_query.c_str(), &query_statements[0],
1583
if (!user_supplied_pre_statements.empty()
1573
if (not user_supplied_pre_statements.empty()
1584
1574
&& !stat(user_supplied_pre_statements.c_str(), &sbuf))
1587
1577
std::vector<char> tmp_string;
1589
if (!S_ISREG(sbuf.st_mode))
1579
if (not S_ISREG(sbuf.st_mode))
1591
1581
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
1592
1582
internal::my_progname);
1595
1585
if ((data_file= open(user_supplied_pre_statements.c_str(), O_RDWR)) == -1)
1597
1587
fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1600
1590
if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1602
1592
fprintf(stderr, "Request for more memory than architecture supports\n");
1605
1595
tmp_string.resize((size_t)(sbuf.st_size + 1));
1606
1596
bytes_read= read(data_file, (unsigned char*) &tmp_string[0],
1611
1601
fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1613
if (!user_supplied_pre_statements.empty())
1603
if (not user_supplied_pre_statements.empty())
1614
1604
(void)parse_delimiter(&tmp_string[0], &pre_statements,
1617
else if (!user_supplied_pre_statements.empty())
1607
else if (not user_supplied_pre_statements.empty())
1619
1609
(void)parse_delimiter(user_supplied_pre_statements.c_str(),
1620
1610
&pre_statements,
1624
if (!user_supplied_post_statements.empty()
1614
if (not user_supplied_post_statements.empty()
1625
1615
&& !stat(user_supplied_post_statements.c_str(), &sbuf))
1628
1618
std::vector<char> tmp_string;
1630
if (!S_ISREG(sbuf.st_mode))
1620
if (not S_ISREG(sbuf.st_mode))
1632
1622
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
1633
1623
internal::my_progname);
1636
1626
if ((data_file= open(user_supplied_post_statements.c_str(), O_RDWR)) == -1)
1638
1628
fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1642
1632
if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1644
1634
fprintf(stderr, "Request for more memory than architecture supports\n");
1647
1637
tmp_string.resize((size_t)(sbuf.st_size + 1));
1654
1644
fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1656
if (!user_supplied_post_statements.empty())
1646
if (not user_supplied_post_statements.empty())
1657
1647
(void)parse_delimiter(&tmp_string[0], &post_statements,
1660
else if (!user_supplied_post_statements.empty())
1650
else if (not user_supplied_post_statements.empty())
1662
1652
(void)parse_delimiter(user_supplied_post_statements.c_str(), &post_statements,
1728
1718
if (run_query(con, &result, "SELECT id from t1", strlen("SELECT id from t1")))
1730
1720
fprintf(stderr,"%s: Cannot select GUID primary keys. (%s)\n", internal::my_progname,
1731
drizzle_con_error(con));
1721
drizzle_con_error(&con));
1735
1725
uint64_t num_rows_ret= drizzle_result_row_count(&result);
1736
1726
if (num_rows_ret > SIZE_MAX)
1738
1728
fprintf(stderr, "More primary keys than than architecture supports\n");
1741
1731
size_t primary_keys_number_of;
1742
1732
primary_keys_number_of= (size_t)num_rows_ret;
1803
1790
if (verbose >= 3)
1804
1791
printf("%s;\n", query);
1806
if (drizzle_select_db(con, &result, db, &ret) == NULL ||
1793
if (drizzle_select_db(&con, &result, db, &ret) == NULL ||
1807
1794
ret != DRIZZLE_RETURN_OK)
1809
1796
fprintf(stderr,"%s: Cannot select schema '%s': %s\n",internal::my_progname, db,
1810
1797
ret == DRIZZLE_RETURN_ERROR_CODE ?
1811
drizzle_result_error(&result) : drizzle_con_error(con));
1798
drizzle_result_error(&result) : drizzle_con_error(&con));
1814
1801
drizzle_result_free(&result);
1815
1802
sptr->setCreateCount(sptr->getCreateCount()+1);
1846
1833
if (run_query(con, NULL, buffer, strlen(buffer)))
1848
1835
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1849
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1850
if (!opt_ignore_sql_errors)
1836
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
1837
if (not opt_ignore_sql_errors)
1853
1840
sptr->setCreateCount(sptr->getCreateCount()+1);
1857
1844
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1859
1846
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1860
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1861
if (!opt_ignore_sql_errors)
1847
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
1848
if (not opt_ignore_sql_errors)
1864
1851
sptr->setCreateCount(sptr->getCreateCount()+1);
1890
1874
if (run_query(con, NULL, query, len))
1892
1876
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
1893
internal::my_progname, db, drizzle_con_error(con));
1877
internal::my_progname, db, drizzle_con_error(&con));
1903
run_statements(drizzle_con_st *con, Statement *stmt)
1882
static void run_statements(drizzle_con_st &con, Statement *stmt)
1907
for (ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1884
for (Statement *ptr= stmt; ptr && ptr->getLength(); ptr= ptr->getNext())
1909
1886
if (run_query(con, NULL, ptr->getString(), ptr->getLength()))
1911
1888
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
1912
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(con));
1889
internal::my_progname, (uint32_t)ptr->getLength(), ptr->getString(), drizzle_con_error(&con));
2186
2144
number ranges from a comma seperated string.
2187
2145
In restrospect, this is a lousy name from this function.
2190
parse_comma(const char *string, std::vector <uint32_t> &range)
2147
uint32_t parse_comma(const char *string, std::vector <uint32_t> &range)
2192
unsigned int count= 1,x; /* We know that there is always one */
2149
uint32_t count= 1; /* We know that there is always one */
2194
2151
char *ptr= (char *)string;
2197
2154
for (;*ptr; ptr++)
2198
2155
if (*ptr == ',') count++;
2217
print_conclusions(Conclusions *con)
2173
void print_conclusions(Conclusions &con)
2219
2175
printf("Benchmark\n");
2220
if (con->getEngine())
2221
printf("\tRunning for engine %s\n", con->getEngine());
2222
if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
2176
if (con.getEngine())
2177
printf("\tRunning for engine %s\n", con.getEngine());
2179
if (not opt_label.empty() || !opt_auto_generate_sql_type.empty())
2224
2181
const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
2225
2182
printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
2227
2184
printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
2228
con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
2185
con.getCreateAvgTiming() / 1000, con.getCreateAvgTiming() % 1000);
2229
2186
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
2230
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000);
2187
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000);
2231
2188
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
2232
con->getMinTiming() / 1000, con->getMinTiming() % 1000);
2189
con.getMinTiming() / 1000, con.getMinTiming() % 1000);
2233
2190
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
2234
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000);
2191
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000);
2235
2192
printf("\tTotal time for tests: %ld.%03ld seconds\n",
2236
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000);
2237
printf("\tStandard Deviation: %ld.%03ld\n", con->getStdDev() / 1000, con->getStdDev() % 1000);
2238
printf("\tNumber of queries in create queries: %"PRIu64"\n", con->getCreateCount());
2193
con.getSumOfTime() / 1000, con.getSumOfTime() % 1000);
2194
printf("\tStandard Deviation: %ld.%03ld\n", con.getStdDev() / 1000, con.getStdDev() % 1000);
2195
printf("\tNumber of queries in create queries: %"PRIu64"\n", con.getCreateCount());
2239
2196
printf("\tNumber of clients running queries: %u/%u\n",
2240
con->getUsers(), con->getRealUsers());
2197
con.getUsers(), con.getRealUsers());
2241
2198
printf("\tNumber of times test was run: %u\n", iterations);
2242
printf("\tAverage number of queries per client: %"PRIu64"\n", con->getAvgRows());
2199
printf("\tAverage number of queries per client: %"PRIu64"\n", con.getAvgRows());
2247
print_conclusions_csv(Conclusions *con)
2203
void print_conclusions_csv(Conclusions &con)
2250
2205
char buffer[HUGE_STRING_LENGTH];
2251
2206
char label_buffer[HUGE_STRING_LENGTH];
2252
2207
size_t string_len;
2286
2241
snprintf(buffer, HUGE_STRING_LENGTH,
2287
2242
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,%ld.%03ld,"
2288
2243
"%u,%u,%u,%"PRIu64"\n",
2289
con->getEngine() ? con->getEngine() : "", /* Storage engine we ran against */
2244
con.getEngine() ? con.getEngine() : "", /* Storage engine we ran against */
2290
2245
label_buffer, /* Load type */
2291
con->getAvgTiming() / 1000, con->getAvgTiming() % 1000, /* Time to load */
2292
con->getMinTiming() / 1000, con->getMinTiming() % 1000, /* Min time */
2293
con->getMaxTiming() / 1000, con->getMaxTiming() % 1000, /* Max time */
2294
con->getSumOfTime() / 1000, con->getSumOfTime() % 1000, /* Total time */
2295
con->getStdDev() / 1000, con->getStdDev() % 1000, /* Standard Deviation */
2246
con.getAvgTiming() / 1000, con.getAvgTiming() % 1000, /* Time to load */
2247
con.getMinTiming() / 1000, con.getMinTiming() % 1000, /* Min time */
2248
con.getMaxTiming() / 1000, con.getMaxTiming() % 1000, /* Max time */
2249
con.getSumOfTime() / 1000, con.getSumOfTime() % 1000, /* Total time */
2250
con.getStdDev() / 1000, con.getStdDev() % 1000, /* Standard Deviation */
2296
2251
iterations, /* Iterations */
2297
con->getUsers(), /* Children used max_timing */
2298
con->getRealUsers(), /* Children used max_timing */
2299
con->getAvgRows() /* Queries run */
2252
con.getUsers(), /* Children used max_timing */
2253
con.getRealUsers(), /* Children used max_timing */
2254
con.getAvgRows() /* Queries run */
2301
2256
size_t buff_len= strlen(buffer);
2302
2257
ssize_t write_ret= write(csv_file, (unsigned char*) buffer, buff_len);
2416
2369
usleep(random()%opt_delayed_start);
2418
2371
if ((drizzle= drizzle_create(NULL)) == NULL ||
2419
drizzle_con_add_tcp(drizzle, con, host.c_str(), opt_drizzle_port,
2372
drizzle_con_add_tcp(drizzle, &con, host.c_str(), opt_drizzle_port,
2421
2374
opt_password.c_str(),
2422
2375
connect_to_schema ? create_schema_string.c_str() : NULL,
2423
2376
use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL) == NULL)
2425
2378
fprintf(stderr,"%s: Error creating drizzle object\n", internal::my_progname);
2429
2382
for (uint32_t x= 0; x < 10; x++)
2431
if ((ret= drizzle_con_connect(con)) == DRIZZLE_RETURN_OK)
2384
if ((ret= drizzle_con_connect(&con)) == DRIZZLE_RETURN_OK)
2433
2386
/* Connect suceeded */
2434
2387
connect_error= 0;
2439
2392
if (connect_error)
2441
2394
fprintf(stderr,"%s: Error when connecting to server: %d %s\n", internal::my_progname,
2442
ret, drizzle_con_error(con));
2395
ret, drizzle_con_error(&con));
2448
standard_deviation (Conclusions *con, Stats *sptr)
2400
void standard_deviation(Conclusions &con, Stats *sptr)
2451
2402
long int sum_of_squares;
2452
2403
double the_catch;
2455
2406
if (iterations == 1 || iterations == 0)
2461
2413
for (ptr= sptr, x= 0, sum_of_squares= 0; x < iterations; ptr++, x++)
2463
2415
long int deviation;
2465
deviation= ptr->getTiming() - con->getAvgTiming();
2417
deviation= ptr->getTiming() - con.getAvgTiming();
2466
2418
sum_of_squares+= deviation*deviation;
2469
2421
the_catch= sqrt((double)(sum_of_squares/(iterations -1)));
2470
con->setStdDev((long int)the_catch);
2422
con.setStdDev((long int)the_catch);