/*
- * "$Id: testspeed.c 7688 2008-06-24 04:34:52Z mike $"
+ * Scheduler speed test for CUPS.
*
- * Scheduler speed test for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2005 by Easy Software Products.
*
- * Copyright 2007-2008 by Apple Inc.
- * Copyright 1997-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * main() - Send multiple IPP requests and report on the average response
- * time.
- * do_test() - Run a test on a specific host...
- * usage() - Show program usage...
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* Include necessary headers...
*/
-#include <cups/string.h>
+#include <cups/string-private.h>
#include <cups/cups.h>
#include <cups/language.h>
-#include <cups/debug.h>
+#include <cups/debug-private.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
-#include <errno.h>
/*
static int do_test(const char *server, int port,
http_encryption_t encryption, int requests,
- int verbose);
-static void usage(void);
+ const char *opstring, int verbose);
+static void usage(void) _CUPS_NORETURN;
/*
end; /* End time */
double elapsed; /* Elapsed time */
int verbose; /* Verbosity */
+ const char *opstring; /* Operation name */
/*
port = ippPort();
encryption = HTTP_ENCRYPT_IF_REQUESTED;
verbose = 0;
+ opstring = NULL;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
for (ptr = argv[i] + 1; *ptr; ptr ++)
switch (*ptr)
{
+ case 'E' : /* Enable encryption */
+ encryption = HTTP_ENCRYPT_REQUIRED;
+ break;
+
case 'c' : /* Number of children */
i ++;
if (i >= argc)
children = atoi(argv[i]);
break;
- case 'r' : /* Number of requests */
+ case 'o' : /* Operation */
i ++;
if (i >= argc)
usage();
- requests = atoi(argv[i]);
+ opstring = argv[i];
break;
- case 'E' : /* Enable encryption */
- encryption = HTTP_ENCRYPT_REQUIRED;
+ case 'r' : /* Number of requests */
+ i ++;
+ if (i >= argc)
+ usage();
+
+ requests = atoi(argv[i]);
break;
case 'v' : /* Verbose logging */
start = time(NULL);
if (children < 1)
- return (do_test(server, port, encryption, requests, verbose));
+ return (do_test(server, port, encryption, requests, opstring, verbose));
else if (children == 1)
- good_children = do_test(server, port, encryption, requests, verbose) ? 0 : 1;
+ good_children = do_test(server, port, encryption, requests, opstring,
+ verbose) ? 0 : 1;
else
{
char options[255], /* Command-line options for child */
* Child goes here...
*/
- execlp(argv[0], argv[0], options, "0", reqstr, serverstr, (char *)NULL);
+ if (opstring)
+ execlp(argv[0], argv[0], options, "0", reqstr, "-o", opstring,
+ serverstr, (char *)NULL);
+ else
+ execlp(argv[0], argv[0], options, "0", reqstr, serverstr, (char *)NULL);
+
exit(errno);
}
else if (pid < 0)
int port, /* I - Port number to use */
http_encryption_t encryption, /* I - Encryption to use */
int requests, /* I - Number of requests to send */
+ const char *opstring, /* I - Operation string */
int verbose) /* I - Verbose output? */
{
int i; /* Looping var */
double reqtime, /* Time for this request */
elapsed; /* Elapsed time */
int op; /* Current operation */
- static ipp_op_t ops[4] = /* Operations to test... */
+ static ipp_op_t ops[5] = /* Operations to test... */
{
IPP_PRINT_JOB,
+ CUPS_GET_DEFAULT,
CUPS_GET_PRINTERS,
CUPS_GET_CLASSES,
IPP_GET_JOBS
* In addition, IPP_GET_JOBS needs a printer-uri attribute.
*/
- op = ops[i & 3];
+ if (opstring)
+ op = ippOpValue(opstring);
+ else
+ op = ops[i % (int)(sizeof(ops) / sizeof(ops[0]))];
+
request = ippNewRequest(op);
gettimeofday(&start, NULL);
static void
usage(void)
{
- puts("Usage: testspeed [-c children] [-h] [-r requests] [-v] [-E] "
- "hostname[:port]");
+ puts("Usage: testspeed [-c children] [-h] [-o operation] [-r requests] [-v] "
+ "[-E] hostname[:port]");
exit(0);
}
-
-
-
-/*
- * End of "$Id: testspeed.c 7688 2008-06-24 04:34:52Z mike $".
- */