emc

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 12 Imported by: 1

README

Enhanced JVM Meomry Calculator

emc is enhanced cloudfoundry/java-buildpack-memory-calculator and inspired by making/memory-calculator-cnb. emc counts classes in directory and classes in jar, and show memory options.

# emc counts class in directory recursively. also supports jar in directory.
$ emc --total-memory 1G <path/to/directory>
-XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=14447K -XX:ReservedCodeCacheSize=240M -Xmx266128K

# emc counts class in jar recursively. also supports UberJar.
$ emc --total-memory 1G <path/to/your.jar>
-XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=14447K -XX:ReservedCodeCacheSize=240M -Xmx266128K

Install

# MacOS 
curl -L https://github.com/wreulicke/emc/releases/download/v0.0.2/emc_0.0.2_darwin_amd64 -o /usr/local/bin/emc

# Linux
curl -L https://github.com/wreulicke/emc/releases/download/v0.0.2/emc_0.0.2_linux_amd64 -o /usr/local/bin/emc

# Windows
curl -L https://github.com/wreulicke/emc/releases/download/v0.0.2/emc_0.0.2_windows_amd64.exe -o <path-directory>/emc.exe

Usage

$ go run ./cmd/emc/ --help
usage: emc [<flags>] [<jarOrDirectory>]

Enhanced java memory calculator

Flags:
      --help              Show context-sensitive help (also try --help-long and --help-man).
  -v, --verbose           Verbose
      --total-memory=TOTAL-MEMORY  
                          Total memory. Required if is not limited by cgroup
      --loaded-class-count=LOADED-CLASS-COUNT  
                          Loaded class count
      --thread-count=250  thread count
      --java-options=""   JVM Options
      --head-room=0       Percentage of total memory available which will be left unallocated to cover JVM overhead
      --java-version=11    Java version

Args:
  [<jarOrDirectory>]  jar or directory

LICENSE

MIT LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(totalMemory int64, loadedClassCount int64, threadCount int64, javaOptons string, headRoom int) ([]string, error)

func CountClassFile

func CountClassFile(file *os.File, fi os.FileInfo, findLambda bool) (int64, error)

func CountClassFileInDir

func CountClassFileInDir(dir *os.File, findLambda bool) (int64, error)

func CountClassFileInJar

func CountClassFileInJar(z *zip.Reader, pathPrefix string, findLambda bool) (int64, error)

func CountClassInStandardLibrary

func CountClassInStandardLibrary(version int) int64

Types

This section is empty.

Directories

Path Synopsis
cmd
emc

Jump to

Keyboard shortcuts

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