httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-test/specweb99/specweb99-2.0 mod_specweb99.c
Date Wed, 30 Oct 2002 18:06:06 GMT
gregames    2002/10/30 10:06:06

  Modified:    specweb99/specweb99-2.0 mod_specweb99.c
  Log:
  give returnHTMLPageWithBuffer a buffer length parameter.  The CAD GETs were
  the slowest part of the SPECWeb99 workload.  oprofile showed tons of cycles
  in two strlen()s determining the size of the buffer, which could be up to 92K.
  
  customadscan now calls returnHTMLPageWithBuffer because it already has the
  length.  returnHTMLPageWithMessage now does a strlen, which should be OK
  since it is used for relatively short error messages.
  
  This improves 100% CAD GETs from 117 to 127 conforming connections on wimp.
  
  Revision  Changes    Path
  1.13      +12 -12    httpd-test/specweb99/specweb99-2.0/mod_specweb99.c
  
  Index: mod_specweb99.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/specweb99/specweb99-2.0/mod_specweb99.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_specweb99.c	29 Oct 2002 18:26:53 -0000	1.12
  +++ mod_specweb99.c	30 Oct 2002 18:06:06 -0000	1.13
  @@ -202,7 +202,7 @@
   }
   
   
  -static void returnHTMLPageWithBuffer(request_rec *r, char *buf)
  +static void returnHTMLPageWithBuffer(request_rec *r, char *buf, apr_size_t buflen)
   {
       char *bp_head;
       conn_rec *c = r->connection;
  @@ -213,12 +213,12 @@
       if (buf == NULL)
   	buf = "Error: tried to send buffer but it is NULL";
   
  -    bp_head = returnHTMLPageHead(r, strlen(buf));
  +    bp_head = returnHTMLPageHead(r, buflen);
   
       bb = apr_brigade_create(r->pool, c->bucket_alloc);
   
       b1 = apr_bucket_transient_create(bp_head, strlen(bp_head), c->bucket_alloc);
  -    b2 = apr_bucket_transient_create(buf, strlen(buf), c->bucket_alloc);
  +    b2 = apr_bucket_transient_create(buf, buflen, c->bucket_alloc);
       b3 = apr_bucket_immortal_create(boilerplate_end,
   				  boilerplate_end_len, c->bucket_alloc);
   
  @@ -244,7 +244,7 @@
       m = apr_pvsprintf(r->pool, fmt, args);
       va_end(args);
   
  -    returnHTMLPageWithBuffer(r, m);
  +    returnHTMLPageWithBuffer(r, m, strlen(m));
   }				/* returnHTMLPageWithMessage */
   
   static void returnHTMLPageWithFile(request_rec *r, char *fname)
  @@ -840,15 +840,16 @@
   	return NULL;
   
       len = s.size;
  -    buf = apr_palloc(r->pool, len + 1);
  +    buf = apr_palloc(r->pool, len);
   
  +    /* On systems with mmap, it might be faster to mmap the file, scan the mmap,
  +     * then send down mmap buckets for the unaltered pieces of the the file.
  +     * oprofile shows a lot of samples in file_read_actor in the Linux kernel.
  +     */
       if (((rv = apr_file_read_full(f, buf, len, &l)) != APR_SUCCESS)
   	|| (l != len))
   	return NULL;		/* Error on read */
   
  -    buf[len] = '\0';		/* Null-terminate it so that everybody else
  -				 * who has to handle this knows how long the
  -				 * buffer is. */
       index = buf;
       /*
        * It says in the run rules that we are to scan until the end of the
  @@ -868,7 +869,7 @@
   	index += 50;		/* Put the index past this marker, continue
   				 * scanning */
       }
  -    return buf;
  +    returnHTMLPageWithBuffer(r, buf, len);
   
   }				/* customadscan */
   
  @@ -984,8 +985,7 @@
   
       if ((strstr(filename, "class1") != NULL) ||
   	(strstr(filename, "class2") != NULL)) {
  -	caddr_t buf = customadscan(r, filename, adindex);
  -	returnHTMLPageWithBuffer(r, (char *) buf);
  +	customadscan(r, filename, adindex);
       }
       else {
   	returnHTMLPageWithFile(r, filename);
  
  
  

Mime
View raw message