calc

package
v0.0.0-...-1949fd4 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAppPath = AppPath("/app")
	FlagAppPath    = "app-path"
	EnvAppPath     = "BPI_APPLICATION_PATH"
	UsageAppPath   = "the directory on the container where the app's contents are placed"
)
View Source
const (
	DefaultEnableJdwp = EnableJdwp(true)
	FlagEnableJdwp    = "enable-jdwp"
	EnvEnableJdwp     = "BPL_DEBUG_ENABLED"
	UsageEnableJdwp   = "enables Java Debug Wire Protocol (JDWP)"
)
View Source
const (
	DefaultEnableJfr = EnableJfr(false)
	FlagEnableJfr    = "enable-jfr"
	EnvEnableJfr     = "BPL_JFR_ENABLED"
	UsageEnableJfr   = "enables Java Flight Recorder (JFR)"
)
View Source
const (
	DefaultEnableJmx = EnableJmx(false)
	FlagEnableJmx    = "enable-jmx"
	EnvEnableJmx     = "BPL_JMX_ENABLED"
	UsageEnableJmx   = "enables Java Management Extensions (JMX)"
)
View Source
const (
	DefaultEnableNmt = EnableNmt(false)
	FlagEnableNmt    = "enable-nmt"
	EnvEnableNmt     = "BPL_JAVA_NMT_ENABLED"
	UsageEnableNmt   = "enables Native Memory Tracking (NMT)"
)
View Source
const (
	DefaultHeadRoom = HeadRoom(helper.DefaultHeadroom)
	FlagHeadRoom    = "head-room"
	EnvHeadRoom     = "BPL_JVM_HEAD_ROOM"
	UsageHeadRoom   = "percentage of total memory available which will be left unallocated to cover JVM overhead"
)
View Source
const (
	EnvJavaToolOptions = "JAVA_TOOL_OPTIONS"
	OptionsSeparator   = " "
)
View Source
const (
	DefaultJVMCacerts = JVMCacerts("")
	FlagJVMCacerts    = "jvm-cacerts"
	EnvJVMCacerts     = "BPI_JVM_CACERTS"

	UsageJVMCacerts = "path to jvm cacerts, typically 'JAVA_HOME" + subPathCacerts + "'"
)
View Source
const (
	DefaultJVMClassAdj = JVMClassAdj("")
	FlagJVMClassAdj    = "jvm-class-adj"
	EnvJVMClassAdj     = "BPL_JVM_CLASS_ADJUSTMENT"
	UsageJVMClassAdj   = "the adjustment for the number or percentage of JVM classes"
)
View Source
const (
	DefaultJVMClassCount = JVMClassCount(0)
	FlagJVMClassCount    = "jvm-class-count"
	EnvJVMClassCount     = "BPI_JVM_CLASS_COUNT"
	UsageJVMClassCount   = "the number of JVM classes"
)
View Source
const (
	DefaultJVMOptions = JVMOptions("")
	FlagJVMOptions    = "jvm-options"
	EnvJVMOptions     = "JAVA_OPTS"
	UsageJVMOptions   = "vm options, typically JAVA_OPTS"
)
View Source
const (
	DefaultLoadedClassCount = LoadedClassCount(0)
	FlagLoadedClassCount    = "loaded-class-count"
	EnvLoadedClassCount     = "BPL_JVM_LOADED_CLASS_COUNT"
	UsageLoadedClassCount   = "the number of classes that will be loaded when the app is running"
)
View Source
const (
	DefaultThreadCount = ThreadCount(200)
	FlagThreadCount    = "thread-count"
	EnvThreadCount     = "BPL_JVM_THREAD_COUNT"
	UsageThreadCount   = "the number of user threads"
)
View Source
const (
	DefaultVerbose   = Verbose(false)
	FlagVerbose      = "verbose"
	FlagShortVerbose = "v"
	EnvVerbose       = "BP_LOG_LEVEL"
	UsageVerbose     = "enable verbose output"
)

