aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/erts_internal.erl
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-06-17 00:01:14 +0200
committerRickard Green <[email protected]>2015-06-17 00:29:19 +0200
commit74f0d7c8ea47b363136c86de5d7ea78a48c40570 (patch)
treed391afc578a180d29a16a6d31037c6aad955e996 /erts/preloaded/src/erts_internal.erl
parent89b42bb784e97584b3f3b3c3ff4946a945876a5c (diff)
downloadotp-74f0d7c8ea47b363136c86de5d7ea78a48c40570.tar.gz
otp-74f0d7c8ea47b363136c86de5d7ea78a48c40570.tar.bz2
otp-74f0d7c8ea47b363136c86de5d7ea78a48c40570.zip
Save IO bytes in scheduler specific data
Diffstat (limited to 'erts/preloaded/src/erts_internal.erl')
-rw-r--r--erts/preloaded/src/erts_internal.erl19
1 files changed, 18 insertions, 1 deletions
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl
index 65a1f1ed3a..cf8edefd7d 100644
--- a/erts/preloaded/src/erts_internal.erl
+++ b/erts/preloaded/src/erts_internal.erl
@@ -40,7 +40,7 @@
-export([flush_monitor_messages/3]).
--export([await_result/1]).
+-export([await_result/1, gather_io_bytes/2]).
-export([time_unit/0]).
@@ -67,6 +67,23 @@ await_result(Ref) when is_reference(Ref) ->
end.
%%
+%% statistics(io) end up in gather_io_bytes/2
+%%
+
+gather_io_bytes(Ref, No) when is_reference(Ref),
+ is_integer(No),
+ No > 0 ->
+ gather_io_bytes(Ref, No, 0, 0).
+
+gather_io_bytes(_Ref, 0, InAcc, OutAcc) ->
+ {{input, InAcc}, {output, OutAcc}};
+gather_io_bytes(Ref, No, InAcc, OutAcc) ->
+ receive
+ {Ref, _SchedId, In, Out} ->
+ gather_io_bytes(Ref, No-1, InAcc + In, OutAcc + Out)
+ end.
+
+%%
%% Statically linked port NIFs
%%