system

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountBinary added in v0.10.0

func ByteCountBinary(b uint64) string

ByteCountBinary formats b as human-readable size (1024-based: KiB, MiB, …, rendered as KB/MB/GB to match common storage conventions). Used by the API stats endpoint so disk usage figures line up with `du` / filesystem tools.

func ByteCountDecimal

func ByteCountDecimal(b uint64) string

ByteCountDecimal formats b as human-readable size (1000-based: kB, MB, …). Use ByteCountBinary for filesystem-style 1024-based output.

func DirSize

func DirSize(path string) (uint64, error)

DirSize returns the total size in bytes of all files under path. Uses filepath.WalkDir for fewer syscalls and better performance (Go 1.16+).

func DiskAvailable

func DiskAvailable(path ...string) (uint64, error)

DiskAvailable returns the number of bytes available to the current user in the filesystem hosting the given path. When path is empty it falls back to the current working directory (legacy behaviour). Unix-only.

Note: on all target architectures (linux/386, linux/arm, linux/arm64, linux/amd64, darwin/amd64, darwin/arm64), unix.Statfs_t.Bavail is uint64 and Bsize is signed; the explicit uint64() cast on Bsize keeps the multiplication well-defined on 32-bit builds, so no per-arch shim is required here.

func GetMemoryUsageAndGoroutine

func GetMemoryUsageAndGoroutine() (uint64, string)

GetMemoryUsageAndGoroutine returns current Alloc bytes and the goroutine count (as a string for direct rendering on the home page). Results are cached for memStatsTTL to avoid back-to-back STW pauses under bursty scrapes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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