Variables

View Source
var ContributeOptions = []string{"-XX:+ExitOnOutOfMemoryError"}

ContributeOptions 固定要貢獻 jvm 的參數, 這些參數可能是 libjvm 在 build image 時加的而非計算出來的, 或是我們自己想要加上去的都可以放

Functions

This section is empty.

Types

type AppPath

type AppPath string

func NewAppPath

func NewAppPath() *AppPath

func (*AppPath) Contribute

func (ap *AppPath) Contribute() error

func (*AppPath) Set

func (ap *AppPath) Set(s string) error

func (*AppPath) String

func (ap *AppPath) String() string

func (*AppPath) Type

func (ap *AppPath) Type() string

type Calculator

type Calculator struct {
	// MemoryLimitPath 一般情境不需要調整, 開出來是讓 test 時可以設定細節
	MemoryLimitPath *MemoryLimitPath

	JVMOptions       *JVMOptions
	HeadRoom         *HeadRoom
	ThreadCount      *ThreadCount
	LoadedClassCount *LoadedClassCount
	JVMClassCount    *JVMClassCount
	JVMClassAdj      *JVMClassAdj
	JVMCacerts       *JVMCacerts
	AppPath          *AppPath
	EnableNmt        *EnableNmt
	EnableJfr        *EnableJfr
	EnableJmx        *EnableJmx
	EnableJdwp       *EnableJdwp
	Verbose          *Verbose
}

func NewCalculator

func NewCalculator() Calculator

func (*Calculator) Execute

func (c *Calculator) Execute() (*JavaToolOptions, error)

type Contributor

type Contributor interface {

	// Contribute 在執行底層 libjbm 前, 所要貢獻的內容, 這會在執行前先被呼叫, 通常是一些參數的設定等
	Contribute() error
}

type EnableJdwp

type EnableJdwp bool

func NewEnableJdwp

func NewEnableJdwp() *EnableJdwp

func (*EnableJdwp) Contribute

func (jdwp *EnableJdwp) Contribute() error

func (*EnableJdwp) Set

func (jdwp *EnableJdwp) Set(s string) error

func (*EnableJdwp) String

func (jdwp *EnableJdwp) String() string

func (*EnableJdwp) Type

func (jdwp *EnableJdwp) Type() string

type EnableJfr

type EnableJfr bool

func NewEnableJfr

func NewEnableJfr() *EnableJfr

func (*EnableJfr) Contribute

func (jfr *EnableJfr) Contribute() error

func (*EnableJfr) Set

func (jfr *EnableJfr) Set(s string) error

func (*EnableJfr) String

func (jfr *EnableJfr) String() string

func (*EnableJfr) Type

func (jfr *EnableJfr) Type() string

type EnableJmx

type EnableJmx bool

func NewEnableJmx

func NewEnableJmx() *EnableJmx

func (*EnableJmx) Contribute

func (jmx *EnableJmx) Contribute() error

func (*EnableJmx) Set

func (jmx *EnableJmx) Set(s string) error

func (*EnableJmx) String

func (jmx *EnableJmx) String() string

func (*EnableJmx) Type

func (jmx *EnableJmx) Type() string

type EnableNmt

type EnableNmt bool

func NewEnableNmt

func NewEnableNmt() *EnableNmt

func (*EnableNmt) Contribute

func (nmt *EnableNmt) Contribute() error

func (*EnableNmt) Set

func (nmt *EnableNmt) Set(s string) error

func (*EnableNmt) String

func (nmt *EnableNmt) String() string

func (*EnableNmt) Type

func (nmt *EnableNmt) Type() string

type HeadRoom

type HeadRoom int

func NewHeadRoom

func NewHeadRoom() *HeadRoom

func (*HeadRoom) Contribute

func (hr *HeadRoom) Contribute() error

func (*HeadRoom) Set

func (hr *HeadRoom) Set(s string) error

func (*HeadRoom) String

func (hr *HeadRoom) String() string

