goprof

package module
v0.0.0-...-c2373cd Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2015 License: MIT Imports: 7 Imported by: 0

README

goprof

This library provides single entry point to all profiling functionality available in golang 1.5. StartProfiling starts writing trace and cpu profile to some random directory it creates before running. When you call StopProfiling it writes heap profile to the same directory as well as stopping current profiling.

Logging

By default, the library writes logs about start/stop profiling and errors using standard go logger. You can provide your own log function in order to make it fit your logging or shut up the logging at all.

We don't use much log levels since all the messages have quite the same level.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProfilingInProgress

func ProfilingInProgress() bool

ProfilingInProgress returns true if we write profiles at the moment

func SetLogFunction

func SetLogFunction(fxn LogFxn)

SetLogFunction changes function used for logging. Logging is very basic and doesn't have many levels, since all the messages has quite the same level

func StartProfiling

func StartProfiling() (profilesDirectory string, err error)

StartProfiling starts writing profiles and returns path to the directory where they will be placed if anything goes wrong corresponding error is returned and no profiling is started If writing profiles is in progress it returns an error

func StopProfiling

func StopProfiling() (profilesDirectory string)

StopProfiling stops writing all profiles. Before stopping it tries to write a heap dump to the same folder where the other profiles are kept. It returns path to the folder which contains profiling files If profiling is not in progress, this method does nothing and returns empty string

func ToggleProfiling

func ToggleProfiling() (profilesDirectory string, err error)

ToggleProfiling changes state of writing profiles to the opposite

Types

type LogFxn

type LogFxn func(format string, args ...interface{})

LogFxn is function which is used for writing log messages It doesn't have many levels, since all the messages has quite the same level

Jump to

Keyboard shortcuts

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