ASF Bugzilla – Attachment 18608 Details for
Bug 40054
ab performance improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
remove unnecessary structure copies
ab.diff (text/plain), 5.08 KB, created by
Brad Roberts
on 2006-07-17 06:57:52 UTC
(
hide
)
Description:
remove unnecessary structure copies
Filename:
MIME Type:
Creator:
Brad Roberts
Created:
2006-07-17 06:57:52 UTC
Size:
5.08 KB
patch
obsolete
>Index: ab.c >=================================================================== >--- ab.c (revision 421810) >+++ ab.c (working copy) >@@ -802,21 +802,21 @@ > double sdtot = 0, sdcon = 0, sdd = 0, sdwait = 0; > > for (i = 0; i < requests; i++) { >- struct data s = stats[i]; >- mincon = ap_min(mincon, s.ctime); >- mintot = ap_min(mintot, s.time); >- mind = ap_min(mind, s.time - s.ctime); >- minwait = ap_min(minwait, s.waittime); >+ struct data * s = &stats[i]; >+ mincon = ap_min(mincon, s->ctime); >+ mintot = ap_min(mintot, s->time); >+ mind = ap_min(mind, s->time - s->ctime); >+ minwait = ap_min(minwait, s->waittime); > >- maxcon = ap_max(maxcon, s.ctime); >- maxtot = ap_max(maxtot, s.time); >- maxd = ap_max(maxd, s.time - s.ctime); >- maxwait = ap_max(maxwait, s.waittime); >+ maxcon = ap_max(maxcon, s->ctime); >+ maxtot = ap_max(maxtot, s->time); >+ maxd = ap_max(maxd, s->time - s->ctime); >+ maxwait = ap_max(maxwait, s->waittime); > >- totalcon += s.ctime; >- total += s.time; >- totald += s.time - s.ctime; >- totalwait += s.waittime; >+ totalcon += s->ctime; >+ total += s->time; >+ totald += s->time - s->ctime; >+ totalwait += s->waittime; > } > meancon = totalcon / requests; > meantot = total / requests; >@@ -825,15 +825,15 @@ > > /* calculating the sample variance: the sum of the squared deviations, divided by n-1 */ > for (i = 0; i < requests; i++) { >- struct data s = stats[i]; >+ struct data * s = &stats[i]; > double a; >- a = ((double)s.time - meantot); >+ a = ((double)s->time - meantot); > sdtot += a * a; >- a = ((double)s.ctime - meancon); >+ a = ((double)s->ctime - meancon); > sdcon += a * a; >- a = ((double)s.time - (double)s.ctime - meand); >+ a = ((double)s->time - (double)s->ctime - meand); > sdd += a * a; >- a = ((double)s.waittime - meanwait); >+ a = ((double)s->waittime - meanwait); > sdwait += a * a; > } > >@@ -1076,13 +1076,13 @@ > apr_interval_time_t maxcon = 0, maxtot = 0; > > for (i = 0; i < requests; i++) { >- struct data s = stats[i]; >- mincon = ap_min(mincon, s.ctime); >- mintot = ap_min(mintot, s.time); >- maxcon = ap_max(maxcon, s.ctime); >- maxtot = ap_max(maxtot, s.time); >- totalcon += s.ctime; >- total += s.time; >+ struct data * s = &stats[i]; >+ mincon = ap_min(mincon, s->ctime); >+ mintot = ap_min(mintot, s->time); >+ maxcon = ap_max(maxcon, s->ctime); >+ maxtot = ap_max(maxtot, s->time); >+ totalcon += s->ctime; >+ total += s->time; > } > > if (requests > 0) { /* avoid division by zero (if 0 requests) */ >@@ -1245,18 +1245,18 @@ > } > /* save out time */ > if (done < requests) { >- struct data s; >+ struct data * s = &stats[done]; > if ((done) && heartbeatres && !(done % heartbeatres)) { > fprintf(stderr, "Completed %ld requests\n", done); > fflush(stderr); > } > c->done = apr_time_now(); >- s.read = c->read; >- s.starttime = c->start; >- s.ctime = ap_max(0, (c->connect - c->start) / 1000); >- s.time = ap_max(0, (c->done - c->start) / 1000); >- s.waittime = ap_max(0, (c->beginread - c->endwrite) / 1000); >- stats[done++] = s; >+ s->read = c->read; >+ s->starttime = c->start; >+ s->ctime = ap_max(0, (c->connect - c->start) / 1000); >+ s->time = ap_max(0, (c->done - c->start) / 1000); >+ s->waittime = ap_max(0, (c->beginread - c->endwrite) / 1000); >+ ++done; > } > } > >@@ -1480,19 +1480,19 @@ > err_length++; > } > if (done < requests) { >- struct data s; >+ struct data * s = &stats[done]; > doneka++; > if (done && heartbeatres && !(done % heartbeatres)) { > fprintf(stderr, "Completed %ld requests\n", done); > fflush(stderr); > } > c->done = apr_time_now(); >- s.read = c->read; >- s.starttime = c->start; >- s.ctime = ap_max(0, (c->connect - c->start) / 1000); >- s.waittime = ap_max(0, (c->beginread - c->endwrite) / 1000); >- s.time = ap_max(0, (c->done - c->start) / 1000); >- stats[done++] = s; >+ s->read = c->read; >+ s->starttime = c->start; >+ s->ctime = ap_max(0, (c->connect - c->start) / 1000); >+ s->waittime = ap_max(0, (c->beginread - c->endwrite) / 1000); >+ s->time = ap_max(0, (c->done - c->start) / 1000); >+ ++done; > } > c->keepalive = 0; > c->length = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 40054
: 18608