func (*HeadRoom) Type

func (hr *HeadRoom) Type() string

type JVMCacerts

type JVMCacerts string

func NewJVMCacerts

func NewJVMCacerts() *JVMCacerts

func (*JVMCacerts) Contribute

func (j *JVMCacerts) Contribute() error

func (*JVMCacerts) Set

func (j *JVMCacerts) Set(s string) error

func (*JVMCacerts) String

func (j *JVMCacerts) String() string

func (*JVMCacerts) Type

func (j *JVMCacerts) Type() string

type JVMClassAdj

type JVMClassAdj string

func NewJVMClassAdj

func NewJVMClassAdj() *JVMClassAdj

func (*JVMClassAdj) Contribute

func (j *JVMClassAdj) Contribute() error

func (*JVMClassAdj) Set

func (j *JVMClassAdj) Set(s string) error

func (*JVMClassAdj) String

func (j *JVMClassAdj) String() string

func (*JVMClassAdj) Type

func (j *JVMClassAdj) Type() string

type JVMClassCount

type JVMClassCount int

func NewJVMClassCount

func NewJVMClassCount() *JVMClassCount

func (*JVMClassCount) Contribute

func (lcc *JVMClassCount) Contribute() error

func (*JVMClassCount) Set

func (lcc *JVMClassCount) Set(s string) error

func (*JVMClassCount) String

func (lcc *JVMClassCount) String() string

func (*JVMClassCount) Type

func (lcc *JVMClassCount) Type() string

type JVMOptions

type JVMOptions string

func NewJVMOptions

func NewJVMOptions() *JVMOptions

func (*JVMOptions) Contribute

func (j *JVMOptions) Contribute() error

func (*JVMOptions) Set

func (j *JVMOptions) Set(s string) error

func (*JVMOptions) String

func (j *JVMOptions) String() string

func (*JVMOptions) Type

func (j *JVMOptions) Type() string

type JavaToolOptions

type JavaToolOptions string

func BuildJavaToolOptions

func BuildJavaToolOptions() *JavaToolOptions

func (*JavaToolOptions) Print

func (j *JavaToolOptions) Print()

func (*JavaToolOptions) String

func (j *JavaToolOptions) String() string

func (*JavaToolOptions) WriteFile

func (j *JavaToolOptions) WriteFile(file string) error

type LoadedClassCount

type LoadedClassCount int

func NewLoadedClassCount

func NewLoadedClassCount() *LoadedClassCount

func (*LoadedClassCount) Contribute

func (lcc *LoadedClassCount) Contribute() error

func (*LoadedClassCount) HasValue

func (lcc *LoadedClassCount) HasValue() bool

func (*LoadedClassCount) Set

func (lcc *LoadedClassCount) Set(s string) error

func (*LoadedClassCount) String

func (lcc *LoadedClassCount) String() string

func (*LoadedClassCount) Type

func (lcc *LoadedClassCount) Type() string

type MemoryLimitPath

type MemoryLimitPath struct {
	V1 string
	V2 string
}

func NewMemoryLimitPath

func NewMemoryLimitPath() *MemoryLimitPath

type ThreadCount

type ThreadCount int

func NewThreadCount

func NewThreadCount() *ThreadCount

func (*ThreadCount) Contribute

func (tc *ThreadCount) Contribute() error

func (*ThreadCount) Set

func (tc *ThreadCount) Set(s string) error

func (*ThreadCount) String

func (tc *ThreadCount) String() string

func (*ThreadCount) Type

func (tc *ThreadCount) Type() string

type Verbose

type Verbose bool

func NewVerbose

func NewVerbose() *Verbose

func (*Verbose) Contribute

func (v *Verbose) Contribute() error

func (*Verbose) Set

func (v *Verbose) Set(s string) error

func (*Verbose) String

func (v *Verbose) String() string

func (*Verbose) Type

func (v *Verbose) Type() string

Jump to

Keyboard shortcuts

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