aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-10-29 12:00:07 +0100
committerSiri Hansen <[email protected]>2018-10-29 12:00:07 +0100
commit896b367ad01ffa27637567af8fb722b9a379b972 (patch)
tree024fd4d9fd6aeae5db16c9c06c36dc7700f72049 /lib
parent7342365314d2bd8f588ef3d999f1a3aa20425ef7 (diff)
downloadotp-896b367ad01ffa27637567af8fb722b9a379b972.tar.gz
otp-896b367ad01ffa27637567af8fb722b9a379b972.tar.bz2
otp-896b367ad01ffa27637567af8fb722b9a379b972.zip
[cdv] Speed up reading of dump with many processes
Eliminate an ets:select per process, which was used for reading position data needed for progress reporting. Now this data is stored in dictionary along with the last tag and id instead.
Diffstat (limited to 'lib')
-rw-r--r--lib/observer/src/crashdump_viewer.erl28
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index 2a5c3bb1f9..41a569c2bf 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -580,9 +580,9 @@ truncated_here(Tag) ->
case get(truncated) of
true ->
case get(last_tag) of
- Tag -> % Tag == {TagType,Id}
+ {Tag,_Pos} -> % Tag == {TagType,Id}
true;
- {Tag,_Id} ->
+ {{Tag,_Id},_Pos} ->
true;
_LastTag ->
truncated_earlier(Tag)
@@ -837,8 +837,8 @@ do_read_file(File) ->
case check_dump_version(Id) of
{ok,DumpVsn} ->
reset_tables(),
- insert_index(Tag,Id,N1+1),
- put_last_tag(Tag,""),
+ insert_index(Tag,Id,Pos=N1+1),
+ put_last_tag(Tag,"",Pos),
DecodeOpts = get_decode_opts(DumpVsn),
indexify(Fd,DecodeOpts,Rest,N1),
end_progress(),
@@ -906,12 +906,10 @@ indexify(Fd,DecodeOpts,Bin,N) ->
_ ->
insert_index(Tag,Id,NewPos)
end,
- case put_last_tag(Tag,Id) of
- {?proc_heap,LastId} ->
- [{_,LastPos}] = lookup_index(?proc_heap,LastId),
+ case put_last_tag(Tag,Id,NewPos) of
+ {{?proc_heap,LastId},LastPos} ->
ets:insert(cdv_heap_file_chars,{LastId,N+Start+1-LastPos});
- {?literals,[]} ->
- [{_,LastPos}] = lookup_index(?literals,[]),
+ {{?literals,[]},LastPos} ->
ets:insert(cdv_heap_file_chars,{literals,N+Start+1-LastPos});
_ -> ok
end,
@@ -954,10 +952,10 @@ tag(Fd,<<>>,N,Gat,Di,Now) ->
check_if_truncated() ->
case get(last_tag) of
- {?ende,_} ->
+ {{?ende,_},_} ->
put(truncated,false),
put(truncated_proc,false);
- {?literals,[]} ->
+ {{?literals,[]},_} ->
put(truncated,true),
put(truncated_proc,false),
%% Literals are truncated. Make sure we never
@@ -965,7 +963,7 @@ check_if_truncated() ->
%% references literals will show markers for
%% incomplete heaps, but will otherwise work.)
delete_index(?literals, []);
- TruncatedTag ->
+ {TruncatedTag,_} ->
put(truncated,true),
find_truncated_proc(TruncatedTag)
end.
@@ -3213,13 +3211,13 @@ tag_to_atom(UnknownTag) ->
%%%-----------------------------------------------------------------
%%% Store last tag for use when truncated, and reason if aborted
-put_last_tag(?abort,Reason) ->
+put_last_tag(?abort,Reason,_Pos) ->
%% Don't overwrite the real last tag, and don't return it either,
%% since that would make the caller of this function believe that
%% the tag was complete.
put(truncated_reason,Reason);
-put_last_tag(Tag,Id) ->
- put(last_tag,{Tag,Id}).
+put_last_tag(Tag,Id,Pos) ->
+ put(last_tag,{{Tag,Id},Pos}).
%%%-----------------------------------------------------------------
%%% Fetch next chunk from crashdump file