1 Star 0 Fork 1

menuiis / gkit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run_in_docker.go 1003 Bytes
一键复制 编辑 原始数据 按行查看 历史
menuis 提交于 2024-04-22 10:18 . init
package main
import (
"net/http"
"time"
"gitee.com/menciis/gkit/watching"
)
func init() {
http.HandleFunc("/docker", dockermake1gb)
http.HandleFunc("/docker/cpu", cpuex)
http.HandleFunc("/docker/cpu_multi_core", cpuMulticore)
go http.ListenAndServe(":10003", nil)
}
func main() {
w := watching.NewWatching(
watching.WithCollectInterval("2s"),
watching.WithCoolDown("1m"),
watching.WithDumpPath("/tmp"),
watching.WithTextDump(),
watching.WithLoggerLevel(watching.LogLevelDebug),
watching.WithMemDump(3, 25, 80),
watching.WithCPUDump(60, 10, 80),
watching.WithCGroup(true),
)
w.EnableCPUDump()
w.EnableMemDump()
w.Start()
time.Sleep(time.Hour)
}
func cpuex(wr http.ResponseWriter, req *http.Request) {
go func() {
for {
}
}()
}
func cpuMulticore(wr http.ResponseWriter, req *http.Request) {
for i := 1; i <= 100; i++ {
go func() {
for {
}
}()
}
}
func dockermake1gb(wr http.ResponseWriter, req *http.Request) {
a := make([]byte, 1073741824)
_ = a
}
1
https://gitee.com/menciis/gkit.git
git@gitee.com:menciis/gkit.git
menciis
gkit
gkit
4f74120a101e

搜索帮助