memviz icon indicating copy to clipboard operation
memviz copied to clipboard

improve big struct display

Open cch123 opened this issue 7 years ago • 2 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 {

}

cch123 avatar Mar 05 '18 06:03 cch123

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

bradleyjkemp avatar Mar 05 '18 17:03 bradleyjkemp

vertical display is also ok~

my render result can be found here

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

cch123 avatar Mar 05 '18 17:03 cch123