profiling

package
v0.3.2-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUProfile added in v1.0.0

func CPUProfile(filename string, enabled bool, targetFunc func() error) error

CPUProfile runs a CPU profile while executing the provided function. It writes profiling data to the specified file if profiling is enabled.

Parameters: - filename: The name of the file to write the CPU profile data. - enabled: A boolean indicating whether profiling is enabled. - targetFunc: A function to execute while profiling.

Returns: - error: Returns any error encountered during the execution of the target function or profiling.

func CaptureMEMProfile added in v1.0.0

func CaptureMEMProfile(filename string, enabled bool)

CaptureMEMProfile captures a memory profile and writes it to the specified file if profiling is enabled. This triggers garbage collection to ensure the memory profile is accurate.

Parameters: - filename: The name of the file to write the memory profile data. - enabled: A boolean indicating whether profiling is enabled.

func SetupProfileFile added in v1.0.0

func SetupProfileFile(filename string) (*os.File, error)

SetupProfileFile checks if the profile file exists and creates a new file if necessary. If the file already exists, it appends a timestamp to avoid overwriting.

func StartCPUProfile

func StartCPUProfile(filename string, enabled bool) (stopCPUProfile func())

StartCPUProfile starts CPU profiling and writes the profiling data to the specified file. It returns a function to stop the profiling. If profiling is disabled, it returns a no-op function.

Parameters: - filename: The name of the file to write the CPU profile data. - enabled: A boolean indicating whether profiling is enabled.

Returns: - stopCPUProfile: A function that stops the CPU profiling when called.

Types

This section is empty.

Jump to

Keyboard shortcuts

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