prof

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 3 Imported by: 0

README

prof

Wrap the official net/http/pprof route and add the profile io wait time route.


Example of use

    import "gitee.com/yzsunjianguo/common_pkg/gin/prof"

	r := gin.Default()
	prof.Register(r, WithPrefix("/myServer"), WithIOWaitTime())

	httpServer := &http.Server{
		Addr:    ":8080",
		Handler: r,
	}
	
    if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
        panic("listen and serve error: " + err.Error())
    }

Documentation

Overview

Package prof is used for gin profiling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *gin.Engine, opts ...Option)

Register pprof for gin router

Types

type Option

type Option func(o *options)

Option set defaultPrefix func

func WithIOWaitTime

func WithIOWaitTime() Option

WithIOWaitTime enable IO wait time

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix set route defaultPrefix

Jump to

Keyboard shortcuts

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