X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zoom%2Fzoom-benchmark.c;h=722c4f287fcfc41d61b3c38dd58098b4989f540b;hp=3a2202331965211b32903446e37aa8c59662907d;hb=d168db0590bc858a1bc9bd5a6ea66abbcd8f7d7d;hpb=0edf0cd59d2db226273f2d9f3ba3dad96834a23e diff --git a/zoom/zoom-benchmark.c b/zoom/zoom-benchmark.c index 3a22023..722c4f2 100644 --- a/zoom/zoom-benchmark.c +++ b/zoom/zoom-benchmark.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-benchmark.c,v 1.11 2005-09-20 11:29:03 marc Exp $ + * $Id: zoom-benchmark.c,v 1.13 2005-10-22 13:28:03 adam Exp $ * * Asynchronous multi-target client doing search and piggyback retrieval */ @@ -31,6 +31,7 @@ static struct parameters_t { int timeout; char proxy[1024]; int piggypack; + int gnuplot; } parameters; struct event_line_t @@ -77,7 +78,7 @@ void update_events(int *elc, struct event_line_t *els, strcpy(els[iels].zoom_event, eventmsg); els[iels].error = error; strcpy(els[iels].errmsg, errmsg); - //print_event_line(&els[iels]); + /* print_event_line(&els[iels]); */ elc[ielc] += 1; } @@ -138,6 +139,7 @@ void init_statics() parameters.timeout = 0; parameters.repeat = 1; strcpy(parameters.proxy, nullstring); + parameters.gnuplot = 0; parameters.piggypack = 0; /* progress initializing */ @@ -191,8 +193,9 @@ void print_option_error() "[-c no_concurrent (max 4096)] " "[-n no_repeat] " "[-b (piggypack)] " + "[-g (gnuplot outfile)] " "[-p proxy] \n"); - //"[-t timeout] \n"); + /* "[-t timeout] \n"); */ exit(1); } @@ -200,7 +203,7 @@ void print_option_error() void read_params(int argc, char **argv, struct parameters_t *p_parameters){ char *arg; int ret; - while ((ret = options("h:q:c:t:p:bn:", argv, argc, &arg)) != -2) + while ((ret = options("h:q:c:t:p:bgn:", argv, argc, &arg)) != -2) { switch (ret) { @@ -216,12 +219,17 @@ void read_params(int argc, char **argv, struct parameters_t *p_parameters){ case 'c': p_parameters->concurrent = atoi(arg); break; - //case 't': - //p_parameters->timeout = atoi(arg); - // break; +#if 0 + case 't': + p_parameters->timeout = atoi(arg); + break; +#endif case 'b': p_parameters->piggypack = 1; break; + case 'g': + p_parameters->gnuplot = 1; + break; case 'n': p_parameters->repeat = atoi(arg); break; @@ -239,9 +247,12 @@ void read_params(int argc, char **argv, struct parameters_t *p_parameters){ printf(" query: %s \n", p_parameters->query); printf(" concurrent: %d \n", p_parameters->concurrent); printf(" repeat: %d \n", p_parameters->repeat); - //printf(" timeout: %d \n", p_parameters->timeout); +#if 0 + printf(" timeout: %d \n", p_parameters->timeout); +#endif printf(" proxy: %s \n", p_parameters->proxy); printf(" piggypack: %d \n\n", p_parameters->piggypack); + printf(" gnuplot: %d \n\n", p_parameters->gnuplot); } if (! strlen(p_parameters->host)) @@ -260,6 +271,8 @@ void read_params(int argc, char **argv, struct parameters_t *p_parameters){ void print_table_header() { + if (parameters.gnuplot) + printf("#"); printf ("target\tsecond.usec\tprogress\tevent\teventname\t"); printf("error\terrorname\n"); } @@ -366,12 +379,33 @@ int main(int argc, char **argv) - } // for (k = 0; k < parameters.repeat; k++) repeat loop + } /* for (k = 0; k < parameters.repeat; k++) repeat loop */ /* output */ + + if (parameters.gnuplot){ + printf("# gnuplot data and instruction file \n"); + printf("# gnuplot thisfile \n"); + printf("\n"); + printf("set title \"Z39.50 connection plot\"\n"); + printf("set xlabel \"Connection\"\n"); + printf("set ylabel \"Time Seconds\"\n"); + printf("set zlabel \"Progress\"\n"); + printf("set ticslevel 0\n"); + printf("set grid\n"); + printf("set pm3d\n"); + printf("splot '-' using ($1):($2):($3) t '' with points\n"); + printf("\n"); + printf("\n"); + } + print_table_header(); print_events(elc, els, parameters.concurrent); + if (parameters.gnuplot){ + printf("end\n"); + printf("pause -1 \"Hit ENTER to return\"\n"); + } /* destroy data structures and exit */ xfree(z);