bloaty

package
v0.0.0-...-2ad2f98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputItem

type OutputItem struct {
	// CompileUnit is the source file where a symbol is found, e.g. "src/core/SkBuffer.cpp".
	CompileUnit string

	// Symbol is the name of a symbol, e.g. "SkRBuffer::read()"".
	Symbol string

	// VirtualMemorySize is the number of bytes the binary takes when it is loaded into memory.
	VirtualMemorySize int

	// FileSize is the number of bytes the binary takes on disk.
	FileSize int
}

OutputItem represents a single line in a Bloaty output file.

func ParseTSVOutput

func ParseTSVOutput(bloatyOutput string) ([]OutputItem, error)

ParseTSVOutput parses the TSV output of Bloaty.

The parameter should contain the output of a Bloaty invocation such as the following:

$ bloaty <path/to/binary> -d compileunits,symbols -n 0 --tsv

type TreeMapDataTableRow

type TreeMapDataTableRow struct {
	// Name is the unique, non-empty name of the node. Uniqueness is necessary, otherwise
	// google.visualization.TreeView will throw an exception.
	Name string `json:"name"`

	// Parent is the name of the parent node. The root node will have an empty parent. Client code
	// must turn the parent node into a null JavaScript value, otherwise google.visualization.TreeView
	// will throw an exception.
	Parent string `json:"parent"`

	// Size is the size in bytes of the node. Non-symbol nodes (e.g. paths) should be 0.
	Size int `json:"size"`
}

TreeMapDataTableRow represents a "row" in a two-dimensional JavaScript array suitable for passing to google.visualization.arrayToDataTable()[1].

[1] https://developers.google.com/chart/interactive/docs/reference#arraytodatatable

func GenTreeMapDataTableRows

func GenTreeMapDataTableRows(items []OutputItem, maxChildren int) []TreeMapDataTableRow

GenTreeMapDataTableRows takes a parsed Bloaty output and returns a slice of "row" structs that can be converted into a two-dimensional JavaScript array suitable for passing to google.visualization.arrayToDataTable()[1]. The resulting DataTable can then be passed to a google.visualization.TreeMap[2].

Callers should prepend a header row such as ['Name', 'Parent', 'Size'] to the two-dimensional JavaScript array, and must convert any parent fields with empty strings to null JavaScript values before passing the array to google.visualization.arrayToDataTable().

[1] https://developers.google.com/chart/interactive/docs/reference#arraytodatatable [2] https://developers.google.com/chart/interactive/docs/gallery/treemap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL