mempressure

package
v0.0.0-...-9474aff Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package mempressure creates a realistic memory pressure situation and takes related measurements.

Index

Constants

View Source
const (
	// CompressibleData is a file containing compressible data for preallocation.
	CompressibleData = "memory_pressure_page.lzo.40"
	// WPRArchiveName is the external file name for the wpr archive.
	WPRArchiveName = "memory_pressure_mixed_sites.wprgo"
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, outDir string, cr *chrome.Chrome, arc *arc.ARC, p *RunParameters) (errRet error)

Run creates a memory pressure situation by loading multiple tabs into Chrome until the first tab discard occurs. It takes various measurements as the pressure increases (phase 1) and afterwards (phase 2). Parameter arc is optional - if nil, VM-dependent metrics will be omitted.

Types

type RunParameters

type RunParameters struct {
	// PageFilePath is the path name of a file with one page (4096 bytes)
	// of data.
	PageFilePath string
	// PageFileCompressionRatio is the approximate zram compression ratio of the content of PageFilePath.
	PageFileCompressionRatio float64
	// MaxTabCount is the maximal tab count to open
	MaxTabCount int
	// Mode indicates whether to run in record mode
	// vs. replay mode.
	Mode wpr.Mode
}

RunParameters contains the configurable parameters for Run.

type TestEnv

type TestEnv struct {
	// contains filtered or unexported fields
}

TestEnv is a struct containing the common setup data for memory pressure tests.

func NewTestEnv

func NewTestEnv(ctx context.Context, outDir string, enableARC, useHugePages bool, archive string) (*TestEnv, error)

NewTestEnv creates a new TestEnv, creating new WPR, Chrome, and ARC instances to use.

func (*TestEnv) ARC

func (te *TestEnv) ARC() *arc.ARC

ARC returns the initialized ARC object in TestEnv (may be nil when no VM).

func (*TestEnv) Chrome

func (te *TestEnv) Chrome() *chrome.Chrome

Chrome returns the initialized Chrome object in TestEnv.

func (*TestEnv) Close

func (te *TestEnv) Close(ctx context.Context)

Close closes the Chrome, ARC, and WPR instances used in the TestEnv.

Jump to

Keyboard shortcuts

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