pprof.go 820 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package controllers
  2. import (
  3. "net/http/pprof"
  4. "github.com/gin-gonic/gin"
  5. )
  6. func PprofIndex(c *gin.Context) {
  7. pprof.Index(c.Writer, c.Request)
  8. }
  9. func PprofCmdline(c *gin.Context) {
  10. pprof.Cmdline(c.Writer, c.Request)
  11. }
  12. func PprofProfile(c *gin.Context) {
  13. pprof.Profile(c.Writer, c.Request)
  14. }
  15. func PprofSymbol(c *gin.Context) {
  16. pprof.Symbol(c.Writer, c.Request)
  17. }
  18. func PprofTrace(c *gin.Context) {
  19. pprof.Trace(c.Writer, c.Request)
  20. }
  21. func PprofGoroutine(c *gin.Context) {
  22. pprof.Handler("goroutine").ServeHTTP(c.Writer, c.Request)
  23. }
  24. func PprofHeap(c *gin.Context) {
  25. pprof.Handler("heap").ServeHTTP(c.Writer, c.Request)
  26. }
  27. func PprofAllocs(c *gin.Context) {
  28. pprof.Handler("allocs").ServeHTTP(c.Writer, c.Request)
  29. }
  30. func PprofBlock(c *gin.Context) {
  31. pprof.Handler("block").ServeHTTP(c.Writer, c.Request)
  32. }