gprofiling

package
v0.0.0-...-95b279b Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 6 Imported by: 0

README

profiling

profiling package help you do profiling your program in easy way.

demo

package main

func main() {
    //StartArg will search command line arguments "profiling" , using it's value as store data folder.
    StartArg("profiling")
    defer Stop()
    //do something, keep long time, such 15 minutes
}

start your programe with ./foobar -profiling=debug

package main

func main() {
    //Start will using the argument as store data folder
    Start("debug")
    defer Stop()
    //do something, keep long time, such 15 minutes
}

start your programe with ./foobar

cpu.prof, memory.prof, block.prof, goroutine.prof, threadcreate.prof files will be create in debug folder after your program exited.

then you can using go tool pprof foobar memory.prof to profiling your program.

Documentation

Overview

Package gprofiling package help you do profiling your program in easy way.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(storePath string)

Start arguments is store folder path,

all profiling files will be stored in "storePath" folder, folder must be exists

Example
//Start will using the argument as store data folder
Start("debug")
defer Stop()
Output:

func StartArg

func StartArg(argName string)

StartArg bind command line argument, no - or -- prefix, such as: profiling

./foobar -profiling=debug

all profiling files will be stored in named debug folder, folder must be exists

Example
//StartArg will search command line arguments "profiling" , using it's value as store data folder.
StartArg("profiling")
defer Stop()
Output:

func Stop

func Stop()

Stop profiling, and write profiling data to file, must be call when you needed, if it not be called, nothing profiling data will be write.

Types

This section is empty.

Jump to

Keyboard shortcuts

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