You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2022/08/08 22:55:15 UTC
[couchdb] branch cost-counting updated: Whitespace
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a commit to branch cost-counting
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/cost-counting by this push:
new dce7a7805 Whitespace
dce7a7805 is described below
commit dce7a7805a15540dada34d88b3781ef581220160
Author: Russell Branca <ch...@apache.org>
AuthorDate: Mon Aug 8 15:55:07 2022 -0700
Whitespace
---
src/couch/src/couch_cost.erl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/couch/src/couch_cost.erl b/src/couch/src/couch_cost.erl
index ebb25cf8f..243748cf7 100644
--- a/src/couch/src/couch_cost.erl
+++ b/src/couch/src/couch_cost.erl
@@ -34,6 +34,7 @@
get_kp_node = 0
}).
+
get_cost() ->
case get(cost_accounting_context) of
undefined ->
@@ -44,6 +45,7 @@ get_cost() ->
Cost
end.
+
get_costs() ->
case get(cost_accounting_context_aggregation) of
undefined ->
@@ -54,17 +56,21 @@ get_costs() ->
Costs
end.
+
update_cost(#cost{}=Cost) ->
put(cost_accounting_context, Cost).
+
accumulate_costs(#cost{}=Cost) ->
Costs = get_costs(),
put(cost_accounting_context_aggregation, [Cost | Costs]).
+
inc_doc() -> inc_doc(1).
inc_doc(N) -> inc_doc(N, get_cost()).
inc_doc(N, #cost{docs_read=DR0}=Cost) -> update_cost(Cost#cost{docs_read=DR0+N}).
+
inc_ioq() -> inc_ioq(1).
inc_ioq(N) -> inc_ioq(N, get_cost()).
inc_ioq(N, #cost{ioq_calls=IOQ0}=Cost) -> update_cost(Cost#cost{ioq_calls=IOQ0+N}).