divan / gotrace

Concurrency tracer and visualizer for Go (Golang) programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recognize goroutines' patterns for proper visualization

divan opened this issue · comments

In many cases goroutines' invocation have some patterns (i.e. workers, server, etc). They could (and should) be grouped logically and visually separated from other goroutines/groups. This goal is achieved by customizing visualization properties like "angle" and "distance".

Currently the following scheme is implemented: for each goroutine the nesting depth is calculated (0 - means 'main', 1 - 'started from main', etc). Then angle for this depth level is calculated as simple as 360/count.

This approach is ok for simple 1 or 2 nesting level programs (TODO: analyze all github projects to see distribution of goroutines nesting). For more complex programs the visualization will be probably messy.

Workaround: allow user to configure angles/distances manually (per goroutine name, maybe?)

Proper solution: detect patterns, based on name+parent+creation_time and calculate angles/distances separately for each pattern group.