Closed
Bug 287498
Opened 20 years ago
Closed 20 years ago
Add option for rsaperf to run for a fixed duration, and display ops/s
Categories
(NSS :: Test, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
3.10
People
(Reporter: julien.pierre, Assigned: julien.pierre)
Details
Attachments
(1 file, 1 obsolete file)
|
5.51 KB,
patch
|
nelson
:
review-
|
Details | Diff | Splinter Review |
As summary suggests.
| Assignee | ||
Updated•20 years ago
|
Priority: -- → P2
Target Milestone: --- → 3.10
| Assignee | ||
Comment 1•20 years ago
|
||
Attachment #178443 -
Flags: review?(nelson)
| Assignee | ||
Comment 2•20 years ago
|
||
I felt the need to add this option because doing a particular number of iterations has widely different results depending on the machine and can often be too short or too long to be useful.
Comment 3•20 years ago
|
||
Comment on attachment 178443 [details] [diff] [review] add -p period option, and display ops/s This patch was mostly OK, but I had two issues with it, one stylistic and one substantive. >+PRUint32 TimingSeconds(TimingContext *ctx) { >+ return ctx->millisecs/1000 + ctx->seconds + ctx->minutes*60 + >+ ctx->hours*3600 + ctx->days*86400; >+} >+ First, the value ctx->interval is already the elapsed time in microseconds. The values you used (seconds, milliseconds, minutes, etc) are derived from it in the function immediate below. So, just use the ctx->interval value instead. Second, I'm concerned about the loss of precision by truncating the fraction of a second here. Rounding would be better, but the best thing, IMO, is to compute the ops/second using the fractions of a second also, and then dislpay the result in whatever precision you desire. > static void timingUpdate(TimingContext *ctx) { > int64 tmp, remaining; > int64 L1000,L60,L24; > > LL_I2L(L1000,1000); > LL_I2L(L60,60); > LL_I2L(L24,24); > > LL_DIV(remaining, ctx->interval, L1000); > LL_MOD(tmp, remaining, L1000); Stylistic comment. You added a new if-then-else whose style doesn't match the rest of the file. E.g. >+ if (doIters) >+ { >+ } >+ else >+ { > }
Attachment #178443 -
Flags: review?(nelson) → review-
| Assignee | ||
Comment 4•20 years ago
|
||
Attachment #178443 -
Attachment is obsolete: true
| Assignee | ||
Comment 5•20 years ago
|
||
I checked in the updated patch to the tip . Checking in rsaperf.c; /cvsroot/mozilla/security/nss/cmd/rsaperf/rsaperf.c,v <-- rsaperf.c new revision: 1.10; previous revision: 1.9
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 6•20 years ago
|
||
Reopening to change assigned field.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Updated•20 years ago
|
Assignee: bishakhabanerjee → julien.pierre.bugs
Status: REOPENED → NEW
| Assignee | ||
Comment 7•20 years ago
|
||
Marking fixed.
Status: NEW → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → FIXED
Comment 8•20 years ago
|
||
Comment on attachment 178520 [details] [diff] [review] address Nelson's issues There is one potential problem with this patch. > TimingEnd(timeCtx); > printf("%ld iterations in %s\n", > iters, TimingGenerateString(timeCtx)); >+ printf("%.2f operations/s .\n", (double)(iters*1000000) / (double)timeCtx->interval ); On a 32-bit machine, if iters > 2147, this expression will experience an integer overflow, and produce an incorrect number. I suggest this: >+ printf("%.2f operations/s .\n", + ((double)(iters) * (double)1000000.0) / (double)timeCtx->interval ); This code is only correct on machines where PRInt64 is a primite integer type, not on those where it is a struct of two PRUint32s. But I think that all supported platforms now have a primite integer type for PRInt64, so it's probably safe. Does printf need a different format specifier for double than for float? (I seem to recall that it did not in K&R v1, because all floats got promoted to doubles when passed as function arguments. But now with ANSI c, I'm not sure (don't have K&R 2 handy to check). > TimingDivide(timeCtx, iters); > printf("one operation every %s\n", TimingGenerateString(timeCtx));
Attachment #178520 -
Flags: review-
Comment 9•20 years ago
|
||
reopening for resolution to integer overflow issue with previous patch.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 10•20 years ago
|
||
The %f specified is fine for both double and float, as far as I can tell from the man page on printf(3C) in Solaris. I verified your proposed change fixed the problem, and checked it in . Checking in rsaperf.c; /cvsroot/mozilla/security/nss/cmd/rsaperf/rsaperf.c,v <-- rsaperf.c new revision: 1.11; previous revision: 1.10 done Marking fixed again.
Status: REOPENED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•