home
/
code
/
beam_stats.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
142c079
)
Add run_queue
0.5.0
author
Siraaj Khandkar
<siraaj@khandkar.net>
Tue, 25 Aug 2015 00:50:44 +0000
(20:50 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Tue, 25 Aug 2015 00:50:44 +0000
(20:50 -0400)
include/beam_stats.hrl
patch
|
blob
|
blame
|
history
src/beam_stats.app.src
patch
|
blob
|
blame
|
history
src/beam_stats_consumer_statsd.erl
patch
|
blob
|
blame
|
history
src/beam_stats_state.erl
patch
|
blob
|
blame
|
history
test/beam_stats_consumer_statsd_SUITE.erl
patch
|
blob
|
blame
|
history
diff --git
a/include/beam_stats.hrl
b/include/beam_stats.hrl
index
8089595
..
8698310
100644
(file)
--- a/
include/beam_stats.hrl
+++ b/
include/beam_stats.hrl
@@
-6,6
+6,7
@@
, io_bytes_out :: non_neg_integer()
, context_switches :: non_neg_integer()
, reductions :: non_neg_integer()
, io_bytes_out :: non_neg_integer()
, context_switches :: non_neg_integer()
, reductions :: non_neg_integer()
+ , run_queue :: non_neg_integer()
%, statistics :: [{atom() , term()}]
%, system :: [{atom() , term()}]
%, process :: [{atom() , term()}]
%, statistics :: [{atom() , term()}]
%, system :: [{atom() , term()}]
%, process :: [{atom() , term()}]
diff --git
a/src/beam_stats.app.src
b/src/beam_stats.app.src
index
6fc53a2
..
e97bd2c
100644
(file)
--- a/
src/beam_stats.app.src
+++ b/
src/beam_stats.app.src
@@
-1,7
+1,7
@@
{application, beam_stats,
[
{description, "Periodic VM stats production and consumption."},
{application, beam_stats,
[
{description, "Periodic VM stats production and consumption."},
- {vsn, "0.
4
.0"},
+ {vsn, "0.
5
.0"},
{registered, []},
{applications,
[ kernel
{registered, []},
{applications,
[ kernel
diff --git
a/src/beam_stats_consumer_statsd.erl
b/src/beam_stats_consumer_statsd.erl
index
c434429
..
7a06d68
100644
(file)
--- a/
src/beam_stats_consumer_statsd.erl
+++ b/
src/beam_stats_consumer_statsd.erl
@@
-146,6
+146,7
@@
beam_stats_to_bins(#beam_stats
, io_bytes_out = IOBytesOut
, context_switches = ContextSwitches
, reductions = Reductions
, io_bytes_out = IOBytesOut
, context_switches = ContextSwitches
, reductions = Reductions
+ , run_queue = RunQueue
}
) ->
NodeIDBin = node_id_to_bin(NodeID),
}
) ->
NodeIDBin = node_id_to_bin(NodeID),
@@
-154,11
+155,21
@@
beam_stats_to_bins(#beam_stats
, io_bytes_out_to_msg(IOBytesOut)
, context_switches_to_msg(ContextSwitches)
, reductions_to_msg(Reductions)
, io_bytes_out_to_msg(IOBytesOut)
, context_switches_to_msg(ContextSwitches)
, reductions_to_msg(Reductions)
+ , run_queue_to_msg(RunQueue)
| memory_to_msgs(Memory)
],
Msgs2 = [statsd_msg_add_name_prefix(M, NodeIDBin) || M <- Msgs1],
[statsd_msg_to_bin(M) || M <- Msgs2].
| memory_to_msgs(Memory)
],
Msgs2 = [statsd_msg_add_name_prefix(M, NodeIDBin) || M <- Msgs1],
[statsd_msg_to_bin(M) || M <- Msgs2].
+-spec run_queue_to_msg(non_neg_integer()) ->
+ statsd_msg().
+run_queue_to_msg(RunQueue) ->
+ #statsd_msg
+ { name = <<"run_queue">>
+ , value = RunQueue
+ , type = gauge
+ }.
+
-spec reductions_to_msg(non_neg_integer()) ->
statsd_msg().
reductions_to_msg(Reductions) ->
-spec reductions_to_msg(non_neg_integer()) ->
statsd_msg().
reductions_to_msg(Reductions) ->
diff --git
a/src/beam_stats_state.erl
b/src/beam_stats_state.erl
index
4dcadd6
..
1fff6b0
100644
(file)
--- a/
src/beam_stats_state.erl
+++ b/
src/beam_stats_state.erl
@@
-26,6
+26,7
@@
, current_context_switches :: non_neg_integer()
, reductions :: non_neg_integer()
, current_context_switches :: non_neg_integer()
, reductions :: non_neg_integer()
+ , run_queue :: non_neg_integer()
}).
-define(T, #?MODULE).
}).
-define(T, #?MODULE).
@@
-41,6
+42,7
@@
new() ->
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
+ RunQueue = erlang:statistics(run_queue),
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
@@
-52,6
+54,7
@@
new() ->
, previous_context_switches = 0
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
, previous_context_switches = 0
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
+ , run_queue = RunQueue
}.
-spec update(t()) ->
}.
-spec update(t()) ->
@@
-67,6
+70,7
@@
update(?T
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
} = erlang:statistics(io),
{CurrentContextSwitches, 0} = erlang:statistics(context_switches),
{_ReductionsTotal, ReductionsDelta} = erlang:statistics(reductions),
+ RunQueue = erlang:statistics(run_queue),
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
?T
{ timestamp = os:timestamp()
, node_id = erlang:node()
@@
-78,6
+82,7
@@
update(?T
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = ReductionsDelta
+ , run_queue = RunQueue
}.
-spec export(t()) ->
}.
-spec export(t()) ->
@@
-94,6
+99,7
@@
export(
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = Reductions
, previous_context_switches = PreviousContextSwitches
, current_context_switches = CurrentContextSwitches
, reductions = Reductions
+ , run_queue = RunQueue
}
) ->
#beam_stats
}
) ->
#beam_stats
@@
-104,4
+110,5
@@
export(
, io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
, context_switches = CurrentContextSwitches - PreviousContextSwitches
, reductions = Reductions
, io_bytes_out = CurrentIOBytesOut - PreviousIOBytesOut
, context_switches = CurrentContextSwitches - PreviousContextSwitches
, reductions = Reductions
+ , run_queue = RunQueue
}.
}.
diff --git
a/test/beam_stats_consumer_statsd_SUITE.erl
b/test/beam_stats_consumer_statsd_SUITE.erl
index
32864f0
..
f0cffb0
100644
(file)
--- a/
test/beam_stats_consumer_statsd_SUITE.erl
+++ b/
test/beam_stats_consumer_statsd_SUITE.erl
@@
-41,6
+41,7
@@
t_send(_Cfg) ->
, io_bytes_out = 7
, context_switches = 5
, reductions = 9
, io_bytes_out = 7
, context_switches = 5
, reductions = 9
+ , run_queue = 17
},
ServerPort = 8125,
{ok, ServerSocket} = gen_udp:open(ServerPort, [binary, {active, false}]),
},
ServerPort = 8125,
{ok, ServerSocket} = gen_udp:open(ServerPort, [binary, {active, false}]),
@@
-52,9
+53,11
@@
t_send(_Cfg) ->
ResultOfReceive = gen_udp:recv(ServerSocket, 0),
ok = gen_udp:close(ServerSocket),
{ok, {_, _, Data}} = ResultOfReceive,
ResultOfReceive = gen_udp:recv(ServerSocket, 0),
ok = gen_udp:close(ServerSocket),
{ok, {_, _, Data}} = ResultOfReceive,
+ ct:log("Packet: ~n~s~n", [Data]),
<< "beam_stats.node_foo_host_bar.io.bytes_in:3|g\n"
, "beam_stats.node_foo_host_bar.io.bytes_out:7|g\n"
, "beam_stats.node_foo_host_bar.context_switches:5|g\n"
, "beam_stats.node_foo_host_bar.reductions:9|g\n"
<< "beam_stats.node_foo_host_bar.io.bytes_in:3|g\n"
, "beam_stats.node_foo_host_bar.io.bytes_out:7|g\n"
, "beam_stats.node_foo_host_bar.context_switches:5|g\n"
, "beam_stats.node_foo_host_bar.reductions:9|g\n"
+ , "beam_stats.node_foo_host_bar.run_queue:17|g\n"
, "beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n"
>> = Data.
, "beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n"
>> = Data.
This page took
0.045911 seconds
and
4
git commands to generate.