sodium
sodium copied to clipboard
Debugging.
For practical use library needs strong debug functionality. If something goes wrong it is hard to understand the reason. Other libs has interesting tools for it.
For example: https://github.com/jaredly/rxvision
Tools we need:
- Memory leak detector.
- Tree structure viewer.
- Runtime operations printer.
For my implementation I workong on Tree Viewer. Single function dump(s: Stream<*>)
prints to log tree structure in dot
format.
For example this structure of function Stream.collect
from testCollect
:
digraph G {
{node [shape=box;style=filled;color=lightgrey;]"Node:19651F3";"Node:157696F";"Node:67C67E";"Node:BC8AB5";"Node:C1670B";"Node:1B21B69";"Node:7080DC";}
"Node:19651F3" [label="map - StreamImpl.kt:192\nrank=2"];
"Node:157696F" [label="snapshot - StreamImpl.kt:188\nrank=1"];
"Node:67C67E" [label="Node:67C67E\nrank=9223372036854775807"];
"Node:BC8AB5" [label="<init> - StreamImpl.kt:186\nrank=3"];
"Node:C1670B" [label="<init> - Sodium.kt:14\nrank=0"];
"Node:1B21B69" [label="map - StreamImpl.kt:189\nrank=2"];
"Node:7080DC" [label="lastFiringOnly - CellImpl.kt:23\nrank=4"];
"Node:C1670B" -> "Target:18D30F7"
"Target:18D30F7" -> "Node:157696F"
"Target:18D30F7" -> "action:1D2A7E8"
"Node:157696F" -> "Target:57CD70"
"Target:57CD70" -> "Node:1B21B69"
"Target:57CD70" -> "action:9273A8"
"Node:1B21B69" -> "Target:7D1D39"
"Target:7D1D39" -> "Node:67C67E"
"Target:7D1D39" -> "action:A7B76D"
"Node:157696F" -> "Target:1A7504C"
"Target:1A7504C" -> "Node:19651F3"
"Target:1A7504C" -> "action:BDB505"
"Node:19651F3" -> "Target:39AC6"
"Target:39AC6" -> "Node:BC8AB5"
"Target:39AC6" -> "action:E6A65D"
"Node:BC8AB5" -> "Target:16E852B"
"Target:16E852B" -> "Node:7080DC"
"Target:16E852B" -> "action:100955A"
"Node:7080DC" -> "Target:D2FA64"
"Target:D2FA64" -> "Node:67C67E"
"Target:D2FA64" -> "action:874448"
}
You can visualize this code in online tool: http://www.webgraphviz.com/
Yes - these are great things to do. I don't have time for any of it at the moment but let's leave this open.