mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r826046 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java
Date Fri, 16 Oct 2009 19:19:40 GMT
Author: srowen
Date: Fri Oct 16 19:19:40 2009
New Revision: 826046

URL: http://svn.apache.org/viewvc?rev=826046&view=rev
Log:
More small improvements including memory usage approximation

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java?rev=826046&r1=826045&r2=826046&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/eval/LoadEvaluator.java
Fri Oct 16 19:19:40 2009
@@ -50,11 +50,19 @@
       if (count > 0) { // Ignore first as a warmup
         recommendationTime.addDatum(end - start);
       }
-      if (++count % 10 == 0) {
-        log.info("Average time per recommendation: " + recommendationTime.getAverage());
+      if (++count % 100 == 0) {
+        logStats(recommendationTime);
       }
     }
-    log.info("Average time per recommendation: " + recommendationTime.getAverage());
+    logStats(recommendationTime);
+  }
+
+  private static void logStats(RunningAverage recommendationTime) {
+    Runtime runtime = Runtime.getRuntime();
+    System.gc();
+    log.info("Average time per recommendation: " + (int) recommendationTime.getAverage()
+
+             "ms; approx. memory used: " + ((runtime.totalMemory() - runtime.freeMemory())
/ 1000000) + "MB");
+
   }
 
 }
\ No newline at end of file



Mime
View raw message