You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
647 B

package controllers
// import (
// "fmt"
// "os"
// "os/signal"
// "runtime/pprof"
// "syscall"
// )
// func isTrace(bool) {
// f, err := os.Create("cpu.prof")
// if err != nil {
// fmt.Printf("could not create CPU profile: %v\n", err)
// return
// }
// defer f.Close()
// if err := pprof.StartCPUProfile(f); err != nil {
// fmt.Printf("could not start CPU profile: %v\n", err)
// return
// }
// // 设置信号处理
// c := make(chan os.Signal, 1)
// signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
// defer func() {
// pprof.StopCPUProfile()
// fmt.Println("CPU profiling stopped and file closed.")
// }()
// }