You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2009/10/06 12:39:31 UTC
svn commit: r822208 - /spamassassin/trunk/masses/garescorer.c
Author: mmartinec
Date: Tue Oct 6 10:39:31 2009
New Revision: 822208
URL: http://svn.apache.org/viewvc?rev=822208&view=rev
Log:
garescorer.c: report performance as iterations per second
Modified:
spamassassin/trunk/masses/garescorer.c
Modified: spamassassin/trunk/masses/garescorer.c
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/garescorer.c?rev=822208&r1=822207&r2=822208&view=diff
==============================================================================
--- spamassassin/trunk/masses/garescorer.c (original)
+++ spamassassin/trunk/masses/garescorer.c Tue Oct 6 10:39:31 2009
@@ -10,6 +10,7 @@
#include "pgapack.h"
#include <unistd.h>
+#include <sys/time.h>
#include <math.h>
#include "tmp/scores.h"
#include "tmp/tests.h"
@@ -65,6 +66,9 @@
int replace_num = 33;
int maxiter = 30000;
+struct timeval t0;
+int t0_iter;
+
#ifdef USE_VARIABLE_MUTATIONS
double mutation_rate = 0.03;
double base_mutation_rate = 0.03;
@@ -175,6 +179,8 @@
PGAContext *ctx;
int i,p;
int arg;
+ struct timezone tzp;
+ t0.tv_sec = t0.tv_usec = 0;
#ifdef USE_MPI
MPI_Init(&argc, &argv);
@@ -306,6 +312,7 @@
}
#endif /* ! USE_VARIABLE_MUTATIONS */
+ gettimeofday(&t0, &tzp);
PGARun(ctx, evaluate);
PGADestroy(ctx);
@@ -1023,7 +1030,22 @@
#endif
}
#endif
+
+ { struct timeval t1;
+ struct timezone tzp;
+ if(gettimeofday(&t1, &tzp) == 0)
+ {
+ double dt = (t1.tv_sec + t1.tv_usec * 1.0e-6) -
+ (t0.tv_sec + t0.tv_usec * 1.0e-6);
+ int iter = PGAGetGAIterValue(ctx);
+ printf("Performance: %.3f iter/s\n", (iter-t0_iter)/dt);
+ t0.tv_sec = t1.tv_sec; t0.tv_usec = t0.tv_usec;
+ t0_iter = iter;
+ }
+ }
+
dump(stdout);
+
}
else if(0 == PGAGetGAIterValue(ctx) % 5)
{