You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 13:59:44 UTC
[21/50] chttpd commit: updated refs/heads/master to 58020ab
Add statistics for couch_db_updater message queues
BugzID: 24167
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/d86f68d5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/d86f68d5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/d86f68d5
Branch: refs/heads/master
Commit: d86f68d543c4667a06e8d617c661589a8eab5c46
Parents: 6ffa347
Author: Benjamin Anderson <b...@banjiewen.net>
Authored: Fri Oct 11 22:29:23 2013 -0400
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 18:22:00 2014 +0100
----------------------------------------------------------------------
src/chttpd_misc.erl | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/d86f68d5/src/chttpd_misc.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_misc.erl b/src/chttpd_misc.erl
index 12b18f8..cb83bc0 100644
--- a/src/chttpd_misc.erl
+++ b/src/chttpd_misc.erl
@@ -266,8 +266,9 @@ handle_system_req(Req) ->
processes_used, binary, code, ets])],
{NumberOfGCs, WordsReclaimed, _} = statistics(garbage_collection),
{{input, Input}, {output, Output}} = statistics(io),
- CouchFile = {couch_file, {couch_file_stats()}},
- MessageQueues = [CouchFile|message_queues(registered())],
+ {CF, CDU} = db_pid_stats(),
+ MessageQueues0 = [{couch_file, {CF}}, {couch_db_updater, {CDU}}],
+ MessageQueues = MessageQueues0 ++ message_queues(registered()),
send_json(Req, {[
{uptime, element(1,statistics(wall_clock)) div 1000},
{memory, {Memory}},
@@ -288,9 +289,14 @@ handle_system_req(Req) ->
{distribution, {get_distribution_stats()}}
]}).
-couch_file_stats() ->
+db_pid_stats() ->
{monitors, M} = process_info(whereis(couch_stats_collector), monitors),
Candidates = [Pid || {process, Pid} <- M],
+ CouchFiles = db_pid_stats(couch_file, Candidates),
+ CouchDbUpdaters = db_pid_stats(couch_db_updater, Candidates),
+ {CouchFiles, CouchDbUpdaters}.
+
+db_pid_stats(Mod, Candidates) ->
Mailboxes = lists:foldl(
fun(Pid, Acc) ->
case process_info(Pid, [message_queue_len, dictionary]) of
@@ -299,7 +305,7 @@ couch_file_stats() ->
PI ->
Dictionary = proplists:get_value(dictionary, PI, []),
case proplists:get_value('$initial_call', Dictionary) of
- {couch_file, init, 1} ->
+ {Mod, init, 1} ->
case proplists:get_value(message_queue_len, PI) of
undefined -> Acc;
Len -> [Len|Acc]