-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (34 loc) · 900 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"aries/config/app"
"aries/config/setting"
_ "aries/docs"
"aries/log"
"github.com/pkg/profile"
)
// @title Gin Swagger
// @version 1.0
// @description 基于Golang博客系统 API 接口文档
// @host localhost:8088
func main() {
defer profile.Start(profile.MemProfile, profile.MemProfileRate(1)).Stop()
// go tool pprof -http=:9999 mem.pprof
// go-wrk -t=8 -c=100 -n=10000 "http://127.0.0.1:8088"
//f, _ := os.OpenFile("cpu.pprof", os.O_CREATE|os.O_RDWR, 0644)
//defer func(f *os.File) {
// err := f.Close()
// if err != nil {
//
// }
//}(f)
//err := pprof.StartCPUProfile(f)
//if err != nil {
// return
//}
//defer pprof.StopCPUProfile()
engine := app.InitApp() // 初始化
err := engine.Run(":" + setting.Config.Server.Port) // 运行
if err != nil {
log.Logger.Sugar().Panic("项目启动失败: ", err.Error())
}
}