"Fossies" - the Fresh Open Source Software Archive

Member "httperf-0.9.0/src/httperf.h" (7 Apr 2007, 6178 Bytes) of package /linux/www/old/httperf-0.9.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "httperf.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2     httperf -- a tool for measuring web server performance
    3     Copyright 2000-2007 Hewlett-Packard Company and Contributors listed in
    4     AUTHORS file. Originally contributed by David Mosberger-Tang
    5 
    6     This file is part of httperf, a web server performance measurment
    7     tool.
    8 
    9     This program is free software; you can redistribute it and/or
   10     modify it under the terms of the GNU General Public License as
   11     published by the Free Software Foundation; either version 2 of the
   12     License, or (at your option) any later version.
   13     
   14     In addition, as a special exception, the copyright holders give
   15     permission to link the code of this work with the OpenSSL project's
   16     "OpenSSL" library (or with modified versions of it that use the same
   17     license as the "OpenSSL" library), and distribute linked combinations
   18     including the two.  You must obey the GNU General Public License in
   19     all respects for all of the code used other than "OpenSSL".  If you
   20     modify this file, you may extend this exception to your version of the
   21     file, but you are not obligated to do so.  If you do not wish to do
   22     so, delete this exception statement from your version.
   23 
   24     This program is distributed in the hope that it will be useful,
   25     but WITHOUT ANY WARRANTY; without even the implied warranty of
   26     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   27     General Public License for more details.
   28 
   29     You should have received a copy of the GNU General Public License
   30     along with this program; if not, write to the Free Software
   31     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
   32     02110-1301, USA
   33 */
   34 
   35 #ifndef httperf_h
   36 #define httperf_h
   37 
   38 #include "config.h"
   39 
   40 #include <sys/time.h>
   41 #include <sys/types.h>
   42 #include <sys/resource.h>
   43 
   44 typedef double Time;
   45 
   46 #define NELEMS(a)   ((sizeof (a)) / sizeof ((a)[0]))
   47 #define TV_TO_SEC(tv)   ((tv).tv_sec + 1e-6*(tv).tv_usec)
   48 
   49 typedef union
   50   {
   51     char c;
   52     int i;
   53     long l;
   54     u_char uc;
   55     u_int ui;
   56     u_long ul;
   57     float f;
   58     double d;
   59     void *vp;
   60     const void *cvp;
   61   }
   62 Any_Type;
   63 
   64 typedef enum Dist_Type
   65   {
   66     DETERMINISTIC,  /* also called fixed-rate */
   67     UNIFORM,        /* over interval [min_iat,max_iat) */
   68     EXPONENTIAL     /* with mean mean_iat */
   69   }
   70 Dist_Type;
   71 
   72 typedef struct Load_Generator
   73   {
   74     const char *name;
   75     void (*init) (void);
   76     void (*start) (void);
   77     void (*stop) (void);
   78   }
   79 Load_Generator;
   80 
   81 typedef struct Stat_Collector
   82   {
   83     const char *name;
   84     /* START and STOP are timing sensitive, so they should be as short
   85        as possible.  More expensive stuff can be done during INIT and
   86        DUMP.  */
   87     void (*init) (void);
   88     void (*start) (void);
   89     void (*stop) (void);
   90     void (*dump) (void);
   91   }
   92 Stat_Collector;
   93 
   94 typedef struct Rate_Info
   95   {
   96     Dist_Type dist;     /* interarrival distribution */
   97     double rate_param;      /* 0 if mean_iat==0, else 1/mean_iat */
   98     Time mean_iat;      /* mean interarrival time */
   99     Time min_iat;       /* min interarrival time (for UNIFORM) */
  100     Time max_iat;           /* max interarrival time (for UNIFORM) */
  101   }
  102 Rate_Info;
  103 
  104 #define PRINT_HEADER    (1 << 0)
  105 #define PRINT_BODY  (1 << 1)
  106 
  107 typedef struct Cmdline_Params
  108   {
  109     int http_version;   /* (default) HTTP protocol version */
  110     const char *server; /* (default) hostname */
  111     const char *server_name; /* fully qualified server name */
  112     int port;       /* (default) server port */
  113     const char *uri;    /* (default) uri */
  114     Rate_Info rate;
  115     Time timeout;   /* watchdog timeout */
  116     Time think_timeout; /* timeout for server think time */
  117     int num_conns;  /* # of connections to generate */
  118     int num_calls;  /* # of calls to generate per connection */
  119     int burst_len;  /* # of calls to burst back-to-back */
  120     int max_piped;  /* max # of piped calls per connection */
  121     int max_conns;  /* max # of connections per session */
  122     int hog;        /* client may hog as much resources as possible */
  123     int send_buffer_size;
  124     int recv_buffer_size;
  125     int failure_status; /* status code that should be considered failure */
  126     int retry_on_failure; /* when a call fails, should we retry? */
  127     int close_with_reset; /* close connections with TCP RESET? */
  128     int print_request;  /* bit 0: print req headers, bit 1: print req body */
  129     int print_reply;    /* bit 0: print repl headers, bit 1: print repl body */
  130     int session_cookies; /* handle set-cookies? (at the session level) */
  131     int no_host_hdr;    /* don't send Host: header in request */
  132 #ifdef HAVE_SSL
  133     int use_ssl;    /* connect via SSL */
  134     int ssl_reuse;  /* reuse SSL Session ID */
  135     const char *ssl_cipher_list; /* client's list of SSL cipher suites */
  136 #endif
  137     const char *additional_header;  /* additional request header(s) */
  138     const char *method; /* default call method */
  139     struct
  140       {
  141     u_int id;
  142     u_int num_clients;
  143       }
  144     client;
  145     struct
  146       {
  147     char *file; /* name of the file where entries are */
  148     char do_loop;   /* boolean indicating if we want to loop on entries */
  149       }
  150     wlog;
  151     struct
  152       {
  153     u_int num_sessions; /* # of sessions */
  154     u_int num_calls;    /* # of calls per session */
  155     Time think_time;    /* user think time between calls */
  156       }
  157     wsess;
  158     struct
  159       {
  160     u_int num_sessions; /* # of sessions */
  161     u_int num_reqs;     /* # of user requests per session */
  162     Time think_time;    /* user think time between requests */
  163       }
  164     wsesspage;
  165     struct
  166       {
  167     u_int num_sessions; /* # of user-sessions */
  168     Time think_time;    /* user think time between calls */
  169     char *file;     /* name of the file where session defs are */
  170       }
  171     wsesslog;
  172     struct
  173       {
  174     u_int num_files;
  175     double target_miss_rate;
  176       }
  177     wset;
  178   }
  179 Cmdline_Params;
  180 
  181 extern const char *prog_name;
  182 extern int verbose;
  183 extern Cmdline_Params param;
  184 extern Time test_time_start;
  185 extern Time test_time_stop;
  186 extern struct rusage test_rusage_start;
  187 extern struct rusage test_rusage_stop;
  188 
  189 #ifdef HAVE_SSL
  190 # include <openssl/ssl.h>
  191   extern SSL_CTX *ssl_ctx;
  192 #endif
  193 
  194 #ifdef DEBUG
  195   extern int debug_level;
  196 # define DBG debug_level
  197 #else
  198 # define DBG 0
  199 #endif
  200 
  201 extern void panic (const char *msg, ...);
  202 extern void no_op (void);
  203 
  204 #endif /* httperf_h */