+ }
+
+ if(0){
+ printf("zoom-benchmark\n");
+ printf(" host: %s \n", p_parameters->host);
+ printf(" query: %s \n", p_parameters->query);
+ printf(" concurrent: %d \n", p_parameters->concurrent);
+ printf(" repeat: %d \n", p_parameters->repeat);
+#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))
+ print_option_error();
+ if (! strlen(p_parameters->query))
+ print_option_error();
+ if (! (p_parameters->concurrent > 0))
+ print_option_error();
+ if (! (p_parameters->repeat > 0))
+ print_option_error();
+ if (! (p_parameters->timeout >= 0))
+ print_option_error();
+ if (! ( p_parameters->concurrent <= 4096))
+ print_option_error();
+}
+
+void print_table_header()
+{
+ if (parameters.gnuplot)
+ printf("#");
+ printf ("target\tsecond.usec\tprogress\tevent\teventname\t");
+ printf("error\terrorname\n");
+}
+
+
+int main(int argc, char **argv)
+{
+ struct time_type time;
+ ZOOM_connection *z;
+ ZOOM_resultset *r;
+ int *elc;
+ struct event_line_t *els;
+ ZOOM_options o;
+ int i;
+ int k;
+
+ init_statics();
+
+ read_params(argc, argv, ¶meters);
+
+ z = xmalloc(sizeof(*z) * parameters.concurrent);
+ r = xmalloc(sizeof(*r) * parameters.concurrent);
+ elc = xmalloc(sizeof(*elc) * parameters.concurrent * parameters.repeat);
+ els = xmalloc(sizeof(*els)
+ * parameters.concurrent * parameters.repeat * 10);
+ o = ZOOM_options_create();
+
+ /* async mode */
+ ZOOM_options_set (o, "async", "1");
+
+ /* get first record of result set (using piggypack) */
+ if (parameters.piggypack)
+ ZOOM_options_set (o, "count", "1");
+
+ /* set proxy */
+ if (strlen(parameters.proxy))
+ ZOOM_options_set (o, "proxy", parameters.proxy);
+