bradleyjkemp / memviz

Visualize your Go data structures using graphviz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

improve big struct display

cch123 opened this issue · comments

I combined memviz with https://github.com/sitano/gsysint to display structure of runtime.g, and there are many fields in this struct.

Expected Behaviour

What were you wanting/expecting to happen?
The layout of a struct can be displayed as multiple lines or a table or something.

Actual Behaviour

What actually happens at the moment?
The struct is displayed as a single line, and too wide.

Example input

If possible, provide a small code sample which reproduces the issue (or, for a feature request, code that should work after the feature is implemented)

package main

import (
	"os"
	"sync/atomic"
	"unsafe"

	"github.com/bradleyjkemp/memviz"
	"github.com/sitano/gsysint"
)

func main() {
	var gp unsafe.Pointer

	atomic.StorePointer(&gp, gsysint.GetG())

	gg := (*gsysint.G)(gp)
	memviz.Map(os.Stdout, gg)
}

Screenshot/Example output (if applicable)

digraph {

}

Hmm yeah that's a tricky one. I think displaying it as multiple rows would be quite messy with pointers coming out of the middle.

Would it help if the struct could be drawn vertically instead of horizontally? Then it's a lot easier to scroll through each field

vertical display is also ok~

my render result can be found here

https://github.com/cch123/misc/blob/master/demo.jpg