From cf5cfe44d60e1066999eff41bd239f8f4a59cd3e Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Tue, 20 Sep 2005 12:07:29 +0000 Subject: [PATCH] added a -g switch for gnuplot instructions in output. This way, the outpit stream can be used as input to gnuplot (when saved to a file, that is), and the gnuplot instruction file is obsolete, hence removed --- zoom/zoom-benchmark.c | 34 ++++++++++++++++++++++++++++++++-- zoom/zoom-benchmark.gpt | 23 ----------------------- 2 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 zoom/zoom-benchmark.gpt diff --git a/zoom/zoom-benchmark.c b/zoom/zoom-benchmark.c index 3a22023..fa15e7d 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.12 2005-09-20 12:07:29 marc 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 @@ -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,6 +193,7 @@ void print_option_error() "[-c no_concurrent (max 4096)] " "[-n no_repeat] " "[-b (piggypack)] " + "[-g (gnuplot outfile)] " "[-p proxy] \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) { @@ -222,6 +225,9 @@ void read_params(int argc, char **argv, struct parameters_t *p_parameters){ case 'b': p_parameters->piggypack = 1; break; + case 'g': + p_parameters->gnuplot = 1; + break; case 'n': p_parameters->repeat = atoi(arg); break; @@ -242,6 +248,7 @@ void read_params(int argc, char **argv, struct parameters_t *p_parameters){ //printf(" timeout: %d \n", p_parameters->timeout); 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 +267,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"); } @@ -369,9 +378,30 @@ int main(int argc, char **argv) } // 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); diff --git a/zoom/zoom-benchmark.gpt b/zoom/zoom-benchmark.gpt deleted file mode 100644 index 31eb58f..0000000 --- a/zoom/zoom-benchmark.gpt +++ /dev/null @@ -1,23 +0,0 @@ - -# -# $Id: zoom-benchmark.gpt,v 1.6 2005-09-20 11:29:03 marc Exp $ -# - -set title "Z39.50 connection plot" -set xlabel "Connection" -set ylabel "Time Seconds" -set zlabel "Progress" -#set yrange [ 0 : ] -#set zrange [ -9 : ] -set ticslevel 0 -#set hidden3d -set grid -set pm3d -splot 'out.txt' using ($1):($2):($3) t '' with points -#splot 'out.txt' using ($1):($2):($3) t '' with linespoints -pause -1 "Hit return to continue" - - -reset - - -- 1.7.10.4