Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CPUProfile ¶ added in v1.0.0
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
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
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 ¶
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.