View | Details | Raw Unified | Return to bug 50644
Collapse All | Expand All

(-)ab.c.orig (-1 / +22 lines)
Lines 243-248 Link Here
243
    char cbuff[CBUFFSIZE];      /* a buffer to store server response header */
243
    char cbuff[CBUFFSIZE];      /* a buffer to store server response header */
244
    int cbx;                    /* offset in cbuffer */
244
    int cbx;                    /* offset in cbuffer */
245
    int keepalive;              /* non-zero if a keep-alive request */
245
    int keepalive;              /* non-zero if a keep-alive request */
246
    int kasent;                 /* keep-alive requests sent by this connection */
246
    int gotheader;              /* non-zero if we have the entire header in
247
    int gotheader;              /* non-zero if we have the entire header in
247
                                 * cbuff */
248
                                 * cbuff */
248
    apr_time_t start,           /* Start of connection */
249
    apr_time_t start,           /* Start of connection */
Lines 282-287 Link Here
282
int confidence = 1;     /* Show confidence estimator and warnings */
283
int confidence = 1;     /* Show confidence estimator and warnings */
283
int tlimit = 0;         /* time limit in secs */
284
int tlimit = 0;         /* time limit in secs */
284
int keepalive = 0;      /* try and do keepalive connections */
285
int keepalive = 0;      /* try and do keepalive connections */
286
int maxkarequests = 0;  /* max requests to send per keep-alive connection*/
285
int windowsize = 0;     /* we use the OS default window size */
287
int windowsize = 0;     /* we use the OS default window size */
286
char servername[1024];  /* name that server reports */
288
char servername[1024];  /* name that server reports */
287
char *hostname;         /* host name from URL */
289
char *hostname;         /* host name from URL */
Lines 1154-1159 Link Here
1154
    c->read = 0;
1156
    c->read = 0;
1155
    c->bread = 0;
1157
    c->bread = 0;
1156
    c->keepalive = 0;
1158
    c->keepalive = 0;
1159
    c->kasent = 0;
1157
    c->cbx = 0;
1160
    c->cbx = 0;
1158
    c->gotheader = 0;
1161
    c->gotheader = 0;
1159
    c->rwrite = 0;
1162
    c->rwrite = 0;
Lines 1516-1521 Link Here
1516
            bad++;
1519
            bad++;
1517
            err_length++;
1520
            err_length++;
1518
        }
1521
        }
1522
	// Implement max requests per keep-alive connection.
1523
        c->kasent++;
1524
	if ( keepalive && maxkarequests && c->kasent == maxkarequests ) {
1525
            doneka++;
1526
            close_connection(c);
1527
            return;
1528
        } else
1519
        if (done < requests) {
1529
        if (done < requests) {
1520
            struct data *s = &stats[done++];
1530
            struct data *s = &stats[done++];
1521
            doneka++;
1531
            doneka++;
Lines 1528-1533 Link Here
1528
                fprintf(stderr, "Completed %d requests\n", done);
1538
                fprintf(stderr, "Completed %d requests\n", done);
1529
                fflush(stderr);
1539
                fflush(stderr);
1530
            }
1540
            }
1541
            // It seems the way we send requests with kee-alives enabled causes
1542
            // extra requests to be sent. As soon as a request completes
1543
            // another is sent, as we don't check how many are "in flight",
1544
            // only how many are are not yet complete. We rely on the test loop
1545
            // to tell us when to stop sending requests. Adding a return here
1546
            // helps mitigate the issue, but does not resolve it.
1547
            if ( done == requests ) return;
1531
        }
1548
        }
1532
        c->keepalive = 0;
1549
        c->keepalive = 0;
1533
        c->length = 0;
1550
        c->length = 0;
Lines 1868-1873 Link Here
1868
    fprintf(stderr, "    -X proxy:port   Proxyserver and port number to use\n");
1885
    fprintf(stderr, "    -X proxy:port   Proxyserver and port number to use\n");
1869
    fprintf(stderr, "    -V              Print version number and exit\n");
1886
    fprintf(stderr, "    -V              Print version number and exit\n");
1870
    fprintf(stderr, "    -k              Use HTTP KeepAlive feature\n");
1887
    fprintf(stderr, "    -k              Use HTTP KeepAlive feature\n");
1888
    fprintf(stderr, "    -m count        Maximum of requests per KeepAlive connection\n");
1871
    fprintf(stderr, "    -d              Do not show percentiles served table.\n");
1889
    fprintf(stderr, "    -d              Do not show percentiles served table.\n");
1872
    fprintf(stderr, "    -S              Do not show confidence estimators and warnings.\n");
1890
    fprintf(stderr, "    -S              Do not show confidence estimators and warnings.\n");
1873
    fprintf(stderr, "    -g filename     Output collected data to gnuplot format file.\n");
1891
    fprintf(stderr, "    -g filename     Output collected data to gnuplot format file.\n");
Lines 2040-2046 Link Here
2040
#endif
2058
#endif
2041
2059
2042
    apr_getopt_init(&opt, cntxt, argc, argv);
2060
    apr_getopt_init(&opt, cntxt, argc, argv);
2043
    while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
2061
    while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sqm:"
2044
#ifdef USE_SSL
2062
#ifdef USE_SSL
2045
            "Z:f:"
2063
            "Z:f:"
2046
#endif
2064
#endif
Lines 2055-2060 Link Here
2055
            case 'k':
2073
            case 'k':
2056
                keepalive = 1;
2074
                keepalive = 1;
2057
                break;
2075
                break;
2076
            case 'm':
2077
                maxkarequests = atoi(optarg);
2078
                break;
2058
            case 'q':
2079
            case 'q':
2059
                heartbeatres = 0;
2080
                heartbeatres = 0;
2060
                break;
2081
                break;

Return to bug 50644