memplot

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

README

memplot

A small utility written in golang to quickly plot memory usage of processes. memplot constantly samples memory usage of a process, for a given amount of time and then outputs an image file. Painless and straightforward. Supported image extensions are: .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff

Installation

Binaries for Linux and MacOS are available in the releases page

go get -u -v github.com/0x0f0f0f/memplot/cmd

Usage

Usage of memplot:
Arguments following options will be interpreted as the command to spawn and sample
  -dur duration
    	total profiling time. a value of 0 means that the program
    	will be sampled until it is no longer running
  -height string
    	plot image height (can be cm or in) (default "12cm")
  -o string
    	output image file name. supported extensions are:
    	.eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff
    	(default "output-plot.png")
  -pid int
    	pid of the process to analyze (default -1)
  -sd duration
    	sample size in time (default 5ms)
  -vsz
    	plot virtual size
  -width string
    	plot image width (can be cm or in) (default "16cm")

Example Plot

memplot -pid 25273 -width 8in -height 8in -dur 60s -sd 50ms -o plot.png

or

memplot -width 8in -height 8in -dur 60s -sd 50ms -o plot.png firefox

Roadmap

  • Plot other useful values
  • Colors
  • Option to change the font
  • Memory autoscaling
  • Spawn child processes to sample

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SavePlot

func SavePlot(p *plot.Plot, width, height vg.Length, filename string) error

Types

type Collection added in v0.1.1

type Collection struct {
	Pid            int32
	StartTime      time.Time
	SampleDuration time.Duration // Time between samples
	Samples        []Instant
}

func NewCollection added in v0.1.1

func NewCollection(pid int32, sd, dur time.Duration) (*Collection, error)

Gather a process resident size in memory in batch

func (*Collection) GatherRSSXYs added in v0.1.1

func (m *Collection) GatherRSSXYs() plotter.XYs

Gather RSS points from a memory collection

func (*Collection) GatherVSZXYs added in v0.1.1

func (m *Collection) GatherVSZXYs() plotter.XYs

Gather VSZ points from a memory collection

func (*Collection) Plot added in v0.1.1

func (m *Collection) Plot(opt PlotOptions) (*plot.Plot, error)

Plot a memory collection

type Instant added in v0.1.1

type Instant struct {
	MemoryInfo *process.MemoryInfoStat
	Instant    time.Duration
}

Memory data for a given instant

type PlotOptions

type PlotOptions struct {
	PlotRss bool
	PlotVsz bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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