1 /* $Id: benchmark.c,v 1.3 2004-01-07 20:33:57 adam Exp $
2 * Copyright (C) 2003-2004 Index Data Aps
4 * This file is part of the YAZ toolkit.
6 * See the file LICENSE.
8 * This is an elementary benchmarker for server performance. It works
9 * by repeatedly connecting to, seaching in and retrieving from the
10 * specified server, and keeps statistics about the minimum, maximum
11 * and average times for each operation.
22 int nconnect; /* number of connections to make */
23 int nsearch; /* number of searches on each connection */
24 int npresent; /* number of presents for each search */
25 int full; /* 1 = fetch full records, 0 = brief */
26 int delay; /* number of ms to delay between ops */
27 int random; /* if true, delay is random 0-specified */
38 int main(int argc, char **argv)
44 while ((c = getopt(argc, argv, "c:s:p:fbd:r")) != -1) {
46 case 'c': options.nconnect = atoi(optarg); break;
47 case 's': options.nsearch = atoi(optarg); break;
48 case 'p': options.npresent = atoi(optarg); break;
49 case 'f': options.full = 1; break;
50 case 'b': options.full = 0; break;
51 case 'd': options.delay = atoi(optarg); break;
52 case 'r': options.random = 1; break;
57 if (argc-optind != 2) {
59 fprintf(stderr, "Usage: %s [options] <host> <port>\n"
60 " -c <n> Make <n> connection to the server [default: 3]\n"
61 " -s <n> Perform <n> searches on each connection [3]\n"
62 " -p <n> Make <n> present requests after each search [3]\n"
63 " -f Fetch full records [default: brief]\n"
64 " -b Fetch brief records\n"
65 " -d <n> Delay <n> ms after each operation\n"
66 " -r Delays are random between 0 and the specified number of ms\n"
72 port = atoi(argv[optind+1]);