diff options
author | Damien F. Katz <damien@apache.org> | 2009-05-06 19:11:10 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2009-05-06 19:11:10 +0000 |
commit | 4b5e0a20aa087dd26df644c0432627aa3e5826d4 (patch) | |
tree | 1494b164fdef4004bff44aa39edbc2f1bf60d8f3 /src/couchdb/couch_stats_collector.erl | |
parent | 887c9b1a8b551272c3ca06906cfdc4fb901830a8 (diff) |
First cut at _changes api. Update the by_id and by_seq indexes to contain update seq numbers and pointers to bodies on disk, for use in the _changes api. This is a new file version, but the code can continue to serve the old 0.9 version without problems, though certain features in the _changes api will not be able to work. Upgrade to new file version (from 1 to 2) by compacting the file. Also fixed bugs with how the stats api tracks open databases.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@772406 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_stats_collector.erl')
-rw-r--r-- | src/couchdb/couch_stats_collector.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/couchdb/couch_stats_collector.erl b/src/couchdb/couch_stats_collector.erl index 854fffb0..ad5e9e9a 100644 --- a/src/couchdb/couch_stats_collector.erl +++ b/src/couchdb/couch_stats_collector.erl @@ -24,6 +24,7 @@ -export([start/0, stop/0, get/1, increment/1, decrement/1, + track_process_count/1, record/2, clear/1, all/0, all/1]). @@ -87,6 +88,20 @@ all(Type) -> end. +track_process_count(Stat) -> + case (catch couch_stats_collector:increment(Stat)) of + ok -> + Self = self(), + spawn( + fun() -> + erlang:monitor(process, Self), + receive {'DOWN', _, _, _, _} -> ok end, + couch_stats_collector:decrement(Stat) + end); + _ -> ok + end. + + % GEN_SERVER |