aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_tv_table.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-12-05 16:02:54 +0100
committerDan Gudmundsson <[email protected]>2011-12-05 16:02:54 +0100
commitb0121557d6a97c22f147db665788132c2b2096d1 (patch)
treeb85d682e3ca02b59201fa92154e12cf2fd1ab6cc /lib/observer/src/observer_tv_table.erl
parent6bbe0512b1686f06489893479ae1d14ef15d004a (diff)
downloadotp-b0121557d6a97c22f147db665788132c2b2096d1.tar.gz
otp-b0121557d6a97c22f147db665788132c2b2096d1.tar.bz2
otp-b0121557d6a97c22f147db665788132c2b2096d1.zip
[observer] Move rpc calls to runtime tools
Diffstat (limited to 'lib/observer/src/observer_tv_table.erl')
-rw-r--r--lib/observer/src/observer_tv_table.erl47
1 files changed, 1 insertions, 46 deletions
diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl
index dd11ba5470..31d5f3d632 100644
--- a/lib/observer/src/observer_tv_table.erl
+++ b/lib/observer/src/observer_tv_table.erl
@@ -24,8 +24,6 @@
-export([init/1, handle_info/2, terminate/2, code_change/3, handle_call/3,
handle_event/2, handle_sync_event/3, handle_cast/2]).
--export([get_table/3]).
-
-include("observer_defs.hrl").
-import(observer_lib, [to_str/1]).
@@ -507,7 +505,7 @@ table_holder(S0 = #holder{parent=Parent, pid=Pid, table=Table}) ->
%% io:format("ignoring refresh", []),
table_holder(S0);
refresh ->
- GetTab = rpc:call(S0#holder.node, ?MODULE, get_table,
+ GetTab = rpc:call(S0#holder.node, observer_backend, get_table,
[self(), S0#holder.tabid, S0#holder.source]),
table_holder(S0#holder{pid=GetTab});
{delete, Row} ->
@@ -708,49 +706,6 @@ insert(Object, #holder{tabid=Id, source=Source, node=Node}) ->
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-get_table(Parent, Table, Module) ->
- spawn(fun() ->
- link(Parent),
- get_table2(Parent, Table, Module)
- end).
-
-get_table2(Parent, Table, Type) ->
- Size = case Type of
- ets -> ets:info(Table, size);
- mnesia -> mnesia:table_info(Table, size)
- end,
- case Size > 0 of
- false ->
- Parent ! {self(), '$end_of_table'},
- normal;
- true when Type =:= ets ->
- Mem = ets:info(Table, memory),
- Average = Mem div Size,
- NoElements = max(10, 20000 div Average),
- get_ets_loop(Parent, ets:match(Table, '$1', NoElements));
- true ->
- Mem = mnesia:table_info(Table, memory),
- Average = Mem div Size,
- NoElements = max(10, 20000 div Average),
- Ms = [{'$1', [], ['$1']}],
- Get = fun() ->
- get_mnesia_loop(Parent, mnesia:select(Table, Ms, NoElements, read))
- end,
- %% Not a transaction, we don't want to grab locks when inspecting the table
- mnesia:async_dirty(Get)
- end.
-
-get_ets_loop(Parent, '$end_of_table') ->
- Parent ! {self(), '$end_of_table'};
-get_ets_loop(Parent, {Match, Cont}) ->
- Parent ! {self(), Match},
- get_ets_loop(Parent, ets:match(Cont)).
-
-get_mnesia_loop(Parent, '$end_of_table') ->
- Parent ! {self(), '$end_of_table'};
-get_mnesia_loop(Parent, {Match, Cont}) ->
- Parent ! {self(), Match},
- get_ets_loop(Parent, mnesia:select(Cont)).
column_names(Node, Type, Table) ->
case Type of