diff options
author | ILYA Khlopotov <iilyak@apache.org> | 2018-08-15 03:55:06 -0700 |
---|---|---|
committer | ILYA Khlopotov <iilyak@apache.org> | 2018-08-15 15:40:42 -0700 |
commit | d14869e3ca7f95a3a23d5c67589c7289b85780d0 (patch) | |
tree | 5df3f164836728f66aea0d637b1978028afb0741 | |
parent | 0cb1110177e684eff3f1ac9a3117932eb6bdcc7b (diff) | |
download | couchdb-d14869e3ca7f95a3a23d5c67589c7289b85780d0.tar.gz |
Calculate uptime since application start instead of a beam start
-rw-r--r-- | src/chttpd/src/chttpd_misc.erl | 2 | ||||
-rw-r--r-- | src/couch/src/couch_app.erl | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl index 4a9324415..c72ef7cd4 100644 --- a/src/chttpd/src/chttpd_misc.erl +++ b/src/chttpd/src/chttpd_misc.erl @@ -401,7 +401,7 @@ get_stats() -> MessageQueues0 = [{couch_file, {CF}}, {couch_db_updater, {CDU}}], MessageQueues = MessageQueues0 ++ message_queues(registered()), [ - {uptime, element(1,statistics(wall_clock)) div 1000}, + {uptime, couch_app:uptime() div 1000}, {memory, {Memory}}, {run_queue, statistics(run_queue)}, {ets_table_count, length(ets:all())}, diff --git a/src/couch/src/couch_app.erl b/src/couch/src/couch_app.erl index d284c2bfd..8acc71d51 100644 --- a/src/couch/src/couch_app.erl +++ b/src/couch/src/couch_app.erl @@ -16,11 +16,17 @@ -include_lib("couch/include/couch_db.hrl"). --export([start/2, stop/1]). +-export([ + start/2, + stop/1, + uptime/0 +]). start(_Type, _) -> case couch_sup:start_link() of {ok, _} = Resp -> + {Time, _} = statistics(wall_clock), + application:set_env(couch, start_time, Time), Resp; Else -> throw(Else) @@ -29,3 +35,6 @@ start(_Type, _) -> stop(_) -> ok. +uptime() -> + {Time, _} = statistics(wall_clock), + Time - application:get_env(couch, start_time, Time). |