fputs(
"ftsbench - full text search benchmark ofr RDBMS\n"
"Initialization of DB:\n"
- "\tftsbench -i [-b RDBMS] [-n NUMROW] [-l LEXFILE] [-g GAMMAFILE] [-f FLAGS] -d DBNAME\n"
+ "\tftsbench -i [-b RDBMS] [-n NUMROW] [-l LEXFILE] [-g GAMMAFILE] [-f FLAGS] [-q] -d DBNAME\n"
"FLAGS are comma-separate list of:\n"
" gin - use GIN index\n"
" gist - use GiST index\n"
);
fputs(
"Run tests:\n"
- "\tftsbench [-b RDBMS] [-c NCLIENTS] [-n NUMQUERY] [-l LEXFILE] [-g GAMMAFILE] [-f FLAGS] -d DBNAME\n"
+ "\tftsbench [-b RDBMS] [-c NCLIENTS] [-n NUMQUERY] [-l LEXFILE] [-g GAMMAFILE] [-f FLAGS] [-q] -d DBNAME\n"
"FLAGS are comma-separate list of:\n"
" and - AND'ing lexemes in query (default)\n"
" or - OR'ing lexemes in query\n"
RDBMS rdbms = NULLSQL;
int flags = 0;
int i;
+ int quiet = 0;
StringBuf b = {NULL,0,0};
- while((i=getopt(argn,argv,"ib:n:l:g:d:c:hf:")) != EOF) {
+ while((i=getopt(argn,argv,"ib:n:l:g:d:c:hf:q")) != EOF) {
switch(i) {
case 'i': initMode = 1; break;
case 'b': rdbms = getRDBMS(optarg); break;
case 'g': doc = strdup(optarg); break;
case 'd': dbname = strdup(optarg); break;
case 'f': flags = getFLAGS(optarg); break;
+ case 'q': quiet = 1; break;
case 'h':
default:
usage();
for(i=0;i<n;i++) {
generate_doc(&b);
db->InsertRow(db, i+1, b.str);
- if ( prev!=time(NULL) ) {
+ if ( !quiet && prev!=time(NULL) ) {
printf("\r%d(%.02f%%) rows inserted", i, (100.0*i)/n);
fflush(stdout);
prev = time(NULL);
}
}
- printf("\r%d(100.00%%) rows inserted. Finalyze insertion... ", i);
+ printf("%s%d(100.00%%) rows inserted. Finalyze insertion... ",
+ (quiet) ? "" : "\r", i);
fflush(stdout);
db->finishCreateScheme(db);
printf("done\n");
/*
* Initial query
*/
- printf("\r0(0.00%%) queries proceed");
- fflush(stdout);
+ if ( !quiet ) {
+ printf("\r0(0.00%%) queries proceed");
+ fflush(stdout);
+ }
benchFlags = flags;
benchCount = n;
}
}
- printf("\r%d(%.02f%%) queries proceed", 0, 0.0);
- fflush(stdout);
-
for(;;) {
int res, ntogo = 0;
if ( ntogo == 0 )
break;
- printf("\r%d(%.02f%%) queries proceed", total, (100.0*(float)total)/(nclients * n));
- fflush(stdout);
+ if ( !quiet ) {
+ printf("\r%d(%.02f%%) queries proceed", total, (100.0*(float)total)/(nclients * n));
+ fflush(stdout);
+ }
sleepTo.tv_sec = time(NULL) + 1;
res = pthread_cond_timedwait( &condFinish, &mutexFinish, &sleepTo );
dbs[i]->Close(dbs[i]);
}
- printf("\r%d(%.02f%%) queries proceed\n", total, (100.0*(float)total)/(nclients * n));
+ printf("%s%d(%.02f%%) queries proceed\n",
+ (quiet) ? "" : "\r", total, (100.0*(float)total)/(nclients * n));
printf("Total time: %.02f sec, Queries per second: %.02f\n", elapsed, total/elapsed);
fflush(stdout);
}