You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/02/05 21:23:35 UTC

[23/42] git commit: [#4691] Slight bump to cache size and some cleanup on reporting for refresh-last-commits.py

[#4691] Slight bump to cache size and some cleanup on reporting for refresh-last-commits.py

Signed-off-by: Cory Johns <jo...@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/049ded0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/049ded0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/049ded0c

Branch: refs/heads/master
Commit: 049ded0c61c93474677e20abab849b8d42821c29
Parents: 8555546
Author: Cory Johns <jo...@geek.net>
Authored: Tue Dec 11 21:14:07 2012 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 5 20:22:51 2013 +0000

----------------------------------------------------------------------
 scripts/refresh-last-commits.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/049ded0c/scripts/refresh-last-commits.py
----------------------------------------------------------------------
diff --git a/scripts/refresh-last-commits.py b/scripts/refresh-last-commits.py
index e027d7c..531fa83 100644
--- a/scripts/refresh-last-commits.py
+++ b/scripts/refresh-last-commits.py
@@ -98,7 +98,7 @@ def refresh_repo_lcds(commit_ids, options):
                 at = tt / len(timings)
                 print '  Processed %d commits (max: %f, avg: %f, tot: %f, cl: %d)' % (
                         len(timings), mt, at, tt, len(tree_cache))
-    lcd_cache = M.repo.ModelCache(6000)
+    lcd_cache = M.repo.ModelCache(8000)
     timings = []
     print 'Processing last commits'
     debug_step = int(pow(10, max(0, int(log10(len(commit_ids)) - log10(options.step) - 1))))
@@ -120,15 +120,22 @@ def refresh_repo_lcds(commit_ids, options):
             mat = sum(timings[-debug_step:]) / debug_step
             lhits = lcd_cache._hits[M.repo.LastCommit]
             laccs = lcd_cache._accesses[M.repo.LastCommit]
+            lavg = lhits * 100 / laccs if laccs > 0 else 0
             ohits = sum([v for k,v in lcd_cache._hits.items() if k != M.repo.LastCommit])
             oaccs = sum([v for k,v in lcd_cache._accesses.items() if k != M.repo.LastCommit])
+            oavg = ohits * 100 / oaccs if oaccs > 0 else 0
+            gavg = lcd_cache._get_walks / lcd_cache._get_calls if lcd_cache._get_calls > 0 else 0
+            gper = lcd_cache._get_hits * 100 / lcd_cache._get_calls if lcd_cache._get_calls > 0 else 0
+            bavg = lcd_cache._build_walks / lcd_cache._build_calls if lcd_cache._build_calls > 0 else 0
             print '  Processed %d commits (max: %f, avg: %f, mavg: %f, tot: %f, lc: %d/%d, hit: %d/%d, agw: %d, mgw: %d, gh: %d, abw: %d, mbw: %d, ts: %d)' % (
                     len(timings), mt, at, mat, tt,
                     lcd_cache.size(), len(lcd_cache._cache[M.repo.LastCommit]),
-                    ohits * 100 / oaccs, lhits * 100 / laccs,
-                    lcd_cache._get_walks / lcd_cache._get_calls, lcd_cache._get_walks_max, lcd_cache._get_hits * 100 / lcd_cache._get_calls,
-                    lcd_cache._build_walks / lcd_cache._build_calls, lcd_cache._build_walks_max,
+                    oavg, lavg,
+                    gavg, lcd_cache._get_walks_max, gper,
+                    bavg, lcd_cache._build_walks_max,
                     len(lcd_cache.get(M.repo.TreesDoc, dict(_id=commit._id)).tree_ids))
+            lcd_cache._get_walks_max = 0
+            lcd_cache._build_walks_max = 0
             ThreadLocalORMSession.flush_all()
             ThreadLocalORMSession.close_all()
     ThreadLocalORMSession.flush_all()