[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 25 Mar 2010 22:58:03 +0100
From: "Magnum, P.I." <rawsmooth@...dband.net>
To: john-users@...ts.openwall.com
Subject: bench.c fix for extreme c/s figures
First I thought I'd post Solar directly with this, but other readers may
have an idea, so here goes:
Running under MPI, I experienced c/s rollover even from just a couple of
seconds of NT benchmarking. The problem was only when benchmarking, not
real cracking. I identified it as due to the sloppy conversion in this
line in benchmark_cps() in bench.c:
tmp.lo = count; tmp.hi = 0;
Enclosed is the dilettant take I made to make it better (along with some
more scaling, to mega and giga c/s) which was included in fullmpi-5.
This should apply more or less cleanly to standard john too. This fix
works just fine on my gear, but W.A's OSX system (using 64-bit longs and
presumably the same for ARCH_WORD) now reportedly produces figures of
"4294M c/s" for both real and virtual and for all and any formats,
whether fast or not and even when running on just one node.
I'm willing to admit I am the worst coder on earth but while I recognize
that figure, I don't really see what went wrong?
Moore's law will make this problem real even for non-mpi john soon so
it's not just an MPI problem for very long :)
magnum
diff --git a/src/bench.c b/src/bench.c
index 1dac82c..8e4d794 100644
--- a/src/bench.c
+++ b/src/bench.c
@@ -227,22 +227,29 @@ char *benchmark_format(struct fmt_main *format, int salts,
void benchmark_cps(unsigned ARCH_WORD count, clock_t time, char *buffer)
{
- unsigned int cps_hi, cps_lo;
+ long long cps_hi;
+ int cps_lo;
int64 tmp;
- tmp.lo = count; tmp.hi = 0;
+ tmp.lo = (unsigned int)count; tmp.hi = (unsigned int)(count >> 32);
mul64by32(&tmp, clk_tck);
- cps_hi = div64by32lo(&tmp, time);
+ cps_hi = (long long)div64by32lo(&tmp, time);
+ if (cps_hi >= 1000000000000)
+ sprintf(buffer, "%uG", (unsigned int)(cps_hi / 1000000000));
+ else
+ if (cps_hi >= 1000000000)
+ sprintf(buffer, "%uM", (unsigned int)(cps_hi / 1000000));
+ else
if (cps_hi >= 1000000)
- sprintf(buffer, "%uK", cps_hi / 1000);
+ sprintf(buffer, "%uK", (unsigned int)(cps_hi / 1000));
else
if (cps_hi >= 100)
- sprintf(buffer, "%u", cps_hi);
+ sprintf(buffer, "%u", (unsigned int)cps_hi);
else {
mul64by32(&tmp, 10);
cps_lo = div64by32lo(&tmp, time) % 10;
- sprintf(buffer, "%u.%u", cps_hi, cps_lo);
+ sprintf(buffer, "%u.%u", (unsigned int)cps_hi, cps_lo);
}
}
Powered by blists - more mailing lists
Powered by Openwall GNU/*/Linux -
Powered by OpenVZ