aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_html_lib.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-09-07 15:56:18 +0200
committerSiri Hansen <[email protected]>2017-09-15 09:57:25 +0200
commitae089c72fb06b069675cbebcec10f0820cf16112 (patch)
treed1ba5bc2e8ec4f230af3b86b6d0578a9d5ce2a1e /lib/observer/src/observer_html_lib.erl
parent903a289213aa22b5c9c42ead2599174c2cf15b95 (diff)
downloadotp-ae089c72fb06b069675cbebcec10f0820cf16112.tar.gz
otp-ae089c72fb06b069675cbebcec10f0820cf16112.tar.bz2
otp-ae089c72fb06b069675cbebcec10f0820cf16112.zip
cdv: Optimize reading of crashdump with many binaries
Earlier, crashdump_viewer stored an index of all binaries in a gb_tree on startup. The binary index was also stored in the cdv_dump_index_table along with all other "=xxx" tags from the dump. The difference between the indices was that the ets table contained the addresses of the binaries as strings (the hex address found after the "=binary:" tag) and in the gb_tree this hex address was instead converted to its integer value. The index in the ets table was only used once - when creating the gb_tree. The gb_tree was used for all later looups (to map integer address to file position). This commit replaces the two storages with one new ets table, cdv_binary_index_table, using the integer value of the hex address as key, and the position in the crashdump file as value. In the case of many binaries, this makes the start of crashdump viewer faster (only one place to write), and the data usage smaller (hex address strings are no longer stored). And it avoids the gc of the gb_tree.
Diffstat (limited to 'lib/observer/src/observer_html_lib.erl')
-rw-r--r--lib/observer/src/observer_html_lib.erl29
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/observer/src/observer_html_lib.erl b/lib/observer/src/observer_html_lib.erl
index 3dfcc42ada..a85808a472 100644
--- a/lib/observer/src/observer_html_lib.erl
+++ b/lib/observer/src/observer_html_lib.erl
@@ -337,17 +337,24 @@ href_proc_bin(From, T, Acc, LTB) ->
Size = list_to_integer(SizeStr),
PreviewSize = min(Size,10),
Id = {list_to_integer(Offset),PreviewSize,list_to_integer(Pos)},
- {ok,PreviewBin} = crashdump_viewer:expand_binary(Id),
- PreviewStr = preview_string(Size, PreviewBin),
- if LTB ->
- href("TARGET=\"expanded\"",
- ["#Binary?offset="++Offset++
- "&size="++SizeStr++
- "&pos="++Pos],
- PreviewStr);
- true ->
- PreviewStr
- end;
+ case crashdump_viewer:expand_binary(Id) of
+ {ok, '#CDVTruncatedBinary'} ->
+ lists:flatten(
+ "<FONT COLOR=\"#FF0000\">"
+ "&lt;&lt;...(Truncated Binary)&gt;&gt;"
+ "</FONT>");
+ {ok, PreviewBin} ->
+ PreviewStr = preview_string(Size, PreviewBin),
+ if LTB ->
+ href("TARGET=\"expanded\"",
+ ["#Binary?offset="++Offset++
+ "&size="++SizeStr++
+ "&pos="++Pos],
+ PreviewStr);
+ true ->
+ PreviewStr
+ end
+ end;
[PreviewIntStr,SizeStr,Md5] when From =:= obs ->
Size = list_to_integer(SizeStr),
PreviewInt = list_to_integer(PreviewIntStr),