You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/07/31 23:25:18 UTC
[30/50] folsom commit: updated refs/heads/import-master to 4824aec
clean up superfluous brackets
Project: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/commit/d0c1241c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/tree/d0c1241c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/diff/d0c1241c
Branch: refs/heads/import-master
Commit: d0c1241c986ada45d1d662d0479929d16d26ecc4
Parents: ade45c8
Author: Joe Williams <jo...@github.com>
Authored: Mon Nov 4 11:16:45 2013 -0800
Committer: Joe Williams <jo...@github.com>
Committed: Mon Nov 4 11:16:45 2013 -0800
----------------------------------------------------------------------
src/folsom_vm_metrics.erl | 52 +++++++++++++++++++-------------------
test/folsom_erlang_checks.erl | 4 +--
2 files changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-folsom/blob/d0c1241c/src/folsom_vm_metrics.erl
----------------------------------------------------------------------
diff --git a/src/folsom_vm_metrics.erl b/src/folsom_vm_metrics.erl
index fc91d86..1adc5b0 100644
--- a/src/folsom_vm_metrics.erl
+++ b/src/folsom_vm_metrics.erl
@@ -35,7 +35,7 @@
]).
%% exported for eunit test
--export([convert_system_info/1]).
+-export([convert_system_info/2]).
-include("folsom.hrl").
@@ -46,10 +46,10 @@ get_memory() ->
erlang:memory().
get_statistics() ->
- [{Key, convert_statistics({Key, get_statistics(Key)})} || Key <- ?STATISTICS].
+ [{Key, convert_statistics(Key, get_statistics(Key))} || Key <- ?STATISTICS].
get_system_info() ->
- [{Key, convert_system_info({Key, get_system_info(Key)})} || Key <- ?SYSTEM_INFO].
+ [{Key, convert_system_info(Key, get_system_info(Key))} || Key <- ?SYSTEM_INFO].
get_process_info() ->
[{pid_port_fun_to_atom(Pid), get_process_info(Pid)} || Pid <- processes()].
@@ -80,57 +80,57 @@ get_statistics(Key) ->
%% conversion functions for erlang:statistics(Key)
-convert_statistics({context_switches, {ContextSwitches, 0}}) ->
+convert_statistics(context_switches, {ContextSwitches, 0}) ->
ContextSwitches;
-convert_statistics({garbage_collection, {NumberofGCs, WordsReclaimed, 0}}) ->
+convert_statistics(garbage_collection, {NumberofGCs, WordsReclaimed, 0}) ->
[{number_of_gcs, NumberofGCs}, {words_reclaimed, WordsReclaimed}];
-convert_statistics({io, {Input, Output}}) ->
+convert_statistics(io, {Input, Output}) ->
[Input, Output];
-convert_statistics({reductions, {TotalReductions, ReductionsSinceLastCall}}) ->
+convert_statistics(reductions, {TotalReductions, ReductionsSinceLastCall}) ->
[{total_reductions, TotalReductions},
{reductions_since_last_call, ReductionsSinceLastCall}];
-convert_statistics({runtime, {TotalRunTime, TimeSinceLastCall}}) ->
+convert_statistics(runtime, {TotalRunTime, TimeSinceLastCall}) ->
[{total_run_time, TotalRunTime}, {time_since_last_call, TimeSinceLastCall}];
-convert_statistics({wall_clock, {TotalWallclockTime, WallclockTimeSinceLastCall}}) ->
+convert_statistics(wall_clock, {TotalWallclockTime, WallclockTimeSinceLastCall}) ->
[{total_wall_clock_time, TotalWallclockTime},
{wall_clock_time_since_last_call, WallclockTimeSinceLastCall}];
-convert_statistics({_, Value}) ->
+convert_statistics(_, Value) ->
Value.
%% conversion functions for erlang:system_info(Key)
-convert_system_info({allocated_areas, List}) ->
+convert_system_info(allocated_areas, List) ->
[convert_allocated_areas(Value) || Value <- List];
-convert_system_info({allocator, {_,_,_,List}}) ->
+convert_system_info(allocator, {_,_,_,List}) ->
List;
-convert_system_info({c_compiler_used, {Compiler, Version}}) ->
+convert_system_info(c_compiler_used, {Compiler, Version}) ->
[{compiler, Compiler}, {version, convert_c_compiler_version(Version)}];
-convert_system_info({cpu_topology, undefined}) ->
+convert_system_info(cpu_topology, undefined) ->
undefined;
-convert_system_info({cpu_topology, List}) when is_list(List) ->
+convert_system_info(cpu_topology, List) when is_list(List) ->
[{Type, convert_cpu_topology(Item, [])} || {Type, Item} <- List];
-convert_system_info({cpu_topology, {logical,Item}}) ->
- convert_system_info({cpu_topology, [{processor,[{core,{logical,Item}}]}]});
-convert_system_info({dist_ctrl, List}) ->
+convert_system_info(cpu_topology, {logical,Item}) ->
+ convert_system_info(cpu_topology, [{processor,[{core,{logical,Item}}]}]);
+convert_system_info(dist_ctrl, List) ->
lists:map(fun({Node, Socket}) ->
{ok, Stats} = inet:getstat(Socket),
{Node, Stats}
end, List);
-convert_system_info({driver_version, Value}) ->
+convert_system_info(driver_version, Value) ->
list_to_binary(Value);
-convert_system_info({machine, Value}) ->
+convert_system_info(machine, Value) ->
list_to_binary(Value);
-convert_system_info({otp_release, Value}) ->
+convert_system_info(otp_release, Value) ->
list_to_binary(Value);
-convert_system_info({scheduler_bindings, Value}) ->
+convert_system_info(scheduler_bindings, Value) ->
tuple_to_list(Value);
-convert_system_info({system_version, Value}) ->
+convert_system_info(system_version, Value) ->
list_to_binary(Value);
-convert_system_info({system_architecture, Value}) ->
+convert_system_info(system_architecture, Value) ->
list_to_binary(Value);
-convert_system_info({version, Value}) ->
+convert_system_info(version, Value) ->
list_to_binary(Value);
-convert_system_info({_, Value}) ->
+convert_system_info(_, Value) ->
Value.
convert_allocated_areas({Key, Value1, Value2}) ->
http://git-wip-us.apache.org/repos/asf/couchdb-folsom/blob/d0c1241c/test/folsom_erlang_checks.erl
----------------------------------------------------------------------
diff --git a/test/folsom_erlang_checks.erl b/test/folsom_erlang_checks.erl
index 820b79e..374dad6 100644
--- a/test/folsom_erlang_checks.erl
+++ b/test/folsom_erlang_checks.erl
@@ -465,7 +465,7 @@ cpu_topology() ->
run_convert_and_jsonify(Item) ->
?debugFmt("Converting ... ~n~p~n", [Item]),
- Result = folsom_vm_metrics:convert_system_info({cpu_topology, Item}),
+ Result = folsom_vm_metrics:convert_system_info(cpu_topology, Item),
%?debugFmt("~p~n", [mochijson2:encode(Result)]).
mochijson2:encode(Result).
@@ -478,7 +478,7 @@ c_compiler_used() ->
[{compiler, gnuc}, {version, <<"4.4">>}],
[{compiler, msc}, {version, <<"1600">>}]],
- ?assertEqual(Expected, [folsom_vm_metrics:convert_system_info({c_compiler_used, {Compiler, Version}})
+ ?assertEqual(Expected, [folsom_vm_metrics:convert_system_info(c_compiler_used, {Compiler, Version})
|| {Compiler, Version} <- Test]).