Add couch_lru:debug/1

Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/0aa8c06e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/0aa8c06e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/0aa8c06e

Branch: refs/heads/HACK-benchmark-COUCHDB-3191-improve-couch-lru-performance
Commit: 0aa8c06e42a496a21b47a4b8805cac01645eb343
Parents: dc95df8
Author: Paul J. Davis <paul.joseph.da...@gmail.com>
Authored: Mon Oct 17 14:08:39 2016 -0500
Committer: Paul J. Davis <paul.joseph.da...@gmail.com>
Committed: Mon Oct 17 14:08:39 2016 -0500

----------------------------------------------------------------------
 src/couch_lru.erl | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0aa8c06e/src/couch_lru.erl
----------------------------------------------------------------------
diff --git a/src/couch_lru.erl b/src/couch_lru.erl
index dcb025f..7b66840 100644
--- a/src/couch_lru.erl
+++ b/src/couch_lru.erl
@@ -23,7 +23,8 @@
 % Debugging
 -export([
     to_list/1,
-    validate/1
+    validate/1,
+    debug/1
 ]).
 
 -include_lib("couch/include/couch_db.hrl").
@@ -157,6 +158,21 @@ validate(Lru) ->
     end.
 
 
+debug(Lru) ->
+    #lru{
+        dbs = Dbs,
+        nodes = Nodes,
+        head = Head,
+        tail = Tail
+    } = Lru,
+    [
+        {dbs, khash:to_list(Dbs)},
+        {nodes, khash:to_list(Nodes)},
+        {head, Head},
+        {tail, Tail}
+    ].
+
+
 close(_, undefined) ->
     erlang:error(all_dbs_active);
 

Reply via email to