sigx

package
v0.0.0-...-45da7de Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 12 Imported by: 10

README

help

代码嵌入

package main

import (
	"github.com/bingoohuang/gg/pkg/sigx"
)

func init() {
	sigx.RegisterSignalProfile()
}

cpu.profile

  1. start to collect cpu.profile touch jj.cpu; kill -USR1 69110
  2. after some time, like 10 minutes, repeat above cmd to stop.
  3. go tool pprof -http :9402 cpu.profile to view

or

  1. start to collect cpu.profile in 5m echo 5m > jj.cpu; kill -USR1 69110
  2. after 5 minutes, go tool pprof -http :9402 cpu.profile to view

mem.profile

  1. collect mem.profile touch jj.mem; kill -USR1 6911
  2. go tool pprof -http :9402 mem.profile to view

jj.profile

  1. collect specified echo "cpu,heap,allocs,mutex,block,trace,threadcreate,goroutine,d:5m,rate:4096" > jj.profile
  2. go tool pprof -http :9402 xx.pprof or go tool trace trace.out to view

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectCpuProfile

func CollectCpuProfile(cpuProfile string) (bool, error)

func CollectMemProfile

func CollectMemProfile(memProfile string) error

func HasCmd

func HasCmd(f string, remove bool) bool

func ReadCmd

func ReadCmd(f string) []byte

func ReadCmdOK

func ReadCmdOK(f string, remove bool) ([]byte, bool)

func RegisterSignalCallback

func RegisterSignalCallback(f func(), signals ...os.Signal)

func RegisterSignalProfile

func RegisterSignalProfile(signals ...os.Signal)

func RegisterSignals

func RegisterSignals(c context.Context, signals ...os.Signal) (context.Context, context.CancelFunc)

RegisterSignals registers signal handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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