aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_stats.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2015-08-13 12:34:02 +0200
committerErlang/OTP <[email protected]>2015-08-13 12:34:02 +0200
commit42aec60356991616ab229e2fdf346429d9e6ddf9 (patch)
tree5b758f8375114f773e1b1ed6d5d60813e11ebd8c /lib/diameter/src/base/diameter_stats.erl
parent1f045e334da25d7fcecd36e5ea6e44da820bf84c (diff)
parentfaf86cb3cee3b241faf82b4dc347b0d2b0c58201 (diff)
downloadotp-42aec60356991616ab229e2fdf346429d9e6ddf9.tar.gz
otp-42aec60356991616ab229e2fdf346429d9e6ddf9.tar.bz2
otp-42aec60356991616ab229e2fdf346429d9e6ddf9.zip
Merge branch 'anders/diameter/lcnt/OTP-12912' into maint-17
* anders/diameter/lcnt/OTP-12912: Make ets diameter_stats a set Remove unnecessary sorting in stats suite Set ets {write_concurrency, true} on diameter_stats Don't start watchdog timers unnecessarily Remove unnecessary erlang:monitor/2 qualification Add missing watchdog suite clause
Diffstat (limited to 'lib/diameter/src/base/diameter_stats.erl')
-rw-r--r--lib/diameter/src/base/diameter_stats.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/diameter/src/base/diameter_stats.erl b/lib/diameter/src/base/diameter_stats.erl
index 64ea082be0..79a5c7b947 100644
--- a/lib/diameter/src/base/diameter_stats.erl
+++ b/lib/diameter/src/base/diameter_stats.erl
@@ -142,9 +142,14 @@ read(Refs, B) ->
L.
to_refdict(L) ->
- lists:foldl(fun({{C,R}, N}, D) -> orddict:append(R, {C,N}, D) end,
- orddict:new(),
- L).
+ lists:foldl(fun append/2, orddict:new(), L).
+
+%% Order both references and counters in the returned list.
+append({{Ctr, Ref}, N}, Dict) ->
+ orddict:update(Ref,
+ fun(D) -> orddict:store(Ctr, N, D) end,
+ [{Ctr, N}],
+ Dict).
%% ---------------------------------------------------------------------------
%% # sum(Refs)
@@ -220,7 +225,7 @@ uptime() ->
%% ----------------------------------------------------------
init([]) ->
- ets:new(?TABLE, [named_table, ordered_set, public]),
+ ets:new(?TABLE, [named_table, set, public, {write_concurrency, true}]),
{ok, #state{}}.
%% ----------------------------------------------------------